public void TestMatchedPeakCounter() { var methodName = MethodBase.GetCurrentMethod().Name; TestUtils.ShowStarting(methodName); // Parameters var precursorIonTolerance = new Tolerance(15); var productIonTolerance = new Tolerance(15); var sw = new System.Diagnostics.Stopwatch(); var aaSet = new AminoAcidSet(); const string protAnnotation = "_.MFQQEVTITAPNGLHTRPAAQFVKEAKGFTSEITVTSNGKSASAKSLFKLQTLGLTQGTVVTISAEGEDEQKAVEHLVKLMAELE._"; // Create a sequence graph var seqGraph = SequenceGraph.CreateGraph(aaSet, protAnnotation); Assert.NotNull(seqGraph, "Invalid sequence: {0}", protAnnotation); const string specFilePath = @"\\protoapps\UserData\Jungkap\Joshua\testData\SBEP_STM_001_02272012_Aragon.raw"; if (!File.Exists(specFilePath)) { Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, specFilePath); } var run = InMemoryLcMsRun.GetLcMsRun(specFilePath, 1.4826, 1.4826); sw.Start(); var precursorFilter = new Ms1ContainsIonFilter(run, precursorIonTolerance); var seqCompositionArr = seqGraph.GetSequenceCompositions(); Console.WriteLine("Length: {0}\tNumCompositions: {1}", protAnnotation.Length - 4, seqCompositionArr.Length); const int charge = 6; const int modIndex = 0; const int ms2ScanNum = 4448; var seqComposition = seqCompositionArr[modIndex]; var peptideComposition = seqComposition + Composition.H2O; peptideComposition.GetIsotopomerEnvelopeRelativeIntensities(); Console.WriteLine("Composition: {0}, AveragineMass: {1}", seqComposition, seqComposition.Mass); seqGraph.SetSink(modIndex); var precursorIon = new Ion(peptideComposition, charge); Assert.True(precursorFilter.IsValid(precursorIon, ms2ScanNum)); var spec = run.GetSpectrum(ms2ScanNum) as ProductSpectrum; Assert.True(spec != null); var scorer = new MatchedPeakCounter(spec, productIonTolerance, 1, 10); var score = seqGraph.GetFragmentScore(scorer); Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", protAnnotation, charge, precursorIon.GetMostAbundantIsotopeMz(), ms2ScanNum, score); sw.Stop(); Console.WriteLine(@"Elapsed Time: {0:f4} sec", sw.Elapsed.TotalSeconds); }
public void TestCorrMatchedPeakCounter() { var methodName = MethodBase.GetCurrentMethod().Name; TestUtils.ShowStarting(methodName); // Parameters var precursorIonTolerance = new Tolerance(10); var productIonTolerance = new Tolerance(10); var sw = new System.Diagnostics.Stopwatch(); var aaSet = new AminoAcidSet(); const string protAnnotation = "_.TMNITSKQMEITPAIRQHVADRLAKLEKWQTHLINPHIILSKEPQGFIADATINTPNGHLVASAKHEDMYTAINELINKLERQLNKVQHKGEAR._"; // Create a sequence graph var seqGraph = SequenceGraph.CreateGraph(aaSet, protAnnotation); Assert.NotNull(seqGraph, "Invalid sequence: {0}", protAnnotation); const string specFilePath = @"\\proto-2\UnitTest_Files\InformedProteomics_TestFiles\SBEP_STM_001_02272012_Aragon.raw"; if (!File.Exists(specFilePath)) { Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, specFilePath); } var run = InMemoryLcMsRun.GetLcMsRun(specFilePath, 1.4826, 1.4826); sw.Start(); var precursorFilter = new Ms1ContainsIonFilter(run, precursorIonTolerance); var seqCompositionArr = seqGraph.GetSequenceCompositions(); Console.WriteLine("Length: {0}\tNumCompositions: {1}", protAnnotation.Length - 4, seqCompositionArr.Length); const int charge = 9; const int modIndex = 0; const int ms2ScanNum = 3633; var seqComposition = seqCompositionArr[modIndex]; var peptideComposition = seqComposition + Composition.H2O; peptideComposition.GetIsotopomerEnvelopeRelativeIntensities(); Console.WriteLine("Composition: {0}, AveragineMass: {1}", seqComposition, seqComposition.Mass); seqGraph.SetSink(modIndex); var precursorIon = new Ion(peptideComposition, charge); Assert.True(precursorFilter.IsValid(precursorIon, ms2ScanNum)); var spec = run.GetSpectrum(ms2ScanNum) as ProductSpectrum; Assert.True(spec != null); //var scorer = new MatchedPeakCounter(spec, productIonTolerance, 1, 10); var scorer = new CorrMatchedPeakCounter(spec, productIonTolerance, 1, 10); var score = seqGraph.GetFragmentScore(scorer); Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", protAnnotation, charge, precursorIon.GetMostAbundantIsotopeMz(), ms2ScanNum, score); sw.Stop(); Console.WriteLine(@"Elapsed Time: {0:f4} sec", sw.Elapsed.TotalSeconds); }