public static void TestVeryCloseExperimentalsModern() { IDictionary <int, List <Modification> > mods = new Dictionary <int, List <Modification> >(); ModificationMotif.TryGetMotif("M", out ModificationMotif motif); var prot = new Protein("MMMM", null, null, null, mods); DigestionParams digestionParams = new DigestionParams(minPeptideLength: 1); var thePep = prot.Digest(digestionParams, new List <Modification>(), new List <Modification>()).First(); var frags = new List <Product>(); thePep.Fragment(DissociationType.HCD, FragmentationTerminus.Both, frags); var massArray = frags.Select(p => p.NeutralMass).ToArray(); Array.Sort(massArray); double[] intensities = new double[] { 1, 1, 1, 1 }; double[] mz = new double[] { 1, 2, massArray[4].ToMz(1), massArray[4].ToMz(1) + 1e-9 }; MzSpectrum massSpectrum = new MzSpectrum(mz, intensities, false); MsDataScan scan = new MsDataScan(massSpectrum, 1, 1, true, Polarity.Positive, 1, new MzRange(300, 2000), "", MZAnalyzerType.Unknown, massSpectrum.SumOfAllY, null, null, "scan=1", 0, null, null, 0, null, DissociationType.Unknown, 1, null); PeptideSpectralMatch[] globalPsms = new PeptideSpectralMatch[1]; Ms2ScanWithSpecificMass[] arrayOfSortedMS2Scans = { new Ms2ScanWithSpecificMass(scan, 600, 1, null, new CommonParameters()) }; CommonParameters CommonParameters = new CommonParameters(productMassTolerance: new PpmTolerance(5), scoreCutoff: 1, digestionParams: new DigestionParams(maxMissedCleavages: 0, minPeptideLength: 1, maxModificationIsoforms: int.MaxValue, initiatorMethionineBehavior: InitiatorMethionineBehavior.Retain)); var indexEngine = new IndexingEngine(new List <Protein> { prot }, new List <Modification>(), new List <Modification>(), null, null, null, 1, DecoyType.Reverse, CommonParameters, null, 30000, false, new List <FileInfo>(), TargetContaminantAmbiguity.RemoveContaminant, new List <string>()); var indexResults = (IndexingResults)indexEngine.Run(); var cse = new ModernSearchEngine(globalPsms, arrayOfSortedMS2Scans, indexResults.PeptideIndex, indexResults.FragmentIndex, 0, CommonParameters, null, new OpenSearchMode(), 0, new List <string>()); cse.Run(); Assert.Less(globalPsms[0].Score, 2); Assert.Greater(globalPsms[0].Score, 1); }
public static void TestVeryCloseExperimentalsModern() { IDictionary <int, List <Modification> > mods = new Dictionary <int, List <Modification> >(); ModificationMotif.TryGetMotif("M", out ModificationMotif motif); var prot = new Protein("MMMM", null, null, null, mods); DigestionParams digestionParams = new DigestionParams { MinPeptideLength = 1, }; var thePep = prot.Digest(digestionParams, new List <ModificationWithMass>(), new List <ModificationWithMass>()).First(); var massArray = thePep.CompactPeptide(TerminusType.None).ProductMassesMightHaveDuplicatesAndNaNs(new List <ProductType> { ProductType.B, ProductType.Y }); Array.Sort(massArray); double[] intensities = new double[] { 1, 1, 1, 1 }; double[] mz = new double[] { 1, 2, massArray[4].ToMz(1), massArray[4].ToMz(1) + 1e-9 }; MzmlMzSpectrum massSpectrum = new MzmlMzSpectrum(mz, intensities, false); IMsDataScanWithPrecursor <IMzSpectrum <IMzPeak> > scan = new MzmlScanWithPrecursor(1, massSpectrum, 1, true, Polarity.Positive, 1, new MzRange(300, 2000), "", MZAnalyzerType.Unknown, massSpectrum.SumOfAllY, 0, null, null, 0, null, DissociationType.Unknown, 1, null, null, "scan=1"); PeptideSpectralMatch[] globalPsms = new PeptideSpectralMatch[1]; Ms2ScanWithSpecificMass[] arrayOfSortedMS2Scans = { new Ms2ScanWithSpecificMass(scan, 600, 1, null) }; CommonParameters CommonParameters = new CommonParameters { ProductMassTolerance = new PpmTolerance(5), DigestionParams = new DigestionParams { MaxMissedCleavages = 0, MinPeptideLength = null, MaxModificationIsoforms = int.MaxValue, InitiatorMethionineBehavior = InitiatorMethionineBehavior.Retain, }, ConserveMemory = false, ScoreCutoff = 1 }; var indexEngine = new IndexingEngine(new List <Protein> { prot }, new List <ModificationWithMass>(), new List <ModificationWithMass>(), new List <ProductType> { ProductType.B, ProductType.Y }, 1, DecoyType.Reverse, new List <IDigestionParams> { CommonParameters.DigestionParams }, CommonParameters, 30000, new List <string>()); var indexResults = (IndexingResults)indexEngine.Run(); var cse = new ModernSearchEngine(globalPsms, arrayOfSortedMS2Scans, indexResults.PeptideIndex, indexResults.FragmentIndex, new List <ProductType> { ProductType.B, ProductType.Y }, 0, CommonParameters, false, new OpenSearchMode(), 0, new List <string>()); cse.Run(); Assert.Less(globalPsms[0].Score, 2); Assert.Greater(globalPsms[0].Score, 1); }