private void range_clk(object sender, RoutedEventArgs e)
        {
            PlotModel model = null;

            if (mainW.display_tab.SelectedIndex == 0) //显示的是MS1
            {
                model = mainW.Model1;
            }
            else if (mainW.display_tab.SelectedIndex == 1) //显示的是MS2
            {
                model = mainW.Model2;
            }
            double min_mz = model.Axes[1].AbsoluteMinimum;
            double max_mz = model.Axes[1].AbsoluteMaximum;

            if (Config_Help.IsDecimalAllowed(this.minMZ_txt.Text))
            {
                min_mz = double.Parse(this.minMZ_txt.Text);
            }
            if (Config_Help.IsDecimalAllowed(this.maxMZ_txt.Text))
            {
                max_mz = double.Parse(this.maxMZ_txt.Text);
            }
            mainW.zoom(min_mz, max_mz, model);
        }
Beispiel #2
0
        private void filter_btn_clk(object sender, RoutedEventArgs e)
        {
            string ac = protein_filter_AC_tb.Text;
            string de = protein_filter_DE_tb.Text;
            string group = protein_filter_Group_tb.Text;
            int    pep_number = 0, sq_number = 0;
            int    target_index = this.target_comboBox.SelectedIndex;
            bool   is_con       = (bool)this.con_need_cbx.IsChecked;

            if (protein_peptide_number_tb.Text == "")
            {
                pep_number = 0;
            }
            else
            {
                if (!Config_Help.IsIntegerAllowed(protein_peptide_number_tb.Text))
                {
                    MessageBox.Show(Message_Help.PROTEIN_PEP_NUMBER);
                    return;
                }
                else
                {
                    pep_number = int.Parse(protein_peptide_number_tb.Text);
                }
            }
            if (protein_sq_number_tb.Text == "")
            {
                sq_number = 0;
            }
            else
            {
                if (!Config_Help.IsIntegerAllowed(protein_sq_number_tb.Text))
                {
                    MessageBox.Show(Message_Help.PROTEIN_PEP_NUMBER);
                    return;
                }
                else
                {
                    sq_number = int.Parse(protein_sq_number_tb.Text);
                }
            }

            ObservableCollection <Protein> proteins = mainW.protein_panel.identification_proteins;

            proteins = filter_by_AC(ac, proteins);
            proteins = filter_by_DE(de, proteins);
            proteins = filter_by_Group(group, proteins);
            proteins = filter_by_Pep_number(pep_number, proteins);
            proteins = filter_by_Sq_number(sq_number, proteins);
            proteins = filter_byTarget(target_index, proteins);
            proteins = filter_byContaminant(is_con, proteins);
            mainW.protein_data.ItemsSource = proteins;
            mainW.display_size.Text        = proteins.Count.ToString();

            this.Close();
        }
Beispiel #3
0
        public ObservableCollection <PSM> filter_bySQ_or_Title(string str, int flag, ObservableCollection <PSM> all_psms, int regular_flag = 0) //regular_flag为0表示Normal搜索,为1表示正则表达式搜索
        {
            if (str == "")
            {
                return(all_psms);
            }
            ObservableCollection <PSM> psms = new ObservableCollection <PSM>();

            if (flag == 0)
            {
                if (regular_flag == 0)
                {
                    for (int i = 0; i < all_psms.Count; ++i)
                    {
                        if (all_psms[i].Title.Contains(str))
                        {
                            psms.Add(all_psms[i]);
                        }
                    }
                }
                else if (regular_flag == 1)
                {
                    for (int i = 0; i < all_psms.Count; ++i)
                    {
                        if (Config_Help.IsMatch_RegularExpression(all_psms[i].Title, str))
                        {
                            psms.Add(all_psms[i]);
                        }
                    }
                }
            }
            else if (flag == 1)
            {
                if (regular_flag == 0)
                {
                    for (int i = 0; i < all_psms.Count; ++i)
                    {
                        if (all_psms[i].Sq.Contains(str))
                        {
                            psms.Add(all_psms[i]);
                        }
                    }
                }
                else if (regular_flag == 1)
                {
                    for (int i = 0; i < all_psms.Count; ++i)
                    {
                        if (Config_Help.IsMatch_RegularExpression(all_psms[i].Sq, str))
                        {
                            psms.Add(all_psms[i]);
                        }
                    }
                }
            }
            return(psms);
        }
