Ejemplo n.º 1
0
        private void peptideFragmentationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PeptideFragmentationForm peptideFragmentationForm = new PeptideFragmentationForm();

            peptideFragmentationForm.ShowDialog(this);
            if (peptideFragmentationForm.DialogResult == DialogResult.Cancel)
            {
                return;
            }

            if (peptideFragmentationForm.MsProductReportXml != null)
            {
                Map <string, List <Pair <double, int> > > pointAnnotations = new Map <string, List <Pair <double, int> > >();

                XmlTextReader reader = new XmlTextReader(new StringReader(peptideFragmentationForm.MsProductReportXml));

                string ionSeriesName      = "immonium";
                string ionSeriesIndex     = "";
                int    previousLabelCount = CurrentGraphForm.CurrentPointAnnotations.Count;
                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                    case XmlNodeType.Element:
                        if (reader.Name == "mz")
                        {
                            string[] ionMzChargeStr = reader.ReadElementContentAsString().Split(",".ToCharArray());
                            double   ionMz          = Convert.ToDouble(ionMzChargeStr[0]);
                            int      ionCharge      = Convert.ToInt32(ionMzChargeStr[1]);
                            pointAnnotations[ionSeriesName + ionSeriesIndex].Add(new Pair <double, int>(ionMz, ionCharge));
                        }
                        else if (reader.Name[0] == 'i')
                        {
                            Int32 test;
                            if (Int32.TryParse(reader.Name.Substring(1), out test))
                            {
                                ionSeriesIndex = " " + reader.Name.Substring(1);
                            }
                        }
                        else if (reader.Name == "name")
                        {
                            ionSeriesName = reader.ReadElementContentAsString();
                        }
                        break;
                    }
                }

                if (CurrentGraphForm.CurrentScan.IsMassSpectrum)
                {
                    CurrentGraphForm.AnnotationSettings.setScanLabels(pointAnnotations);
                    if (CurrentGraphForm.CurrentPointAnnotations.Count > previousLabelCount)
                    {
                        CurrentGraphForm.updateGraph();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void clearToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (CurrentGraphForm.CurrentPointAnnotations.Count == 0)
            {
                return;
            }

            CurrentGraphForm.CurrentPointAnnotations.Clear();
            CurrentGraphForm.updateGraph();
        }
Ejemplo n.º 3
0
        private void peptideMassMapProteinDigestToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PeptideMassMapProteinDigestForm peptideMassMapProteinDigestForm = new PeptideMassMapProteinDigestForm();

            peptideMassMapProteinDigestForm.ShowDialog(this);
            if (peptideMassMapProteinDigestForm.DialogResult == DialogResult.Cancel)
            {
                return;
            }

            if (peptideMassMapProteinDigestForm.MsDigestReportXml != null)
            {
                Map <string, List <Pair <double, int> > > pointAnnotations = new Map <string, List <Pair <double, int> > >();

                XmlTextReader reader = new XmlTextReader(new StringReader(peptideMassMapProteinDigestForm.MsDigestReportXml));

                double peptideMonoMz = 0, peptideAvgMz = 0;
                int    peptideCharge = 0;
                string peptideSequence;
                int    previousLabelCount = CurrentGraphForm.CurrentPointAnnotations.Count;
                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                    case XmlNodeType.Element:
                        if (reader.Name == "peptide")
                        {
                            peptideMonoMz   = peptideAvgMz = 0;
                            peptideCharge   = 0;
                            peptideSequence = "";
                        }
                        else if (reader.Name == "mi_m_over_z")
                        {
                            peptideMonoMz = Convert.ToDouble(reader.ReadElementContentAsString());
                        }
                        else if (reader.Name == "av_m_over_z")
                        {
                            peptideAvgMz = Convert.ToDouble(reader.ReadElementContentAsString());
                        }
                        else if (reader.Name == "charge")
                        {
                            peptideCharge = Convert.ToInt32(reader.ReadElementContentAsString());
                        }
                        else if (reader.Name == "database_sequence")
                        {
                            peptideSequence = reader.ReadElementContentAsString();
                            if (peptideMonoMz > 0)
                            {
                                pointAnnotations[peptideSequence].Add(new Pair <double, int>(peptideMonoMz, peptideCharge));
                            }
                            if (peptideAvgMz > 0)
                            {
                                pointAnnotations[peptideSequence].Add(new Pair <double, int>(peptideAvgMz, peptideCharge));
                            }
                        }
                        break;
                    }
                }

                if (CurrentGraphForm.CurrentScan.IsMassSpectrum)
                {
                    CurrentGraphForm.AnnotationSettings.setScanLabels(pointAnnotations);
                    if (CurrentGraphForm.CurrentPointAnnotations.Count > previousLabelCount)
                    {
                        CurrentGraphForm.updateGraph();
                    }
                }
            }
        }
Ejemplo n.º 4
0
 private void centroidToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
 {
     CurrentGraphForm.updateGraph();
 }