public static void TestPsmHeader() { DigestionParams digestionParams = new DigestionParams(); PeptideWithSetModifications pepWithSetMods = new Protein( "MQQQQQQQ", "accession1", "org", new List <Tuple <string, string> > { new Tuple <string, string>("geneNameType", "geneName") }, new Dictionary <int, List <Modification> > { { 2, new List <Modification> { new Modification("mod", "mod") } } }, name: "name", full_name: "fullName", sequenceVariations: new List <SequenceVariation> { new SequenceVariation(2, "P", "Q", "changed this sequence") }) .Digest(digestionParams, new List <ModificationWithMass>(), new List <ModificationWithMass>()).First(); MsDataFile myMsDataFile = new TestDataFile(pepWithSetMods, "quadratic"); MsDataScan scann = myMsDataFile.GetOneBasedScan(2); Ms2ScanWithSpecificMass scan = new Ms2ScanWithSpecificMass(scann, 4, 1, null); PeptideSpectralMatch psm = new PeptideSpectralMatch(pepWithSetMods.CompactPeptide(TerminusType.None), 1, 2, 3, scan, digestionParams); var t = psm.ToString(); var tabsepheader = PeptideSpectralMatch.GetTabSeparatedHeader(); Assert.AreEqual(psm.ToString().Count(f => f == '\t'), PeptideSpectralMatch.GetTabSeparatedHeader().Count(f => f == '\t')); Dictionary <CompactPeptideBase, HashSet <PeptideWithSetModifications> > matching = new Dictionary <CompactPeptideBase, HashSet <PeptideWithSetModifications> > { { pepWithSetMods.CompactPeptide(TerminusType.None), new HashSet <PeptideWithSetModifications> { pepWithSetMods } } }; psm.MatchToProteinLinkedPeptides(matching); Assert.AreEqual(psm.ToString().Count(f => f == '\t'), PeptideSpectralMatch.GetTabSeparatedHeader().Count(f => f == '\t')); Tolerance fragmentTolerance = new PpmTolerance(10); List <ProductType> lp = new List <ProductType> { ProductType.B }; new LocalizationEngine(new List <PeptideSpectralMatch> { psm }, lp, myMsDataFile, new CommonParameters(productMassTolerance: fragmentTolerance), new List <string>()).Run(); Assert.AreEqual(psm.ToString().Count(f => f == '\t'), PeptideSpectralMatch.GetTabSeparatedHeader().Count(f => f == '\t')); psm.SetFdrValues(6, 6, 6, 6, 6, 6, 0, 0, 0, true); Assert.AreEqual(psm.ToString().Count(f => f == '\t'), PeptideSpectralMatch.GetTabSeparatedHeader().Count(f => f == '\t')); }
public static void TestPsmHeader() { CommonParameters commonParameters = new CommonParameters(); PeptideWithSetModifications pepWithSetMods = new Protein( "MQQQQQQQ", "accession1", "org", new List <Tuple <string, string> > { new Tuple <string, string>("geneNameType", "geneName") }, new Dictionary <int, List <Modification> > { { 2, new List <Modification> { new Modification("mod", "mod") } } }, name: "name", fullName: "fullName", sequenceVariations: new List <SequenceVariation> { new SequenceVariation(2, "P", "Q", "changed this sequence") }) .Digest(commonParameters.DigestionParams, new List <Modification>(), new List <Modification>()).First(); MsDataFile myMsDataFile = new TestDataFile(pepWithSetMods, "quadratic"); MsDataScan scann = myMsDataFile.GetOneBasedScan(2); Ms2ScanWithSpecificMass scan = new Ms2ScanWithSpecificMass(scann, 4, 1, null, new CommonParameters()); var theoreticalIons = new List <Product>(); pepWithSetMods.Fragment(DissociationType.HCD, FragmentationTerminus.Both, theoreticalIons); var matchedIons = MetaMorpheusEngine.MatchFragmentIons(scan, theoreticalIons, new CommonParameters()); PeptideSpectralMatch psm = new PeptideSpectralMatch(pepWithSetMods, 1, 2, 3, scan, commonParameters, matchedIons); psm.ResolveAllAmbiguities(); var t = psm.ToString(); var tabsepheader = PeptideSpectralMatch.GetTabSeparatedHeader(); Assert.AreEqual(psm.ToString().Count(f => f == '\t'), PeptideSpectralMatch.GetTabSeparatedHeader().Count(f => f == '\t')); Assert.AreEqual(psm.ToString().Count(f => f == '\t'), PeptideSpectralMatch.GetTabSeparatedHeader().Count(f => f == '\t')); Tolerance fragmentTolerance = new PpmTolerance(10); new LocalizationEngine(new List <PeptideSpectralMatch> { psm }, myMsDataFile, new CommonParameters(productMassTolerance: fragmentTolerance), null, new List <string>()).Run(); Assert.AreEqual(psm.ToString().Count(f => f == '\t'), PeptideSpectralMatch.GetTabSeparatedHeader().Count(f => f == '\t')); psm.SetFdrValues(6, 6, 6, 6, 6, 0, 0, 0); Assert.AreEqual(psm.ToString().Count(f => f == '\t'), PeptideSpectralMatch.GetTabSeparatedHeader().Count(f => f == '\t')); }
protected internal void WriteMs1DataPoints(List <LabeledMs1DataPoint> items, string outputFolder, string fileName, List <string> nestedIDs) { var writtenFile = Path.Combine(outputFolder, fileName + ".ms1dptsv"); using (StreamWriter output = new StreamWriter(writtenFile)) { output.WriteLine(LabeledMs1DataPoint.TabSeparatedHeader + "\t" + PeptideSpectralMatch.GetTabSeparatedHeader()); foreach (var dp in items) { output.Write(dp.Values()); output.WriteLine("\t" + dp.identification); } } SucessfullyFinishedWritingFile(writtenFile, nestedIDs); }
public static void TestPsmHeader() { DigestionParams digestionParams = new DigestionParams(); PeptideWithSetModifications pepWithSetMods = new Protein("MQQQQQQQ", "accession1").Digest(digestionParams, new List <ModificationWithMass>(), new List <ModificationWithMass>()).First(); IMsDataFile <IMsDataScan <IMzSpectrum <IMzPeak> > > myMsDataFile = new TestDataFile(pepWithSetMods, "quadratic"); IMsDataScanWithPrecursor <IMzSpectrum <IMzPeak> > scann = myMsDataFile.GetOneBasedScan(2) as IMsDataScanWithPrecursor <IMzSpectrum <IMzPeak> >; Ms2ScanWithSpecificMass scan = new Ms2ScanWithSpecificMass(scann, 4, 1, null); PeptideSpectralMatch psm = new PeptideSpectralMatch(pepWithSetMods.CompactPeptide(TerminusType.None), 1, 2, 3, scan); var t = psm.ToString(); var tabsepheader = PeptideSpectralMatch.GetTabSeparatedHeader(); Assert.AreEqual(psm.ToString().Count(f => f == '\t'), PeptideSpectralMatch.GetTabSeparatedHeader().Count(f => f == '\t')); Dictionary <CompactPeptideBase, HashSet <PeptideWithSetModifications> > matching = new Dictionary <CompactPeptideBase, HashSet <PeptideWithSetModifications> > { { pepWithSetMods.CompactPeptide(TerminusType.None), new HashSet <PeptideWithSetModifications> { pepWithSetMods } } }; psm.MatchToProteinLinkedPeptides(matching); Assert.AreEqual(psm.ToString().Count(f => f == '\t'), PeptideSpectralMatch.GetTabSeparatedHeader().Count(f => f == '\t')); Tolerance fragmentTolerance = new PpmTolerance(10); List <ProductType> lp = new List <ProductType> { ProductType.B }; new LocalizationEngine(new List <PeptideSpectralMatch> { psm }, lp, myMsDataFile, fragmentTolerance, new List <string>(), false).Run(); Assert.AreEqual(psm.ToString().Count(f => f == '\t'), PeptideSpectralMatch.GetTabSeparatedHeader().Count(f => f == '\t')); psm.SetFdrValues(6, 6, 6, 6, 6, 6, 0, 0, 0, false); Assert.AreEqual(psm.ToString().Count(f => f == '\t'), PeptideSpectralMatch.GetTabSeparatedHeader().Count(f => f == '\t')); }