public static void TestMzIdentMlWriterWithUniprotPsiMod() { Protein protein = new Protein("PEPTIDE", "", databaseFilePath: "temp"); ModificationMotif.TryGetMotif("T", out var motif); Modification fakeMod = new Modification(_originalId: "FAKE", _accession: "FAKE_MOD_ACCESSION", _modificationType: "fake", _target: motif, _locationRestriction: "Anywhere.", _monoisotopicMass: 0, _databaseReference: new Dictionary <string, IList <string> > { { "PSI-MOD", new List <string> { "FAKE_MOD_ACCESSION" } } }); string resIdAccession = fakeMod.DatabaseReference["PSI-MOD"].First(); var peptide = protein.Digest(new DigestionParams(), new List <Modification> { fakeMod }, new List <Modification>()).First(); MsDataScan dfb = new MsDataScan(new MzSpectrum(new double[] { 1 }, new double[] { 1 }, false), 0, 1, true, Polarity.Positive, double.NaN, null, null, MZAnalyzerType.Orbitrap, double.NaN, null, null, "scan=1", double.NaN, null, null, double.NaN, null, DissociationType.AnyActivationType, 0, null); Ms2ScanWithSpecificMass scan = new Ms2ScanWithSpecificMass(dfb, 2, 0, "File", new CommonParameters()); var psm = new PeptideSpectralMatch(peptide, 0, 1, 0, scan, new DigestionParams(), new List <MatchedFragmentIon>()); psm.ResolveAllAmbiguities(); psm.SetFdrValues(0, 0, 0, 0, 0, 0, 0, 0); string path = Path.Combine(TestContext.CurrentContext.TestDirectory, "ResIdOutput.mzID"); MzIdentMLWriter.WriteMzIdentMl(new List <PeptideSpectralMatch> { psm }, new List <ProteinGroup>(), new List <Modification>(), new List <Modification>(), new List <SilacLabel>(), new List <Protease>(), 0, new PpmTolerance(20), new PpmTolerance(20), 0, path); var file = File.ReadAllLines(path); bool found = false; foreach (var line in file) { if (line.Contains("FAKE on T") && line.Contains("PSI-MOD:" + resIdAccession)) { found = true; } } Assert.That(found); File.Delete(path); }
public static void TestMzIdentMlWriterWithUniprotResId() { Protein protein = new Protein("PEPTIDE", "", databaseFilePath: "temp"); Modification uniProtMod = GlobalVariables.AllModsKnown.First(p => p.IdWithMotif == "FMN phosphoryl threonine on T" && p.ModificationType == "UniProt" && p.Target.ToString() == "T" && p.DatabaseReference.ContainsKey("RESID") && p.LocationRestriction == "Anywhere."); string resIdAccession = uniProtMod.DatabaseReference["RESID"].First(); var peptide = protein.Digest(new DigestionParams(), new List <Modification> { uniProtMod }, new List <Modification>()).First(); MsDataScan dfb = new MsDataScan(new MzSpectrum(new double[] { 1 }, new double[] { 1 }, false), 0, 1, true, Polarity.Positive, double.NaN, null, null, MZAnalyzerType.Orbitrap, double.NaN, null, null, "scan=1", double.NaN, null, null, double.NaN, null, DissociationType.AnyActivationType, 0, null); Ms2ScanWithSpecificMass scan = new Ms2ScanWithSpecificMass(dfb, 2, 0, "File", new CommonParameters()); var psm = new PeptideSpectralMatch(peptide, 0, 1, 0, scan, new DigestionParams(), new List <MatchedFragmentIon>()); psm.ResolveAllAmbiguities(); psm.SetFdrValues(0, 0, 0, 0, 0, 0, 0, 0); string path = Path.Combine(TestContext.CurrentContext.TestDirectory, "ResIdOutput.mzID"); MzIdentMLWriter.WriteMzIdentMl(new List <PeptideSpectralMatch> { psm }, new List <ProteinGroup>(), new List <Modification>(), new List <Modification>(), new List <SilacLabel>(), new List <Protease>(), 0, new PpmTolerance(20), new PpmTolerance(20), 0, path); var file = File.ReadAllLines(path); bool found = false; foreach (var line in file) { if (line.Contains("FMN phosphoryl threonine on T") && line.Contains("RESID:" + resIdAccession)) { found = true; } } Assert.That(found); File.Delete(path); }