/// <summary> /// Find citrullinated spectra. /// </summary> internal static void FindCitrullinatedSpectra() { // Create an empty list of validation results var vResultList = new List <ValResult>(); // Set the search parameters. Amino acid and mass change string residue = "R"; double mChange = 0.984; // Loop through the list of X!Tandem search results foreach (XTResult res in FileReader.XTandemSearchResults) { // Create an empty instance of validation result ValResult vResult = new ValResult(); // Create a empty list of spectra var specModPeptides = new List <XTSpectrum>(); // Set the current X!Tandem result as the parent result of the validation result vResult.ParentResult = res; // Loop through each of the spectra in the result foreach (XTSpectrum spec in res.XSpectrums) { // Loop through each of the proteins in the spectrum foreach (XTProtein prot in spec.Proteins) { // Loop through each of the modification in the protein foreach (XTModification mod in prot.Modifications) { // Check that the modification matches the citrullination if (mod.AminoAcid == residue & mod.MassChange == mChange) { // If so. // Calculate the ions XTSpectrum scanMS2 = IonCalculation.CalculateAllIons(spec); // Get the original filename scanMS2 = ReturnOriginalFileNameSpectrum(scanMS2, vResult); // Get the original scan ID scanMS2 = GetOriginalScanID(scanMS2); // Find the original MS1 informaton scanMS2 = FindMS1.FindOriginalMS1Info(scanMS2); // Handle orphan spectra scanMS2 = FindMS1.HandleOrphanSpecs(scanMS2); // Add the spectra to the list of modified spectra specModPeptides.Add(scanMS2); } } } } // Set the modified spectra to the temporary list filled with data vResult.ModifiedSpectra = specModPeptides; // Add the result to the result list vResultList.Add(vResult); } // Set the result ReturnVResultCit(vResultList); }
/// <summary> /// Find complementary arginine spectra. /// </summary> /// <param name="error">The maximum parent mass error allowed.</param> internal static void FindComplementaryArginineSpectra(double error) { // Set the mass change double mChange = 0.984; // Set the validation results var vResultList = citValResults; // Loop through the validation results foreach (ValResult result in vResultList) { // Create a temporary dictionary of complementary spectra Dictionary <XTSpectrum, List <XTSpectrum> > compPepDic = new Dictionary <XTSpectrum, List <XTSpectrum> >(); // Loop through all of the modified spectra foreach (XTSpectrum specMod in result.ModifiedSpectra) { // Create an temporary list of complementary spectra var compPeptides = new List <XTSpectrum>(); // Loop through all of the complementary validation result foreach (ValResult compResult in vResultList) { // TODO: Understand Can be taken out of compResult loop if necessary:?? // Loop through al of the spectra in the complementary result's parent foreach (XTSpectrum spec in compResult.ParentResult.XSpectrums) { // Calculate the parent mass error double delta = Math.Abs(spec.ParentMass - (specMod.ParentMass - mChange)); // Check if the parent mass error is less than the max allowed error AND the peptide sequence match if (delta <= error & spec.Proteins[0].DoaminSeq == specMod.Proteins[0].DoaminSeq) { // Calculate the ions XTSpectrum scanMS2 = IonCalculation.CalculateAllIons(spec); // Get the original filename scanMS2 = ReturnOriginalFileNameSpectrum(scanMS2, compResult); // Get the original scan ID scanMS2 = GetOriginalScanID(scanMS2); // Find the original MS1 information scanMS2 = FindMS1.FindOriginalMS1Info(scanMS2); // Handle the orphan spetra scanMS2 = FindMS1.HandleOrphanSpecs(scanMS2); // Add the complementary spectra to the temporary list compPeptides.Add(scanMS2); } } } // If no complementary spectra has been found, continue if (compPeptides.Count() == 0) { continue; } else { // If the dictionary of compmentary spectra does not have the modified spectra, add it to the dictionary if (compPepDic.ContainsKey(specMod) == false) { compPepDic.Add(specMod, compPeptides); } } } // Set the complementary spectra dictionary to the result's spectra dicitonary result.CitSpectraDictionary = compPepDic; } ReturnVResultCit(vResultList); }
/// <summary> /// Find lonely citrullinated spectra. /// </summary> internal static void FindLonelyCitrullinatedSpectra() { // Create an temporary list of results var vResultList = new List <ValResult>(); // Get a list of ids of already used citrullinated spectra var usedIDList = GetListOfUsedCitIDs(); // Set the residue and mass change for the citrullination var residue = "R"; double mChange = 0.984; // Loop through all of the X!Tandem results foreach (XTResult res in FileReader.XTandemSearchResults) { // Create an empty validation result ValResult vResult = new ValResult(); // Create a temporary list of spectra var specModPeptides = new List <XTSpectrum>(); // Set the X!Tandem result as the parent result of the validation vResult.ParentResult = res; // Loop through all of the spectra in the result foreach (XTSpectrum spec in res.XSpectrums) { // Loop through all of the proteins in the spectra foreach (XTProtein prot in spec.Proteins) { // Loop through all of the protein modification foreach (XTModification mod in prot.Modifications) { // Check if the modification matches a citrulination if (mod.AminoAcid == residue & mod.MassChange == mChange) { // If so, check if the spectra is already used. If so, continue if (usedIDList.Contains(spec.ID)) { continue; } else { // If not. // Calculate the ions XTSpectrum scanMS2 = IonCalculation.CalculateAllIons(spec); // Get the original filename scanMS2 = ReturnOriginalFileNameSpectrum(scanMS2, vResult); // Get the original scan ID scanMS2 = GetOriginalScanID(scanMS2); // Find the original MS1 informaton scanMS2 = FindMS1.FindOriginalMS1Info(scanMS2); // Handle orpah spectra scanMS2 = FindMS1.HandleOrphanSpecs(scanMS2); // If the list does not already contain the spectra, add it. if (specModPeptides.Contains(scanMS2) == false) { specModPeptides.Add(scanMS2); } } } } } } // Set the list of found modified spectra to the result's list of modified spectra vResult.ModifiedSpectra = specModPeptides; // Add the result to the result list vResultList.Add(vResult); } // Set the results ReturnValResultLoneCit(vResultList); }
/// <summary> /// Find the arginine spectra. /// </summary> internal static void FindArginineSpectra() { // Create a temporary list of validation results var vResultList = new List <ValResult>(); // Set the residue and mass change for the citrullination var residue = "R"; double mChange = 0.984; // Loop through all of the X!Tandem results foreach (XTResult res in FileReader.XTandemSearchResults) { // Create an empty validation result ValResult vResult = new ValResult(); // Create an temporary list of arginine spectra var specArgPeptides = new List <XTSpectrum>(); // Set the X!Tandem result as the parent result of the validation vResult.ParentResult = res; Console.WriteLine("Spectras of result: {0}", res.XSpectrums.Count()); // Loop through all of the spectra in the X!Tandem result foreach (XTSpectrum spec in res.XSpectrums) { Console.WriteLine("Proteins of Spectrum: {0}", spec.Proteins.Count()); // Loop through all of the proteins in the spectrum foreach (XTProtein prot in spec.Proteins) { // Create an indicator for weather or not the spectrum contains a citrullination. Default: False bool containsCit = false; // Loop through all of the protein modifications foreach (XTModification mod in prot.Modifications) { // Check if the modification matches the citrullination. If so set the citrullination indicator to true if (mod.AminoAcid == residue & mod.MassChange == mChange) { containsCit = true; } } // Check if the protein has an arginine, but does not contain a citrulline. if (prot.DoaminSeq.Contains(residue) & containsCit == false) { // Get the spectrum with the original filename XTSpectrum specMS2 = ReturnOriginalFileNameSpectrum(spec, vResult); // Get the original filename specMS2 = GetOriginalScanID(specMS2); // Find the original MS1 data specMS2 = FindMS1.FindOriginalMS1Info(specMS2); // Handle the orphan spectra specMS2 = FindMS1.HandleOrphanSpecs(specMS2); // Add the spectrum to the list of arginine spectra specArgPeptides.Add(specMS2); } } } // Set the list of arginine spectra to the results list vResult.ArginineSpectra = specArgPeptides; // Add the result to the result list vResultList.Add(vResult); Console.WriteLine("Number of Citrullinations in Result: {0}", vResult.ArginineSpectra.Count()); } // Set the result ReturnValResultArg(vResultList); }