예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
 /// <summary>
 /// Set the original filename to the MS2 spectrum.
 /// </summary>
 /// <param name="specMS2">The MS2 spectrum.</param>
 /// <param name="result">The validation result.</param>
 /// <returns>The MS2 spectrum with the original filename.</returns>
 private static XTSpectrum ReturnOriginalFileNameSpectrum(XTSpectrum specMS2, ValResult result)
 {
     specMS2.OriginalFileName = result.ParentResult.OriginalInputFile;
     return(specMS2);
 }