예제 #1
0
        private void select_clk(object sender, SelectionChangedEventArgs e)
        {
            Pnovo_Result pr = this.pNovo_result_grid.SelectedItem as Pnovo_Result;

            this.MS2_help.Den_help.refresh_pNovol(pr);
            this.MS2_help.window_sizeChg_Or_ZoomPan();
        }
예제 #2
0
        public List <Pnovo_Result> get_results()
        {
            List <Pnovo_Result> results = new List <Pnovo_Result>();
            string mgf_name             = this.mgf_path.Split('\\').Last().Split('.').First();
            string pNovo_result_path    = this.output_path + "\\" + mgf_name + ".txt";

            if (!File.Exists(pNovo_result_path))
            {
                System.Windows.MessageBox.Show("pNovo2.exe has unpredictable problems.");
                return(results);
            }
            StreamReader sr = new StreamReader(pNovo_result_path);
            int          id = 1;

            while (!sr.EndOfStream)
            {
                string line = sr.ReadLine().Trim();
                if (line == "" || line[0] != 'P')
                {
                    continue;
                }
                string[]     strs = line.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
                Pnovo_Result pr   = new Pnovo_Result(id++, strs[1], double.Parse(strs[2]));
                results.Add(pr);
            }
            sr.Close();
            return(results);
        }
예제 #3
0
        //根据用户点击的pNovol答案进行标注
        public void refresh_pNovol(Pnovo_Result result)
        {
            refresh_clear();
            string        sq    = result.SQ;
            List <double> bmass = result.get_all_bMass();
            List <double> ymass = result.get_all_yMass();

            this.MS2_help_denovol_pNovo = new MS2_Help_Denovol_pNovol();
            add_pNovol_annotation(bmass, result, 0);
            add_pNovol_annotation(ymass, result, 1);
        }
예제 #4
0
        private void add_pNovol_annotation(List <double> mass, Pnovo_Result result, int flag) //flag=0:b,flag=1:y;
        {
            int[] mass_inten = new int[Config_Help.MaxMass];
            for (int k = 0; k < Psm_help.Spec.Peaks.Count; ++k)
            {
                int massi = (int)Psm_help.Spec.Peaks[k].Mass;
                mass_inten[massi] = k + 1;
            }
            int currindex = 0;

            for (int k = 0; k < Config_Help.MaxMass; ++k)
            {
                if (mass_inten[k] == 0)
                {
                    mass_inten[k] = currindex;
                }
                else
                {
                    currindex = mass_inten[k];
                }
            }
            string   txt           = "";
            double   startPosition = this.Model.Axes[1].Minimum;
            double   Y             = arrow_Y;
            OxyColor color         = b_color;

            if (flag == 1)
            {
                Y    += 7;
                color = y_color;
            }
            for (int i = 0; i < mass.Count; ++i)
            {
                if (flag == 0)
                {
                    txt += result.SQ[i];
                }
                else
                {
                    txt += result.SQ[result.SQ.Length - 1 - i];
                }
                int    index = -1;
                double me    = 0.0;
                if (this.Psm_help.Ppm_mass_error != 0.0)
                {
                    index = this.Psm_help.IsInWithPPM(mass[i], mass_inten, ref me);
                }
                else
                {
                    index = this.Psm_help.IsInWithDa(mass[i], mass_inten, ref me);
                }
                if (index != -1)
                {
                    ArrowAnnotation aa = new ArrowAnnotation();
                    aa.StartPoint = new DataPoint(startPosition, Y);
                    aa.EndPoint   = new DataPoint(this.Psm_help.Spec.Peaks[index].Mass, Y);
                    aa.Color      = color;
                    aa.HeadWidth  = 2;
                    aa.HeadLength = 5;
                    aa.LineStyle  = LineStyle.Dot;
                    this.MS2_help_denovol_pNovo.ArrowAnnotation.Add(aa);
                    TextAnnotation ta = new TextAnnotation();
                    ta.Position  = new DataPoint((startPosition + this.Psm_help.Spec.Peaks[index].Mass) / 2, Y);
                    ta.Text      = txt;
                    ta.Stroke    = OxyColors.Transparent;
                    ta.TextColor = color;
                    this.MS2_help_denovol_pNovo.TxtAnnotation.Add(ta);
                    LineSeries ls = new LineSeries();
                    ls.Points.Add(new DataPoint(this.Psm_help.Spec.Peaks[index].Mass, 0));
                    ls.Points.Add(new DataPoint(this.Psm_help.Spec.Peaks[index].Mass, denovol_Y_Max));
                    ls.Color     = color;
                    ls.LineStyle = LineStyle.Dot;
                    this.MS2_help_denovol_pNovo.LineSeries.Add(ls);
                    ScatterSeries ss = new ScatterSeries();
                    ss.TrackerFormatString = "m/z: {2:0.000}\nmass_error: {4:0.00}";
                    ss.Points.Add(new DataPoint(this.Psm_help.Spec.Peaks[index].Mass, me));
                    ss.YAxisKey   = this.Model.Axes[2].Key;
                    ss.MarkerFill = color;
                    ss.MarkerSize = 3;
                    this.MS2_help_denovol_pNovo.ScatterSeries.Add(ss);
                    startPosition = this.Psm_help.Spec.Peaks[index].Mass;
                    txt           = "";
                }
            }
        }