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; } } CurrentGraphForm.ScanAnnotationSettings.setScanLabels( pointAnnotations ); if( CurrentGraphForm.CurrentPointAnnotations.Count > previousLabelCount ) CurrentGraphForm.updateGraph(); } }
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(); } } } }