private phosphoRS.PeptideSpectrumMatch getPhosphoRS_PSM(PhosphoRSConfig config, PhosphoPeptideAttestationRow variant) { // Get the phosphorylated peptide and add all modifications to the base sequence. proteome.Peptide phosphoPeptide = new proteome.Peptide(variant.UnphosphorylatedSequence, proteome.ModificationParsing.ModificationParsing_Auto, proteome.ModificationDelimiter.ModificationDelimiter_Brackets); proteome.ModificationMap variantPeptideMods = phosphoPeptide.modifications(); variant.OriginalPhosphoSites.Keys.ToList().ForEach(location => { variantPeptideMods[location].Add(config.pwizMod); }); // This modification ID is used to tell phosphoRS how to modify the sequence. int modificationID = config.phosphorylationSymbol + 1; // Build a string representation of all modificaitons in a peptide for phospoRS // "0.00011000000000.0" : 1 is the ID of the modification. All phosphos in a data // set need to have one ID. This ID is used by the PhosphoRS to figure out which // mods need to be scored. var ptmRepresentation = new StringBuilder(); // Store all modifications in phosphoRS modification objects var modifications = new List<phosphoRS.AminoAcidModification>(); // Get the n-terminal modifications. if (variantPeptideMods.ContainsKey(proteome.ModificationMap.NTerminus())) { phosphoRS.AminoAcidModification otherMod = new phosphoRS.AminoAcidModification('2', "unknown", "unk", "none", variantPeptideMods[proteome.ModificationMap.NTerminus()].monoisotopicDeltaMass(), 0.0, null); modifications.Add(otherMod); ptmRepresentation.Append(modificationID.ToString() + "."); //++modificationID; } else { ptmRepresentation.Append("0."); } // Process all other modifications. for (int aaIndex = 0; aaIndex < phosphoPeptide.sequence.Length; ++aaIndex) { // If phosphorylation, use the existing scoredAA variable. if (variantPeptideMods.ContainsKey(aaIndex)) { if (variant.OriginalPhosphoSites.Keys.Contains(aaIndex)) { modifications.Add(config.scoredAA); ptmRepresentation.Append(config.phosphorylationSymbol.ToString()[0]); } else { // Otherwise, make an "unknown" modification with a separate modification ID. var otherMod = new phosphoRS.AminoAcidModification(modificationID.ToString()[0], "unknown", "unk", "none", variantPeptideMods[aaIndex].monoisotopicDeltaMass(), 0.0, phosphoRS.AminoAcidSequence.ParseAASequence("" + phosphoPeptide.sequence[aaIndex])); modifications.Add(otherMod); ptmRepresentation.Append(modificationID.ToString()); //++modificationID; } } else { ptmRepresentation.Append("0"); } } // Process any c-terminal modifications. if (variantPeptideMods.ContainsKey(proteome.ModificationMap.CTerminus())) { var otherMod = new phosphoRS.AminoAcidModification(modificationID.ToString()[0], "unknown", "unk", "none", variantPeptideMods[proteome.ModificationMap.CTerminus()].monoisotopicDeltaMass(), 0.0, null); modifications.Add(otherMod); ptmRepresentation.Append("." + modificationID.ToString()); } else { ptmRepresentation.Append(".0"); } // Get the phosphoRS peptide sequence. // Assign spectrum ID, amino acid sequence, list of all modifications, a so-called 'modification position string' (here every digit represents an amino acid within the peptide sequence // '0' indicates not modified, values != '0' indicate the unique identifier of the amino acid's modification the first digit represents the n-terminus the last digit represents the c-terminus) var AAS = phosphoRS.AminoAcidSequence.Create((int)variant.SpectrumId, phosphoPeptide.sequence, modifications, ptmRepresentation.ToString()); // Make a phosphoRS peptide-spectrum match. return new phosphoRS.PeptideSpectrumMatch((int)variant.PSMId, variant.SpectrumType, variant.Charge, variant.PrecursorMZ, variant.Peaks, AAS); }
private phosphoRS.PeptideSpectrumMatch getPhosphoRS_PSM(PhosphoRSConfig config, PhosphoPeptideAttestationRow variant) { // Get the phosphorylated peptide and add all modifications to the base sequence. proteome.Peptide phosphoPeptide = new proteome.Peptide(variant.UnphosphorylatedSequence, proteome.ModificationParsing.ModificationParsing_Auto, proteome.ModificationDelimiter.ModificationDelimiter_Brackets); proteome.ModificationMap variantPeptideMods = phosphoPeptide.modifications(); variant.OriginalPhosphoSites.Keys.ToList().ForEach(location => { variantPeptideMods[location].Add(config.pwizMod); }); // This modification ID is used to tell phosphoRS how to modify the sequence. int modificationID = config.phosphorylationSymbol + 1; // Build a string representation of all modificaitons in a peptide for phospoRS // "0.00011000000000.0" : 1 is the ID of the modification. All phosphos in a data // set need to have one ID. This ID is used by the PhosphoRS to figure out which // mods need to be scored. var ptmRepresentation = new StringBuilder(); // Store all modifications in phosphoRS modification objects var modifications = new List <phosphoRS.AminoAcidModification>(); // Get the n-terminal modifications. if (variantPeptideMods.ContainsKey(proteome.ModificationMap.NTerminus())) { phosphoRS.AminoAcidModification otherMod = new phosphoRS.AminoAcidModification('2', "unknown", "unk", "none", variantPeptideMods[proteome.ModificationMap.NTerminus()].monoisotopicDeltaMass(), 0.0, null); modifications.Add(otherMod); ptmRepresentation.Append(modificationID.ToString() + "."); //++modificationID; } else { ptmRepresentation.Append("0."); } // Process all other modifications. for (int aaIndex = 0; aaIndex < phosphoPeptide.sequence.Length; ++aaIndex) { // If phosphorylation, use the existing scoredAA variable. if (variantPeptideMods.ContainsKey(aaIndex)) { if (variant.OriginalPhosphoSites.Keys.Contains(aaIndex)) { modifications.Add(config.scoredAA); ptmRepresentation.Append(config.phosphorylationSymbol.ToString()[0]); } else { // Otherwise, make an "unknown" modification with a separate modification ID. var otherMod = new phosphoRS.AminoAcidModification(modificationID.ToString()[0], "unknown", "unk", "none", variantPeptideMods[aaIndex].monoisotopicDeltaMass(), 0.0, phosphoRS.AminoAcidSequence.ParseAASequence("" + phosphoPeptide.sequence[aaIndex])); modifications.Add(otherMod); ptmRepresentation.Append(modificationID.ToString()); //++modificationID; } } else { ptmRepresentation.Append("0"); } } // Process any c-terminal modifications. if (variantPeptideMods.ContainsKey(proteome.ModificationMap.CTerminus())) { var otherMod = new phosphoRS.AminoAcidModification(modificationID.ToString()[0], "unknown", "unk", "none", variantPeptideMods[proteome.ModificationMap.CTerminus()].monoisotopicDeltaMass(), 0.0, null); modifications.Add(otherMod); ptmRepresentation.Append("." + modificationID.ToString()); } else { ptmRepresentation.Append(".0"); } // Get the phosphoRS peptide sequence. // Assign spectrum ID, amino acid sequence, list of all modifications, a so-called 'modification position string' (here every digit represents an amino acid within the peptide sequence // '0' indicates not modified, values != '0' indicate the unique identifier of the amino acid's modification the first digit represents the n-terminus the last digit represents the c-terminus) var AAS = phosphoRS.AminoAcidSequence.Create((int)variant.SpectrumId, phosphoPeptide.sequence, modifications, ptmRepresentation.ToString()); // Make a phosphoRS peptide-spectrum match. return(new phosphoRS.PeptideSpectrumMatch((int)variant.PSMId, variant.SpectrumType, variant.Charge, variant.PrecursorMZ, variant.Peaks, AAS)); }