Beispiel #4
0
        private void add_btn_clk(object sender, RoutedEventArgs e)
        {
            string name = name_tb.Text;

            if (!Config_Help.IsDecimalAllowed(mass_tb.Text))
            {
                return;
            }
            double mass = double.Parse(mass_tb.Text);

            Denovol_Config.All_mass.Add(new Denovol_Config.DCC(mass, name));
            update();
        }
Beispiel #5
0
        private void update_element()
        {
            if (this.Mod == "")
            {
                this.Element = "";
                this.Mass    = "";
                return;
            }
            int index = Config_Help.get_label_index(this.Mod_Flag);

            Aa[]     aas    = Config_Help.modStr_elements_hash[this.Mod] as Aa[];
            double[] masses = Config_Help.modStr_hash[this.Mod] as double[];
            if (aas == null || aas[index] == null || masses == null || masses[index] == null)
            {
                return;
            }
            this.Element = pBuild.Aa.parse_String_byAa(aas[index]);
            this.Mass    = masses[index].ToString("F2");
        }
Beispiel #6
0
        private void ok_btn_clk(object sender, RoutedEventArgs e)
        {
            List <double> masses           = new List <double>();
            List <double> mass_errors      = new List <double>();
            List <int>    mass_error_flags = new List <int>();
            bool          flag             = true;

            for (int i = 0; i < this.grid.RowDefinitions.Count; ++i)
            {
                TextBox  tbx1   = this.grid.Children[i * 4 + 1] as TextBox;
                TextBox  tbx2   = this.grid.Children[i * 4 + 2] as TextBox;
                ComboBox cb     = this.grid.Children[i * 4 + 3] as ComboBox;
                string   cb_str = cb.SelectedItem as string;
                if (!Config_Help.IsDecimalAllowed(tbx1.Text) || !Config_Help.IsDecimalAllowed(tbx2.Text))
                {
                    flag = false;
                    break;
                }
                masses.Add(double.Parse(tbx1.Text));
                double mass_error = double.Parse(tbx2.Text);
                int    me_flag    = 1;
                if (cb_str == "ppm")
                {
                    mass_error = mass_error * 1e-6;
                    me_flag    = 0;
                }
                mass_errors.Add(mass_error);
                mass_error_flags.Add(me_flag);
            }
            if (!flag)
            {
                MessageBox.Show(Message_Help.ALL_TERM_BE_DOUBLE);
                return;
            }

            this.mainW.ms2_quant_help2 = new MS2_Quant_Help2(masses, mass_errors, mass_error_flags);
            this.Cursor = Cursors.Wait;
            this.mainW.ms2_quant2();
            this.Close();
            this.Cursor = null;
        }
