public static void WritePepXml() { string filePath = Path.Combine(Examples.BASE_DIRECTORY, "example.pepXML"); Console.WriteLine("Writting to " + filePath); using (PepXmlWriter writer = new PepXmlWriter(filePath)) { writer.WriteSampleProtease(Protease.GetProtease("Trypsin")); writer.StartSearchSummary("OMSSA", true, true); writer.WriteProteinDatabase("Resources/yeast_uniprot_120226.fasta"); writer.WriteSearchProtease(Protease.GetProtease("Trypsin"), 3); writer.WriteModification(ModificationDictionary.GetModification("Acetyl"), ModificationSites.K | ModificationSites.NPep); writer.WriteModification(ModificationDictionary.GetModification("CAM"), ModificationSites.C); writer.WriteModification(ModificationDictionary.GetModification("Phospho"), ModificationSites.S | ModificationSites.T | ModificationSites.Y, false); writer.SetCurrentStage(PepXmlWriter.Stage.Spectra, true); writer.StartSpectrum(15, 1.234, 523.4324, 3); PeptideSpectralMatch psm = new PeptideSpectralMatch(PeptideSpectralMatchScoreType.OmssaEvalue); psm.Score = 1.5e-5; Protein protein = new Protein("", "Test Protein"); psm.Peptide = new Peptide("DEREK", protein); psm.Charge = 3; writer.WritePSM(psm); writer.EndSpectrum(); } }
public void Convert(string omssaCSV, MSDataFile dataFile) { string filePath = Path.ChangeExtension(omssaCSV, ".pepxml"); using (PepXmlWriter writer = new PepXmlWriter(filePath)) { writer.WriteSampleProtease(Protease); writer.StartSearchSummary("OMSSA", true, true); writer.WriteProteinDatabase(FastaDatabaseFile); writer.WriteSearchProtease(Protease, MissedClevages); foreach (int modNumber in FixedMods) { OmssaModification mod; if (OmssaModification.TryGetModification(modNumber, out mod)) { writer.WriteModification(mod, mod.Sites, true); } } foreach (int modNumber in VariableMods) { OmssaModification mod; if (OmssaModification.TryGetModification(modNumber, out mod)) { writer.WriteModification(mod, mod.Sites, false); } } writer.SetCurrentStage(PepXmlWriter.Stage.Spectra, true); using (OmssaCsvPsmReader reader = new OmssaCsvPsmReader(omssaCSV, UserModFile)) { reader.AddMSDataFile(dataFile); reader.LoadProteins(FastaDatabaseFile); foreach (PeptideSpectralMatch psm in reader.ReadNextPsm()) { writer.StartSpectrum(psm.SpectrumNumber, psm.Spectrum.RetentionTime, psm.Spectrum.PrecursorMz, psm.Spectrum.PrecursorCharge); writer.WritePSM(psm); writer.EndSpectrum(); } } } }