Пример #1
0
        public void ParseCTerminalChemicalFormulaWithLastResidueModStringRepresentation()
        {
            Peptide peptide = new Peptide("TTGSSSSSSSK[H2O]-[C2H3NO]");

            Assert.AreEqual("TTGSSSSSSSK[H2O]-[C2H3NO]", peptide.GetSequenceWithModifications());

            peptide.NTerminus = new ChemicalFormulaTerminus(ChemicalFormula.ParseFormula("N"));

            Assert.AreEqual("TTGSSSSSSSK[H2O]-[C2H3NO]", peptide.GetSequenceWithModifications());

            ChemicalFormula formulaA = new ChemicalFormula(ChemicalFormula.ParseFormula("C39H70N14O23"));
            var             formulaB = peptide.GetChemicalFormula();

            Assert.AreEqual(formulaA, formulaB);

            peptide.AddModification(new ObjectWithMass100(), 0);

            Assert.AreEqual("[mass: 100]-TTGSSSSSSSK[H2O]-[C2H3NO]", peptide.GetSequenceWithModifications());

            Assert.AreEqual(1, peptide.AddModification(new ObjectWithMass100(), Terminus.C));

            Assert.AreEqual(3, peptide.ModificationCount());

            Assert.AreEqual(0, peptide.ReplaceModification(new ObjectWithMass100(), new ObjectWithMass100()));

            Assert.That(() => peptide.ReplaceModification(null, new ObjectWithMass100()),
                        Throws.TypeOf <MzLibException>()
                        .With.Property("Message")
                        .EqualTo("Cannot replace a null modification"));

            peptide.SetModification(new ObjectWithMass100(), new int[] { 1, 11 });
            Assert.AreEqual(4, peptide.ModificationCount());

            OldSchoolModification mod1 = new OldSchoolModification(5, "mass 5 on T", ModificationSites.T);

            peptide.SetModifications(new List <OldSchoolModification> {
                mod1
            });
            Assert.AreEqual(5, peptide.ModificationCount());
        }
Пример #2
0
        public void TestLeucineSequence()
        {
            Assert.AreEqual("ACDEFGHLKLMNPQRSTVWY", _mockPeptideEveryAminoAcid.GetSequenceWithModifications(true));
            Assert.AreEqual(20, _mockPeptideEveryAminoAcid.ResidueCount());
            Assert.AreEqual(7, _mockTrypticPeptide.ResidueCount('S'));
            Assert.AreEqual(7, _mockTrypticPeptide.ResidueCount(Residue.GetResidue('S')));
            Assert.AreEqual(2, _mockTrypticPeptide.ResidueCount(Residue.GetResidue('S'), 2, 3));
            Assert.AreEqual(3, _mockTrypticPeptide.ResidueCount('S', 2, 4));

            Peptide peptide = new Peptide("III-[C2H3NO]");

            Assert.AreEqual("LLL-[C2H3NO]", peptide.GetSequenceWithModifications(true));
        }
Пример #3
0
        public void TestClearModifications()
        {
            Peptide a = new Peptide("ACDEFGHIKLMNPQRSTVWY");

            a.AddModification(new OldSchoolChemicalFormulaModification(ChemicalFormula.ParseFormula("O"), ModificationSites.D));
            a.AddModification(new OldSchoolChemicalFormulaModification(ChemicalFormula.ParseFormula("H"), ModificationSites.E));
            Assert.AreEqual(2, a.ModificationCount());
            a.ClearModifications();
            Assert.AreEqual(0, a.ModificationCount());
            a.AddModification(new OldSchoolChemicalFormulaModification(ChemicalFormula.ParseFormula("O"), ModificationSites.NTerminus));
            a.AddModification(new OldSchoolModification(1), ModificationSites.TerminusC);
            Assert.AreEqual(2, a.ModificationCount());
            a.Fragment(FragmentTypes.y);

            Peptide           peptide = new Peptide("[C2H3NO]-LLL-[C2H3NO]");
            ModificationSites ff      = ModificationSites.NPep | ModificationSites.PepC;

            peptide.ClearModifications(ff);
            Assert.AreEqual("LLL", peptide.GetSequenceWithModifications());
        }