Beispiel #7
0
        private void ok_btn(object sender, RoutedEventArgs e)
        {
            string n1_str    = this.n_term1_tbx.Text;
            string n2_str    = this.n_term2_tbx.Text;
            string c1_str    = this.c_term1_tbx.Text;
            string c2_str    = this.c_term2_tbx.Text;
            string me_str    = this.mass_error_tbx.Text;
            string n1_aa_str = this.n_term1_aa_tbx.Text;
            string n2_aa_str = this.n_term2_aa_tbx.Text;
            string c1_aa_str = this.c_term1_aa_tbx.Text;
            string c2_aa_str = this.c_term2_aa_tbx.Text;

            string mz1_str = this.mz1_tbx.Text;
            string mz2_str = this.mz2_tbx.Text;

            Config_Help.MS2_Match_Ion_Type = this.match_Ion_type_tbx.Text;

            if (!Config_Help.IsDecimalAllowed(n1_str) || !Config_Help.IsDecimalAllowed(n2_str) || !Config_Help.IsDecimalAllowed(c1_str) ||
                !Config_Help.IsDecimalAllowed(c2_str) || !Config_Help.IsDecimalAllowed(me_str))
            {
                MessageBox.Show(Message_Help.ALL_TERM_BE_DOUBLE);
                return;
            }
            if (!Config_Help.IsRightAA(n1_aa_str) || !Config_Help.IsRightAA(n2_aa_str) || !Config_Help.IsRightAA(c1_aa_str) ||
                !Config_Help.IsRightAA(c2_aa_str))
            {
                MessageBox.Show(Message_Help.ALL_AA_WRONG);
                return;
            }

            if (!Config_Help.IsDecimalAllowed(mz1_str) || !Config_Help.IsDecimalAllowed(mz2_str))
            {
                MessageBox.Show(Message_Help.ALL_TERM_BE_DOUBLE);
                return;
            }

            double n1_mass = double.Parse(n1_str);
            double n2_mass = double.Parse(n2_str);
            double c1_mass = double.Parse(c1_str);
            double c2_mass = double.Parse(c2_str);
            double me_mass = double.Parse(me_str);
            double mz1     = double.Parse(mz1_str);
            double mz2     = double.Parse(mz2_str);

            if (this.mass_error_cb.SelectedIndex == 0)
            {
                mainW.ms2_quant_help = new MS2_Quant_Help(n1_mass, n2_mass, c1_mass, c2_mass, n1_aa_str,
                                                          n2_aa_str, c1_aa_str, c2_aa_str, me_mass * 1e-6, 0.0, mz1, mz2);
            }
            else
            {
                mainW.ms2_quant_help = new MS2_Quant_Help(n1_mass, n2_mass, c1_mass, c2_mass, n1_aa_str,
                                                          n2_aa_str, c1_aa_str, c2_aa_str, 0.0, me_mass, mz1, mz2);
            }

            this.Cursor = Cursors.Wait;
            mainW.ms2_quant();

            this.Close();
            this.Cursor = null;
        }
