示例#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());
        }