コード例 #1
0
        /// <summary>
        /// Check if iso cyanic acid loss is present in the spectrum's MS1 scan.
        /// </summary>
        /// <param name="spectrum">The spectrum to be checked.</param>
        /// <returns>True, if isocyanic acid is present; Otherwise, false.</returns>
        private static bool IsIsoCyanicAcidLossPresentMs1(MsSpectrum spectrum)
        {
            // Get the precursor m/z value
            double precursorMz = spectrum.PreCursorMz;

            // Loop through all of the M/Z-values
            foreach (double mzVal in spectrum.ParentScan.MzValues)
            {
                // Check that the m/z is not greater than the precursor, because the code is looking for an loss i.e. a value less than the precursor
                // TODO: Maybe insert to increase speed.
                //if(mzVal > precursorMz) { break; }

                // Check if the isocyanic neutral loss is present.
                if (HelperUtilities.IsApproximately(mzVal, precursorMz - 43, ScoreSettings.CyanicLossTolerance))
                {
                    // The isocyanic netural loss ion is found
                    // If that is the case set the M/Z value of the ion
                    spectrum.IsoCyanicMzMs1 = mzVal;
                    // Return true, because the ion was found
                    return(true);
                }
            }

            // No loss was found. Set the m/z value for the loss ion to an impossible value
            spectrum.IsoCyanicMzMs1 = -1;
            // Return false, because no ion was found
            return(false);
        }
コード例 #2
0
 /// <summary>
 /// Check weather the spectrum has the correct mass shift.
 /// </summary>
 /// <param name="citMz">The m/z value for the citrullinated spectrum.</param>
 /// <param name="argMz">The m/z value for the arginine spectrum.</param>
 /// <param name="fragMassError">The fragment mass error. Used to calculate the tolerance.</param>
 /// <param name="containsCit">Indicates that the ion contains the citrullination.</param>
 /// <returns>True, if has correct mass shift; Otherwise, false.</returns>
 private static bool HasCorrectCitMassShift(double citMz, double argMz, double fragMassError, bool containsCit)
 {
     // Determine whether the ion contains the citrullination
     if (containsCit)
     {
         // Citrullination. The cit M/Z should be 0.984 heavier than Arg M/Z
         return(HelperUtilities.IsApproximately(citMz - 0.984, argMz, fragMassError / 5));
     }
     else
     {
         // No citrullination. The cit M/Z and Arg M/Z should be equal
         return(HelperUtilities.IsApproximately(citMz, argMz, fragMassError / 5));
     }
 }
コード例 #3
0
        /// <summary>
        /// Check if list of isocyanic loss contains a certain m/z-value.
        /// </summary>
        /// <param name="cyanlossMz">The list of isocyanic losses.</param>
        /// <param name="mzVal">The M/Z-value to be checked.</param>
        /// <returns>True, if list contains the iso cyanic loss; Otherwise, false.</returns>
        private static bool IsoListContains(List <double> cyanlossMz, double mzVal)
        {
            // Loop through all of the values
            foreach (double cyanLossMz in cyanlossMz)
            {
                // If an loss m/z is approx. equal to the M/Z-value to be checked, return true
                if (HelperUtilities.IsApproximately(cyanLossMz + 43, mzVal, ScoreSettings.CyanicLossTolerance))
                {
                    return(true);
                }
            }

            // If the item is not found
            return(false);
        }