Beispiel #8
0
        private void filter_btn(object sender, RoutedEventArgs e)
        {
            try
            {
                string       title_str          = this.title_subStr_txt.Text;
                int          title_regular_flag = this.title_cbb.SelectedIndex;
                string       sq_str             = this.sq_subStr_txt.Text;
                int          sq_regular_flag    = this.sq_cbb.SelectedIndex;
                ComboBoxItem selected_item      = (ComboBoxItem)this.mods_comboBox.SelectedItem;
                ComboBoxItem selected_item_flag = (ComboBoxItem)this.mods_comboBox2.SelectedItem;
                string       mod_name           = selected_item.Content.ToString();
                string       mod_name1          = mod_name;
                string       mod_flag           = selected_item_flag.Content.ToString();
                if (mod_name == "Show All")
                {
                    mod_name = "";
                }

                if (mod_flag != "Show All")
                {
                    int index = 0;
                    for (int i = 0; i < Config_Help.mod_label_name.Count(); ++i)
                    {
                        if (Config_Help.mod_label_name[i] == mod_flag)
                        {
                            index = i;
                            break;
                        }
                    }
                    mod_name = mod_name + "#" + index;
                }
                ComboBoxItem selected_item2 = (ComboBoxItem)this.specific_comboBox.SelectedItem;
                string       specific_name  = selected_item2.Content.ToString();

                if (this.filter_mix_num.Text != "" && !Config_Help.IsIntegerAllowed(this.filter_mix_num.Text))
                {
                    MessageBox.Show(Message_Help.MIXED_NUMBER_BE_INTEGER);
                    return;
                }
                int mix_num = 0;
                if (this.filter_mix_num.Text != "")
                {
                    mix_num = int.Parse(this.filter_mix_num.Text);
                }
                if (this.ratio_tbx.Text != "" && !Config_Help.IsDecimalAllowed(this.ratio_tbx.Text) &&
                    this.ratio_tbx2.Text != "" && !Config_Help.IsDecimalAllowed(this.ratio_tbx2.Text))
                {
                    MessageBox.Show(Message_Help.RATIO_NUMBER_BE_DOUBLE);
                    return;
                }
                ComboBoxItem selected_item3 = (ComboBoxItem)this.label_comboBox.SelectedItem;
                string       label_name     = selected_item3.Content.ToString();
                string       label_name1    = label_name;
                if (label_name == "Show All")
                {
                    label_name = "";
                }

                double ratio  = 1024.0;
                double ratio2 = 0.0;
                double sigma  = 1.0;
                double sigma2 = 0.0;
                if (this.ratio_tbx.Text != "")
                {
                    ratio = double.Parse(this.ratio_tbx.Text);
                }
                if (this.ratio_tbx2.Text != "")
                {
                    ratio2 = double.Parse(this.ratio_tbx2.Text);
                }
                if (this.sigma_tbx.Text != "")
                {
                    sigma = double.Parse(this.sigma_tbx.Text);
                }
                if (this.sigma_tbx2.Text != "")
                {
                    sigma2 = double.Parse(this.sigma_tbx2.Text);
                }

                ObservableCollection <PSM> display_psms = new ObservableCollection <PSM>();
                ObservableCollection <PSM> all_psms     = new ObservableCollection <PSM>();
                if (!(bool)mainW.other_psms_cbx.IsChecked)
                {
                    all_psms = mainW.psms;
                }
                else
                {
                    for (int i = 0; i < mainW.all_psms.Count; ++i)
                    {
                        if (mainW.all_psms[i].Q_value > Config_Help.fdr_value)
                        {
                            all_psms.Add(mainW.all_psms[i]);
                        }
                    }
                }
                ComboBoxItem selected_item_target = (ComboBoxItem)this.target_comboBox.SelectedItem;
                string       target_string        = selected_item_target.Content.ToString();
                int          target_index         = 0;
                if (target_string == "Show All")
                {
                    target_index = 0;
                }
                else if (target_string == "Target")
                {
                    target_index = 1;
                }
                else if (target_string == "Decoy")
                {
                    target_index = 2;
                }
                display_psms                = filter_byTarget(target_index, all_psms);
                display_psms                = filter_bySQ_or_Title(title_str, 0, display_psms, title_regular_flag);
                display_psms                = filter_bySQ_or_Title(sq_str, 1, display_psms, sq_regular_flag);
                display_psms                = filter_byMod(mod_name, display_psms);
                display_psms                = filter_bySpecific(specific_name, display_psms);
                display_psms                = filter_byLabelName(label_name, display_psms);
                display_psms                = filter_byRatio_Less(ratio, display_psms);
                display_psms                = filter_byRatio_Bigger(ratio2, display_psms);
                display_psms                = filter_bySigma_Less(sigma, display_psms);
                display_psms                = filter_bySigma_Bigger(sigma2, display_psms);
                display_psms                = filter_byContaminant((bool)this.con_need_cbx.IsChecked, display_psms);
                display_psms                = filter_byUnqiue((bool)this.unique_cbx.IsChecked, display_psms);
                display_psms                = filter_byMix_Bigger(mix_num, display_psms);
                mainW.display_psms          = display_psms;
                mainW.data.ItemsSource      = display_psms;
                mainW.display_size.Text     = display_psms.Count.ToString();
                Config_Help.psm_filter_bean = new PSM_Filter_Bean(mix_num, title_str, title_regular_flag, sq_str, sq_regular_flag, mod_name1, mod_flag, specific_name, label_name1, target_string,
                                                                  (bool)this.con_need_cbx.IsChecked, (bool)this.unique_cbx.IsChecked, ratio, ratio2, sigma, sigma2);
                //this.Close();
            }
            catch (Exception exe)
            {
                MessageBox.Show(exe.ToString());
            }
        }