Пример #1
0
        // ReSharper restore StringLiteralTypo
        public void TestComputeAminoAcidMassModifiedResidues(string strSequence, string residueModList, double expectedMass)
        {
            var residueMods = residueModList.Split(';');

            var modifiedResidues = new List <PeptideMassCalculator.PeptideSequenceModInfo>();

            foreach (var modifiedResidue in residueMods)
            {
                var modParts = modifiedResidue.Split(':');

                var residueLocation = int.Parse(modParts[0]);
                var modMass         = double.Parse(modParts[1]);

                var modInfo = new PeptideMassCalculator.PeptideSequenceModInfo
                {
                    ResidueLocInPeptide = residueLocation,
                    ModificationMass    = modMass,
                    AffectedAtom        = PeptideMassCalculator.NO_AFFECTED_ATOM_SYMBOL
                };

                modifiedResidues.Add(modInfo);
            }

            var computedMass = mPeptideMassCalculator.ComputeSequenceMass(strSequence, modifiedResidues);

            Console.WriteLine("{0,-30} is {1:F5}; expected {2:F5}", strSequence, computedMass, expectedMass);

            Assert.AreEqual(expectedMass, computedMass, 0.0001, "Unexpected mass for the amino acid sequence");
        }
Пример #2
0
        private static void TestMSGFPlusParamFileParsing(string msgfPlusParamFilePath)
        {
            var modFileProcessor = new MSGFPlusParamFileModExtractor("MSGF+");

            modFileProcessor.ErrorEvent   += ErrorEventHandler;
            modFileProcessor.WarningEvent += WarningEventHandler;

            var peptideMassCalculator = new PeptideMassCalculator();

            MSGFPlusSynFileReader.UpdateMassCalculatorMasses(msgfPlusParamFilePath, modFileProcessor, peptideMassCalculator, out _);

            var modifiedResidues = new List <PeptideMassCalculator.PeptideSequenceModInfo>();

            var monoMass = peptideMassCalculator.ComputeSequenceMass("PEPTIDE", modifiedResidues);

            Console.WriteLine("Mono mass of PEPTIDE: " + monoMass.ToString("0.0000"));

            var modifiedResidue = new PeptideMassCalculator.PeptideSequenceModInfo
            {
                ResidueLocInPeptide = 4,
                ModificationMass    = 79.966
            };

            modifiedResidues.Add(modifiedResidue);

            var monoMassModified = peptideMassCalculator.ComputeSequenceMass("PEPTIDE", modifiedResidues);

            Console.WriteLine("Mono mass of PEPT*IDE: " + monoMassModified.ToString("0.0000"));

            const double MONO_MASS_EXPECTED          = 799.359926865;
            const double MODIFIED_MONO_MASS_EXPECTED = 879.325926865;

            if (Math.Abs(monoMass - MONO_MASS_EXPECTED) > 1E-07)
            {
                PRISM.ConsoleMsgUtils.ShowWarning("Computed mass of {0:F6} does not match the expected mass, {1:F6}", monoMass, MONO_MASS_EXPECTED);
            }

            if (Math.Abs(monoMassModified - MODIFIED_MONO_MASS_EXPECTED) > 1E-07)
            {
                PRISM.ConsoleMsgUtils.ShowWarning("Modified computed mass of {0:F6} does not match the expected mass, {1:F6}", monoMassModified, MODIFIED_MONO_MASS_EXPECTED);
            }
        }