public static List <ModificationItem> GetVMods(string peptide) { List <string> broken = SpectraPredictor.SplitPeptide(peptide); List <string> withPTMs = broken.FindAll(a => a.Contains("(")); List <ModificationItem> mods = new List <ModificationItem>(); foreach (string s in withPTMs) { string cleanAA = PatternTools.pTools.CleanPeptide(s, true); Match delta = Regex.Match(s, @"-?[\d|\.]+"); double no = double.Parse(delta.Value.ToString()); mods.Add(new ModificationItem(cleanAA, "", no, false, false, true, true)); } return(mods); }
public void Plot(List <PredictedIon> peaks = null) { myMS.Sort((a, b) => a.MZ.CompareTo(b.MZ)); if (peaks == null) { SpectralPredictionParameters spp = new SpectralPredictionParameters ((bool)checkBoxA.IsChecked, (bool)checkBoxB.IsChecked, (bool)checkBoxC.IsChecked, (bool)checkBoxX.IsChecked, (bool)checkBoxY.IsChecked, (bool)checkBoxZ.IsChecked, (bool)checkBoxNLH2O.IsChecked, (bool)checkBoxNLNH3.IsChecked, 3, (bool)checkBoxIsMonoisotopic.IsChecked, Modifications ); if (Modifications == null) { spp.MyModifications = new List <ModificationItem>(); } PatternTools.SpectraPrediction.SpectraPredictor sp = new PatternTools.SpectraPrediction.SpectraPredictor(spp); if (textBoxSequence.Text.Length > 0) { peaks = sp.PredictPeaks(textBoxSequence.Text, ChargeState, TheoreticalMH); if (!(bool)checkBoxZ1.IsChecked) { peaks.RemoveAll(a => a.Charge == 1 && a.Series != IonSeries.Precursor); } if (!(bool)checkBoxZ2.IsChecked) { peaks.RemoveAll(a => a.Charge == 2 && a.Series != IonSeries.Precursor); } if (!(bool)checkBoxZ3.IsChecked) { peaks.RemoveAll(a => a.Charge == 3 && a.Series != IonSeries.Precursor); } } else { peaks = new List <PredictedIon>(); } } dataGridPeakViewer.ItemsSource = peaks; try { if (textBoxSequence.Text.Length == 0) { FuncPrintMS(myMS, IonsInDisplay[0].MZ, IonsInDisplay[IonsInDisplay.Count - 1].MZ, false); } else { FuncPrintMS(myMS, IonsInDisplay[0].MZ, IonsInDisplay[IonsInDisplay.Count - 1].MZ, true); } } catch (Exception eee) { Console.WriteLine(eee.Message); } double matches = peaks.FindAll(a => a.Matched == true).Count; double total = peaks.Count; labelPeaksProduced.Content = matches + " / " + total + " = " + Math.Round(matches / total, 1) * 100 + "%"; // Plot the denovo canvasDenovo.Children.Clear(); if ((bool)checkBoxB.IsChecked) { labelABC.Content = "B:"; PlotSequence(peaks, IonSeries.B, 13, Brushes.Red); } else if ((bool)checkBoxC.IsChecked) { labelABC.Content = "C:"; PlotSequence(peaks, IonSeries.C, 13, Brushes.Red); } else if ((bool)checkBoxA.IsChecked) { labelABC.Content = "A:"; PlotSequence(peaks, IonSeries.A, 13, Brushes.Red); } else { labelABC.Content = ""; } if ((bool)checkBoxY.IsChecked) { labelXYZ.Content = "Y:"; PlotSequence(peaks, IonSeries.Y, 40, Brushes.Blue); } else if ((bool)checkBoxZ.IsChecked) { labelXYZ.Content = "Z:"; PlotSequence(peaks, IonSeries.Z, 40, Brushes.Blue); } else if ((bool)checkBoxX.IsChecked) { labelXYZ.Content = "X:"; PlotSequence(peaks, IonSeries.X, 40, Brushes.Blue); } else { labelXYZ.Content = ""; } //Display peptide of theoretical spectrum Label peptideSequenceLabel = new Label(); peptideSequenceLabel.FontSize = 10; peptideSequenceLabel.Content = textBoxSequence.Text + " (" + textBoxSequence.Text.Count() + ")"; peptideSequenceLabel.FontWeight = FontWeights.Light; peptideSequenceLabel.Foreground = Brushes.Gray; canvasMS.Children.Add(peptideSequenceLabel); Canvas.SetLeft(peptideSequenceLabel, -2); Canvas.SetTop(peptideSequenceLabel, 0); }