private static MSPeak ConvertDeconPeakToMSPeak(Decon2LS.Peaks.clsPeak deconPeak)
        {
            MSPeak msPeak = new MSPeak();

            msPeak.Intensity = deconPeak.mdbl_intensity;
            msPeak.PeakWidth = deconPeak.mdbl_FWHM;
            msPeak.MZ = deconPeak.mdbl_mz;
            return msPeak;
        }
        private IList<MSPeak> GenerateTestPeakList()
        {
            IList<MSPeak> msPeaklist = new List<MSPeak>();
            MSPeak mspeak1 = new MSPeak(500, 100, 0.5);
            MSPeak mspeak2 = new MSPeak(501, 50, 0.5);
            MSPeak mspeak3 = new MSPeak(502, 10, 0.5);
            MSPeak mspeak4 = new MSPeak(503, 1, 0.5);

            msPeaklist.Add(mspeak1);
            msPeaklist.Add(mspeak2);
            msPeaklist.Add(mspeak3);
            msPeaklist.Add(mspeak4);

            return msPeaklist;
        }
        private void GenerateTheoreticalIsotopicPeakList(RunResult runResult)
        {
            MSPeak mspeak1 = new MSPeak(500, 100, 0.5);
            MSPeak mspeak2 = new MSPeak(501, 44.25, 0.5);
            MSPeak mspeak3 = new MSPeak(502, 7.34, 0.5);
            MSPeak mspeak4 = new MSPeak(503, 1.22, 0.5);
            MSPeak mspeak5 = new MSPeak(504, 0.65, 0.5);

            runResult.TheoreticalIsotopicPeakList.Add(mspeak1);
            runResult.TheoreticalIsotopicPeakList.Add(mspeak2);
            runResult.TheoreticalIsotopicPeakList.Add(mspeak3);
            runResult.TheoreticalIsotopicPeakList.Add(mspeak4);
            runResult.TheoreticalIsotopicPeakList.Add(mspeak5);
        }
Esempio n. 4
0
 private void AssertMSPeak(MSPeak peak, double expectedMz, double expectedIntensity)
 {
     Assert.AreEqual(expectedMz, peak.MZ);
     Assert.AreEqual(Math.Round(expectedIntensity, 5), Math.Round(peak.Intensity, 5));
 }
        private void GenerateIsotopicPeakList(RunResult runResult)
        {
            MSPeak mspeak1 = new MSPeak(500, 100, 0.5);
            MSPeak mspeak2 = new MSPeak(501, 50, 0.5);
            MSPeak mspeak3 = new MSPeak(502, 10, 0.5);
            MSPeak mspeak4 = new MSPeak(503, 1, 0.5);

            runResult.IsotopicPeakList.Add(mspeak1);
            runResult.IsotopicPeakList.Add(mspeak2);
            runResult.IsotopicPeakList.Add(mspeak3);
            runResult.IsotopicPeakList.Add(mspeak4);
        }
        private static int CalculatePeaksInCalculation(RunResult result)
        {
            // determine max intensity
            MSPeak mostIntensePeak = new MSPeak();

            foreach (MSPeak peak in result.IsotopicPeakList)
            {
                if (peak.Intensity > mostIntensePeak.Intensity)
                {
                    mostIntensePeak = peak;
                }
            }

            bool foundPeakaboveThreshold = false;
            int returnedIndex = 0;

            for (int i = 0; i < result.IsotopicPeakList.Count; i++)
            {
                // start at Mono
                // add peaks if they are above the deutDistThreshold
                // Stop adding peaks if they are below the deutDistThreshold
                if (result.IsotopicPeakList[i].Intensity / mostIntensePeak.Intensity * 100 > result.ActualDeutDistThreshold)
                {
                    foundPeakaboveThreshold = true;
                }

                if (foundPeakaboveThreshold && result.IsotopicPeakList[i].Intensity / mostIntensePeak.Intensity * 100 < result.ActualDeutDistThreshold)
                {
                    returnedIndex = i;
                    break;
                }
                returnedIndex = i;
            }

            return returnedIndex;
        }
Esempio n. 7
0
        // TODO: This method is redudant with the one below.  Collapse it so it uses the method below.
        public void GetIsotopicProfile(RunResult result, bool addProton, int numberOfIsotopesInProfile, bool addNTerminalProteon, bool addCTerminalFreeAcid)
        {
            Peptide peptide = result.Peptide;
            if (IsPeptideSequenceValid(peptide.Sequence))
            {
                // the dimensions change once used by the MolecularWeightCalculator
                double[,] isotopeData = new double[100, 2];

                string threeLetterCodedPeptide = GetPeptideThreeLetterCode(peptide.Sequence, false, addNTerminalProteon, addCTerminalFreeAcid, string.Empty);

                if (addProton)
                {
                    threeLetterCodedPeptide += "H";
                }

                string resultsString = string.Empty;
                int numResults = 0;
                mw.ComputeIsotopicAbundances(ref threeLetterCodedPeptide, (short)peptide.ChargeState, ref resultsString, ref isotopeData, ref numResults, string.Empty, string.Empty, string.Empty, string.Empty);

                for (int i = 1; i < isotopeData.GetLength(0); i++)
                {
                    MSPeak peak = new MSPeak();
                    peak.MZ = isotopeData[i, 0];
                    peak.Intensity = isotopeData[i, 1];
                    result.TheoreticalIsotopicPeakList.Add(peak);
                }

                if (result.TheoreticalIsotopicPeakList.Count < numberOfIsotopesInProfile)
                {
                    for (int i = result.TheoreticalIsotopicPeakList.Count; i < numberOfIsotopesInProfile; i++)
                    {
                        result.TheoreticalIsotopicPeakList.Add(new MSPeak(0, 0, 0));
                    }
                }
            }
        }