コード例 #4
0
        /// <summary>
        /// Count the presence of isocyanic acid loss on MS2.
        /// </summary>
        /// <param name="citSpectrum">The citrullinated spectrum.</param>
        /// <param name="citIndex">The index of the citrullinated arginine.</param>
        /// <param name="aaSeq">The amino acid sequence.</param>
        /// <returns>The number of isocyanic acid losses.</returns>
        private static double CountIsoCyanicAcidLossPresentMs2(MsSpectrum citSpectrum, int citIndex, string[] aaSeq)
        {
            // Create temporay list of isocyanic loss M/Z
            List <double> cyanlossMz = new List <double>();

            // Create scores
            int aIonCount   = 0;
            int bIonCount   = 0;
            int b17IonCount = 0;
            int b18IonCount = 0;
            int yIonCount   = 0;
            int y17IonCount = 0;
            int y18IonCount = 0;

            List <double> mzValues = citSpectrum.MzValues.ToList();

            mzValues.Reverse();
            foreach (double mzVal in mzValues)
            {
                // Loop through the all of amino acid sequence.However only the index is used.
                for (int i = 0; i < aaSeq.Length; i++)
                {
                    if (IsoListContains(cyanlossMz, mzVal))
                    {
                        continue;
                    }
                    // Check that the this is the citrullinated a- or b-ions. The aa index is greater than or equal to the index of the citrullination.
                    if (i >= citIndex)
                    {
                        // Check that both spectra contains the A-ion at this specific amino acid
                        if (citSpectrum.AIonIndex.Contains(i))
                        {
                            /* Calculate A-ion */
                            // Get the M/Z value for A-ion on the complementary citrullinated spectrum
                            double citMz = citSpectrum.SpectrumPossibleAIons[i];
                            // If the spectrum has an ion that is 43 Da less than the cit spectrum, add the spectrum m/z to the list
                            if (HelperUtilities.IsApproximately(mzVal, citMz - 43, ScoreSettings.CyanicLossTolerance))
                            {
                                cyanlossMz.Add(mzVal);
                                aIonCount++;
                                continue;
                            }
                        }

                        // Check that both spectra contains the B-ion at this specific amino acid
                        if (citSpectrum.BIonIndex.Contains(i))
                        {
                            /* Calculate B-ion */
                            // Get the M/Z value for B-ion on the complementary citrullinated spectrum
                            double citMz = citSpectrum.SpectrumPossibleBIons[i];
                            // If the spectrum has an ion that is 43 Da less than the cit spectrum, add the spectrum m/z to the list
                            if (HelperUtilities.IsApproximately(mzVal, citMz - 43, ScoreSettings.CyanicLossTolerance))
                            {
                                cyanlossMz.Add(mzVal);
                                bIonCount++;
                                continue;
                            }
                        }

                        // Check that both spectra contains the B-17 ion at this specific amino acid
                        if (citSpectrum.B17IonIndex.Contains(i))
                        {
                            /* Calculate B-17 ion */
                            // Get the M/Z value for B-17 ion on the complementary citrullinated spectrum
                            double citMz = citSpectrum.SpectrumPossibleBm17Ions[i];
                            // If the spectrum has an ion that is 43 Da less than the cit spectrum, add the spectrum m/z to the list
                            if (HelperUtilities.IsApproximately(mzVal, citMz - 43, ScoreSettings.CyanicLossTolerance))
                            {
                                cyanlossMz.Add(mzVal);
                                b17IonCount++;
                                continue;
                            }
                        }

                        // Check that both spectra contains the B-18 ion at this specific amino acid
                        if (citSpectrum.B18IonIndex.Contains(i))
                        {
                            /* Calculate B-18 ion */
                            // Get the M/Z value for B-18 ion on the complementary citrullinated spectrum
                            double citMz = citSpectrum.SpectrumPossibleBm18Ions[i];
                            // If the spectrum has an ion that is 43 Da less than the cit spectrum, add the spectrum m/z to the list
                            if (HelperUtilities.IsApproximately(mzVal, citMz - 43, ScoreSettings.CyanicLossTolerance))
                            {
                                cyanlossMz.Add(mzVal);
                                b18IonCount++;
                                continue;
                            }
                        }
                    }
                    // Check that the this is the citrullinated y-ion. The aa index is less than or equal to the index of the citrullination.
                    if (i <= citIndex)
                    {
                        // Check that both spectra contains the Y-ion at this specific amino acid
                        if (citSpectrum.YIonIndex.Contains(i))
                        {
                            /* Calculate Y-ion */
                            // Get the M/Z value for Y-ion on the complementary citrullinated spectrum
                            double citMz = citSpectrum.SpectrumPossibleYIons[i];
                            // If the spectrum has an ion that is 43 Da less than the cit spectrum, add the spectrum m/z to the list
                            if (HelperUtilities.IsApproximately(mzVal, citMz - 43, ScoreSettings.CyanicLossTolerance))
                            {
                                cyanlossMz.Add(mzVal);
                                yIonCount++;
                                continue;
                            }
                        }

                        // Check that both spectra contains the Y-17 ion at this specific amino acid
                        if (citSpectrum.Y17IonIndex.Contains(i))
                        {
                            /* Calculate Y-17 ion */
                            // Get the M/Z value for Y-17 ion on the complementary citrullinated spectrum
                            double citMz = citSpectrum.SpectrumPossibleYm17Ions[i];
                            // If the spectrum has an ion that is 43 Da less than the cit spectrum, add the spectrum m/z to the list
                            if (HelperUtilities.IsApproximately(mzVal, citMz - 43, ScoreSettings.CyanicLossTolerance))
                            {
                                cyanlossMz.Add(mzVal);
                                y17IonCount++;
                                continue;
                            }
                        }

                        // Check that both spectra contains the Y-18 ion at this specific amino acid
                        if (citSpectrum.Y18IonIndex.Contains(i))
                        {
                            /* Calculate Y-18 ion */
                            // Get the M/Z value for Y-18 ion on the complementary citrullinated spectrum
                            double citMz = citSpectrum.SpectrumPossibleYm18Ions[i];
                            // If the spectrum has an ion that is 43 Da less than the cit spectrum, add the spectrum m/z to the list
                            if (HelperUtilities.IsApproximately(mzVal, citMz - 43, ScoreSettings.CyanicLossTolerance))
                            {
                                cyanlossMz.Add(mzVal);
                                y18IonCount++;
                                continue;
                            }
                        }
                    }
                }
            }

            // Set collection
            citSpectrum.IsoCyanicLossMzMs2 = cyanlossMz.ToArray();
            // Calculate score
            double score = aIonCount * ScoreSettings.MS2IsoCyanLossAScore;

            score += bIonCount * ScoreSettings.MS2IsoCyanLossBScore;
            score += b17IonCount * (ScoreSettings.MS2IsoCyanLossBScore / ScoreSettings.MS2IsoCyanOnLossScoreDivider);
            score += b18IonCount * (ScoreSettings.MS2IsoCyanLossBScore / ScoreSettings.MS2IsoCyanOnLossScoreDivider);
            score += yIonCount * ScoreSettings.MS2IsoCyanLossYScore;
            score += y17IonCount * (ScoreSettings.MS2IsoCyanLossYScore / ScoreSettings.MS2IsoCyanOnLossScoreDivider);
            score += y18IonCount * (ScoreSettings.MS2IsoCyanLossYScore / ScoreSettings.MS2IsoCyanOnLossScoreDivider);
            // TODO: Set score instead of count
            //return cyanlossMz.Count;
            return(score);
        }