Beispiel #1
0
 public Amino_Acid_Edit_Dialog(MainWindow mainW, Amino_Acid aa)
 {
     this.mainW = mainW;
     this.aa    = aa;
     InitializeComponent();
     this.name_txt.Text        = aa.Name;
     this.composition_txt.Text = aa.Composition;
     this.mass_txt.Text        = aa.Mass.ToString("F6");
 }
Beispiel #2
0
        private void Edit_Amino_Acid_btn_clk(object sender, RoutedEventArgs e)
        {
            Amino_Acid selected_aa = this.aa_listView.SelectedItem as Amino_Acid;

            if (selected_aa == null)
            {
                MessageBox.Show(Message_Helper.AA_Selected_NULL_Message);
                return;
            }
            Amino_Acid_Edit_Dialog eaad = new Amino_Acid_Edit_Dialog(this, selected_aa);

            eaad.ShowDialog();
        }
Beispiel #3
0
        private void get_C_count_clk(object sender, RoutedEventArgs e)
        {
            string sq = sq_txt.Text;
            string modification_str = mod_txt.Text;
            int    C_count          = 0;

            for (int i = 0; i < sq.Length; ++i)
            {
                Amino_Acid aa = mainW.aas[sq[i] - 'A'];
                List <Element_composition> ecs = aa.Element_composition;
                for (int j = 0; j < ecs.Count; ++j)
                {
                    if (ecs[j].Element_name == "C")
                    {
                        C_count += ecs[j].Element_number;
                    }
                }
            }
            System.Collections.Hashtable modStr_Modification_hash = new System.Collections.Hashtable();
            for (int i = 0; i < this.mainW.modifications.Count; ++i)
            {
                modStr_Modification_hash[this.mainW.modifications[i].Name] = i;
            }
            List <Modification> modifications = new List <Modification>();

            string[] strs = modification_str.Split(new char[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < strs.Length; ++i)
            {
                modifications.Add(this.mainW.modifications[(int)modStr_Modification_hash[strs[i]]]);
            }
            for (int i = 0; i < modifications.Count; ++i)
            {
                List <Element_composition> ecs = modifications[i].parse_element_composition();
                for (int j = 0; j < ecs.Count; ++j)
                {
                    if (ecs[j].Element_name == "C")
                    {
                        C_count += ecs[j].Element_number;
                    }
                }
            }
            this.N_count_txt.Text = C_count + "";
        }
Beispiel #4
0
        public static ObservableCollection <Amino_Acid> load_AA(string aa_ini_path, MainWindow mainW)
        {
            ObservableCollection <Amino_Acid> aas = new ObservableCollection <Amino_Acid>();
            StreamReader sr = new StreamReader(aa_ini_path, Encoding.Default);

            while (!sr.EndOfStream)
            {
                string line = sr.ReadLine();
                if (line.Length >= 1 && line.Substring(0, 1) == "R")
                {
                    string[]   strs           = line.Split(new char[] { '=', '|' }, StringSplitOptions.RemoveEmptyEntries);
                    string     name           = strs[1];
                    string     compostion_str = strs[2];
                    Amino_Acid aa             = new Amino_Acid(name);
                    aa.Composition = compostion_str;
                    double mass = 0.0;
                    aa.Element_composition = Element_composition.parse(mainW, aa.Composition, ref mass);
                    aa.Mass = mass;
                    aas.Add(aa);
                }
            }
            sr.Close();
            return(aas);
        }