public virtual void Run(int scan) { ISpectrum spectrum = spectrumRunner.GetSpectrum(scan); if (spectrum.GetMSnOrder() == 1) { monoRunner.SetMS1Spectrum(spectrum); } else if ((spectrum as ISpectrumMSn).GetActivation() == TypeOfMSActivation.CID) { specProcessor.Process(spectrum); List <IGlycoPeptide> glycoPeptides = null; if (monoRunner.GetMS1Spectrum() == null) { glycoPeptides = precursorMatcher.Match(spectrum); } else { monoRunner.Run(spectrum as ISpectrumMSn); glycoPeptides = precursorMatcher.Match(spectrum, monoRunner.GetMonoMass()); } searchWorker.Search(spectrum, glycoPeptides); resultTable[scan] = searchWorker.GetResult(); } }
public List <T> MatchSpecific(ISpectrum spectrum, double monoMass) { List <T> glycoPeptides = new List <T>(); if (spectrum.GetMSnOrder() > 1) { int charge = (spectrum as ISpectrumMSn).GetParentCharge(); double precursorMass = calculator.CalcChargeMass(monoMass, charge, option); MatchPrecursorMass(precursorMass, glycoPeptides); } return(glycoPeptides); }
// assume the spectrum read sequentially public double GetMonoMass(ISpectrum spectrum) { if (spectrum.GetMSnOrder() == 1) { List <IPoint> points = new List <IPoint>(); foreach (IPeak pk in spectrum.GetPeaks()) { points.Add(new PeakPoint(pk)); } matcher.setData(points); return(0); } ISpectrumMSn spectrumMSn = spectrum as ISpectrumMSn; double mz = spectrumMSn.GetParentMZ(); double monoMass = mz; // search isotopic point on full MS spectrum int charge = spectrumMSn.GetParentCharge(); int isotopic = 0; while (isotopic < maxIsotopic) { double target = mz - Proton / charge * (isotopic + 1); if (!matcher.Found(new GeneralPoint(target))) { break; } isotopic++; } // get max intensity peak if (isotopic == 0) { return(monoMass); } double isoMZ = mz - Proton / charge * isotopic; List <IPoint> matched = matcher.Search(new GeneralPoint(isoMZ)); return(matched.OrderBy(x => Math.Abs((x as PeakPoint).MZ - isoMZ)).First().GetValue()); }
public bool Filter(ISpectrum spectrum) { if (spectrum.GetMSnOrder() > 1) { SetMatcher(spectrum); for (int z = 1; z <= 2; z++) { double mz = SpectrumCalcMass.Instance.ComputeMZ(GlycanCalcMass.HexNAc, z); if (matcher.Found(new GeneralPoint(mz))) { return(false); } } return(true); } return(false); }
public virtual void Run(int scan) { ISpectrum spectrum = spectrumRunner.GetSpectrum(scan); if (spectrum.GetMSnOrder() == 1) { monoRunner.SetMS1Spectrum(spectrum); } else if ((spectrum as ISpectrumMSn).GetActivation() == TypeOfMSActivation.ETD) { specProcessor.Process(spectrum); List <IGlycoPeptide> glycoPeptides = null; if (monoRunner.GetMS1Spectrum() == null) { glycoPeptides = precursorMatcher.Match(spectrum); } else { monoRunner.Run(spectrum as ISpectrumMSn); glycoPeptides = precursorMatcher.Match(spectrum, monoRunner.GetMonoMass()); } searchWorker.Search(spectrum, glycoPeptides); resultTable[scan] = searchWorker.GetResult(); (discover as IGlycoPeptideScoreResultFDR).AddResult(resultTable[scan]); //fdr double mass = (spectrum as ISpectrumMSn).GetParentMZ() + pesudoMZ / (spectrum as ISpectrumMSn).GetParentCharge(); glycoPeptides = precursorMatcher.Match(spectrum, mass); searchWorker.Search(spectrum, glycoPeptides); resultFDRTable[scan] = searchWorker.GetResult(); (discover as IGlycoPeptideScoreResultFDR).AddFDRResult(resultFDRTable[scan]); } }
public virtual void Search(int scan) { ISpectrum spectrum = spectrumFactory.GetSpectrum(scan); double monoMass = monoMassSpectrumGetter.GetMonoMass(spectrum); //assume read spectrum sequentially if (spectrum.GetMSnOrder() < 2) { return; } // filter spectrum if (spectrumFilter.Filter(spectrum)) { return; } // precursor spectrumProcessing.Process(spectrum); List <IGlycoPeptide> glycoPeptides = precursorMatcher.Match(spectrum, monoMass); // search List <IScore> scores = new List <IScore>(); foreach (IGlycoPeptide glycoPeptide in glycoPeptides) { IScore score = searchEThcDRunner.Search(spectrum, glycoPeptide); scores.Add(score); } // save results if (scores.Count > 0) { double maxScores = scores.Max(x => x.GetScore()); results.Add(spectrum, scores.Where(x => x.GetScore() == maxScores).ToList()); } }
public override void Run() { IDoubleDigestionPeptidesSearchRun pepRunner = new DoubleDigestionFastaSearchRunPeptides(); pepRunner.SetPeptideCreator(new NGlycosylationPeptideCreator(new DoubleDigestionPeptideCreator())); IPeptideCreatorParameter parameter = new GeneralPeptideCreatorParameter(Proteases.Trypsin, 2, 7);; pepRunner.AddPeptideParameter(parameter); //parameter = new GeneralPeptideCreatorParameter(Proteases.GluC, 2, 7); //pepRunner.AddPeptideParameter(parameter); List <IPeptide> peptides = pepRunner.Run(@"C:\Users\iruiz\Downloads\Human_ReviewedCanonical_20201Entries_25thJuly_2017.fasta"); IGlycanCreator glyRunner = new BruteForceNGlycanCreator(); List <IGlycan> glycans = glyRunner.Generate(); //IGlycanGenerator glyRunner = new SimpleGlycanGenerator(); //List<IGlycan> glycans = glyRunner.Generate(); ThermoRawSearchRunSpectrum specRunner = new ThermoRawSearchRunSpectrum(); //specRunner.Run(@"C:\Users\iruiz\Downloads\ZC_20171218_H95_R1.raw"); specRunner.Run(@"C:\Users\iruiz\Downloads\1.raw"); //specRunner.Run(@"C:\Users\rz20\Downloads\1.raw"); Console.Write("scan, "); Console.Write("peptide, "); Console.Write("glycan, "); Console.Write("score, "); Console.Write("mz, "); Console.WriteLine("charge"); var watch = new System.Diagnostics.Stopwatch(); watch.Start(); IMonoMassSpectrumRun monoRunner = new BinSearchMonoMassSpectrumRun(); double pretol = 20; IPrecursorMatcher precursorMatcher = new Y1PeptidesFilterPrecursorMatcher( new GlycoPeptidePrecursorMatcher(peptides, glycans, pretol), peptides); IGlycoPeptideScoreFactory searchRunner = new DPSearchSpectrumCID(); for (int i = 10621; i < 10628; i++) //for (int i = 1; i < specRunner.GetLastScan(); i++) { ISpectrum spectrum = specRunner.GetSpectrum(i); if (spectrum.GetMSnOrder() == 1) { monoRunner.SetMS1Spectrum(spectrum); continue; } if ((spectrum as ISpectrumMSn).GetActivation() != TypeOfMSActivation.CID) { continue; } ISpectrumProcessing processor = new GeneralPeakPickingSpectrumProcessing(); processor.Process(spectrum); monoRunner.Run(spectrum as ISpectrumMSn); double mass = monoRunner.GetMonoMass(); List <IGlycoPeptide> glycoPeptides = precursorMatcher.Match(spectrum, mass); searchRunner.Search(spectrum, glycoPeptides); IGlycoPeptideScoreResultProduct result = searchRunner.GetResult(); result.MaxScore(); result.Report("test.txt"); } watch.Stop(); Console.WriteLine($"Execution Time: {watch.ElapsedMilliseconds} ms"); Console.Read(); }
public override void Search(int scan) { ISpectrum spectrum = spectrumFactory.GetSpectrum(scan); double monoMass = monoMassSpectrumGetter.GetMonoMass(spectrum); // assume read spectrum sequentially. if (spectrum.GetMSnOrder() < 2) { return; } // ISpectrum filter if (spectrumFilter.Filter(spectrum)) { return; } // Spectrum Processing spectrumProcessing.Process(spectrum); // precursor List <IGlycoPeptide> glycoPeptides = precursorMatcher.Match(spectrum, monoMass); double charge = (spectrum as ISpectrumMSn).GetParentCharge(); List <IGlycoPeptide> decoyGlycoPeptides = precursorMatcher.Match(spectrum, monoMass + pesudoMass / charge); // search List <IScore> scores = new List <IScore>(); foreach (IGlycoPeptide glycoPeptide in glycoPeptides) { IScore score = searchEThcDRunner.Search(spectrum, glycoPeptide); if (score.GetScore() > 0) { IScoreProxy scoreProxy = new FDRScoreProxy(score, true); scores.Add(scoreProxy); } } List <IScore> decoyScores = new List <IScore>(); foreach (IGlycoPeptide decoyGlycoPeptide in decoyGlycoPeptides) { decoyGlycoPeptide.SetPeptide(decoyGlycoPeptide.GetPeptide().Clone()); decoyGlycoPeptide.GetPeptide().SetSequence(Reverse(decoyGlycoPeptide.GetPeptide().GetSequence())); IScore score = searchEThcDRunner.Search(spectrum, decoyGlycoPeptide); if (score.GetScore() > 0) { IScoreProxy scoreProxy = new FDRScoreProxy(score, false); decoyScores.Add(scoreProxy); } } // save results List <IScore> finalScore = new List <IScore>(); if (scores.Count > 0) { double maxScores = scores.Max(x => x.GetScore()); finalScore.AddRange(scores.Where(x => x.GetScore() == maxScores).ToList()); } if (decoyScores.Count > 0) { double maxScores = decoyScores.Max(x => x.GetScore()); finalScore.AddRange(decoyScores.Where(x => x.GetScore() == maxScores).ToList()); } if (finalScore.Count > 0) { results.Add(spectrum, finalScore); } }
public override void Run() { var watch = new System.Diagnostics.Stopwatch(); watch.Start(); IDoubleDigestionPeptidesSearchRun pepRunner = new DoubleDigestionFastaSearchRunPeptides(); pepRunner.SetPeptideCreator(new NGlycosylationPeptideCreator(new DoubleDigestionPeptideCreator())); IPeptideCreatorParameter parameter = new GeneralPeptideCreatorParameter(Proteases.Trypsin, 2, 7);; pepRunner.AddPeptideParameter(parameter); parameter = new GeneralPeptideCreatorParameter(Proteases.GluC, 2, 7); pepRunner.AddPeptideParameter(parameter); List <IPeptide> peptides = pepRunner.Run(@"C:\Users\iruiz\Downloads\HP.fasta"); IAccumulatedMSNGlycanCreator glyRunner = new AccumulatedMSBruteForceNGlycanCreator(); List <IAccumulatedGlycanMassProxy> glycans = glyRunner.GenerateSpecific(); //IGlycanGenerator glyRunner = new SimpleGlycanGenerator(); //List<IGlycan> glycans = glyRunner.Generate(); ThermoRawSearchRunSpectrum specRunner = new ThermoRawSearchRunSpectrum(); specRunner.Run(@"C:\Users\iruiz\Downloads\ZC_20171218_H95_R1.raw"); //specRunner.Run(@"C:\Users\rz20\Downloads\1.raw"); Console.Write("scan, "); Console.Write("peptide, "); Console.Write("glycan, "); Console.Write("score, "); Console.Write("mz, "); Console.WriteLine("charge"); for (int i = 7861; i < 7862; i++) { ISpectrum spectrum = specRunner.GetSpectrum(i); if (spectrum.GetMSnOrder() == 1) { continue; } if ((spectrum as ISpectrumMSn).GetActivation() != TypeOfMSActivation.ETD) { continue; } List <IGlycan> glycanSet = new List <IGlycan>(); glycanSet.AddRange(glycans); ISpectrumProcessing processor = new GeneralPeakPickingSpectrumProcessing(); processor.Process(spectrum); double pretol = 20; IAccumulatedPrecursorMatcher precursorMatcher = new AccumulatedMSNGlycoPeptidePrecursorMatcher(peptides, glycanSet, pretol); List <IGlycoPeptide> glycoPeptides = precursorMatcher.Match(spectrum); IGlycoPeptideScoreFactory searchRunner = new BinSearchSpectrumEThcD(); searchRunner.Search(spectrum, glycoPeptides); IGlycoPeptideScoreResultProduct result = searchRunner.GetResult(); result.MaxScore(); result.Report("test.txt"); } watch.Stop(); Console.WriteLine($"Execution Time: {watch.ElapsedMilliseconds} ms"); }