Esempio n. 8
0
        public void GetIsotopicProfileForFragmentIon(RunResult result, int numberOfIsotopesInProfile)
        {
            if (IsPeptideSequenceValid(result.Peptide.Sequence))
            {
                // the dimensions change once used by the MolecularWeightCalculator
                double[,] isotopeData = new double[100, 2];

                string threeLetterCodedPeptide;
                switch (result.FragmentIon.FragmentIonType)
                {
                    case Hydra.Core.FragmentIonType.Parent:
                        threeLetterCodedPeptide = GetPeptideThreeLetterCode(result.FragmentIon.Sequence, true, true, true, string.Empty);
                        break;
                    case Hydra.Core.FragmentIonType.BFragment:
                        threeLetterCodedPeptide = GetPeptideThreeLetterCode(result.FragmentIon.Sequence, true, false, false, string.Empty);
                        break;
                    case Hydra.Core.FragmentIonType.YFragment:
                        threeLetterCodedPeptide = GetPeptideThreeLetterCode(result.FragmentIon.Sequence, true, true, true, string.Empty);
                        break;
                    case Hydra.Core.FragmentIonType.AFragment:
                        throw new System.ArgumentException("Code not yet written for a-ions");
                    case Hydra.Core.FragmentIonType.BMinusH2O:
                        threeLetterCodedPeptide = GetPeptideThreeLetterCode(result.FragmentIon.Sequence, true, false, false, ">H2O");

                        break;
                    case Hydra.Core.FragmentIonType.YMinusH2O:
                        threeLetterCodedPeptide = GetPeptideThreeLetterCode(result.FragmentIon.Sequence, true, true, true, ">H2O");

                        break;
                    case Hydra.Core.FragmentIonType.BMinusNH3:
                        threeLetterCodedPeptide = GetPeptideThreeLetterCode(result.FragmentIon.Sequence, true, false, false, ">NH3");

                        break;
                    case Hydra.Core.FragmentIonType.YMinusNH3:
                        threeLetterCodedPeptide = GetPeptideThreeLetterCode(result.FragmentIon.Sequence, true, true, true, ">NH3");

                        break;
                    default:
                        throw new System.ArgumentException("Invalid fragment ion Type");
                }

                string resultsString = string.Empty;
                int numResults = 0;
                mw.ComputeIsotopicAbundances(ref threeLetterCodedPeptide, (short)result.FragmentIon.ChargeState, ref resultsString, ref isotopeData, ref numResults, string.Empty, string.Empty, string.Empty, string.Empty);

                for (int i = 1; i < isotopeData.GetLength(0); i++)
                {
                    MSPeak peak = new MSPeak();
                    peak.MZ = isotopeData[i, 0];
                    peak.Intensity = isotopeData[i, 1];
                    result.TheoreticalIsotopicPeakList.Add(peak);
                }

                if (result.TheoreticalIsotopicPeakList.Count < numberOfIsotopesInProfile)
                {
                    for (int i = result.TheoreticalIsotopicPeakList.Count; i < numberOfIsotopesInProfile; i++)
                    {
                        result.TheoreticalIsotopicPeakList.Add(new MSPeak(0, 0, 0));
                    }
                }
            }
        }
Esempio n. 9
0
        public IList<MSPeak> GetIsotopicProfile(string peptideSequence, int chargeState, bool addProton, int numberOfIsotopesInProfile, bool addNTerminalProteon, bool addCTerminalFreeAcid, string tag)
        {
            if (IsPeptideSequenceValid(peptideSequence))
            {
                // the dimensions change once used by the MolecularWeightCalculator
                double[,] isotopeData = new double[100, 2];
                string resultsString = string.Empty;
                int numResults = 0;

                IList<MSPeak> theoreticalIsotopicProfilePeaks = new List<MSPeak>();
                string threeLetterCodedPeptide = GetPeptideThreeLetterCode(peptideSequence, false, addNTerminalProteon, addCTerminalFreeAcid, string.Empty);

                if (addProton)
                {
                    threeLetterCodedPeptide += "H";
                }
                threeLetterCodedPeptide = threeLetterCodedPeptide + tag;

                mw.ComputeIsotopicAbundances(ref threeLetterCodedPeptide, (short)chargeState, ref resultsString, ref isotopeData, ref numResults, string.Empty, string.Empty, string.Empty, string.Empty);

                for (int i = 1; i < isotopeData.GetLength(0); i++)
                {
                    MSPeak peak = new MSPeak();
                    peak.MZ = isotopeData[i, 0];
                    peak.Intensity = isotopeData[i, 1];
                    theoreticalIsotopicProfilePeaks.Add(peak);
                }

                if (theoreticalIsotopicProfilePeaks.Count < numberOfIsotopesInProfile)
                {
                    for (int i = theoreticalIsotopicProfilePeaks.Count; i < numberOfIsotopesInProfile; i++)
                    {
                        theoreticalIsotopicProfilePeaks.Add(new MSPeak(0, 0, 0));
                    }
                }
                return theoreticalIsotopicProfilePeaks;
            }
            return null;
        }