Ejemplo n.º 1
0
        public void TestSingleAminoAcidLinkedPeptide()
        {
            var srmSettings                = SrmSettingsList.GetDefault();
            var mainPeptide                = new Peptide("A");
            var staticMod                  = new StaticMod("crosslinker", null, null, "-C2");
            var linkedPeptide              = new LinkedPeptide(new Peptide("D"), 0, null);
            var mainTransitionGroup        = new TransitionGroup(mainPeptide, Adduct.SINGLY_PROTONATED, IsotopeLabelType.light);
            var mainTransitionGroupDocNode = new TransitionGroupDocNode(mainTransitionGroup,
                                                                        Annotations.EMPTY, srmSettings, null, null,
                                                                        ExplicitTransitionGroupValues.EMPTY, null, new TransitionDocNode[0], false);
            var modsWithoutLinkedPeptide = new ExplicitMods(mainPeptide, new[] { new ExplicitMod(0, staticMod), }, new TypedExplicitModifications[0]);

            Assert.AreEqual("C3H7NO2", AminoAcidFormulas.Default.GetFormula("A").ToString());
            Assert.AreEqual("C3H7NO2", mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, null).Molecule.ToString());
            Assert.AreEqual("CH7NO2", mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, modsWithoutLinkedPeptide).Molecule.ToString());
            Assert.AreEqual("C4H7NO4", AminoAcidFormulas.Default.GetFormula("D").ToString());
            var modsWithLinkedPeptide = new ExplicitMods(mainPeptide,
                                                         new[] { new ExplicitMod(0, staticMod).ChangeLinkedPeptide(linkedPeptide) },
                                                         new TypedExplicitModifications[0]);

            Assert.AreEqual("C5H14N2O6", mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, modsWithLinkedPeptide).Molecule.ToString());
            var mainComplexFragmentIon   = new ComplexFragmentIon(new Transition(mainTransitionGroup, IonType.precursor, mainPeptide.Length - 1, 0, Adduct.SINGLY_PROTONATED), null, modsWithLinkedPeptide.Crosslinks);
            var linkedComplexFragmentIon = new ComplexFragmentIon(
                new Transition(linkedPeptide.GetTransitionGroup(IsotopeLabelType.light, Adduct.SINGLY_PROTONATED),
                               IonType.precursor, linkedPeptide.Peptide.Length - 1, 0, Adduct.SINGLY_PROTONATED), null, LinkedPeptide.EMPTY_CROSSLINK_STRUCTURE);
            var complexFragmentIon =
                mainComplexFragmentIon.AddChild(new ModificationSite(0, staticMod.Name), linkedComplexFragmentIon);
            var transition       = complexFragmentIon.MakeTransitionDocNode(srmSettings, modsWithLinkedPeptide, null);
            var sequenceMassCalc = new SequenceMassCalc(MassType.Monoisotopic);
            var expectedMz       = sequenceMassCalc.GetPrecursorMass("A") + sequenceMassCalc.GetPrecursorMass("D") - 24 - BioMassCalc.MassProton;

            Assert.AreEqual(expectedMz, transition.Mz, .00001);
        }
Ejemplo n.º 2
0
        public void TestComplexIonMz()
        {
            var srmSettings      = SrmSettingsList.GetDefault();
            var peptide          = new Peptide("DLGEEHFKGLVLIAFSQYLQQCPFDEHVK");
            var linkedPeptide    = new LinkedPeptide(new Peptide("LVNELTEFAKTCVADESHAGCEK"), 9, null);
            var transitionGroup  = new TransitionGroup(peptide, Adduct.QUADRUPLY_PROTONATED, IsotopeLabelType.light);
            var crosslinkMod     = new StaticMod("linker", "K", null, "C8H10O2");
            var explicitMod      = new ExplicitMod(7, crosslinkMod).ChangeLinkedPeptide(linkedPeptide);
            var explicitMods     = new ExplicitMods(peptide, new[] { explicitMod }, new List <TypedExplicitModifications>());
            var linkedTransition =
                new Transition(linkedPeptide.GetTransitionGroup(IsotopeLabelType.light, Adduct.SINGLY_PROTONATED),
                               IonType.precursor, linkedPeptide.Peptide.Length - 1, 0, Adduct.SINGLY_PROTONATED);
            var expectedMzs = new[]
            {
                Tuple.Create(IonType.b, 2, 1, 229.1183),
                Tuple.Create(IonType.b, 10, 3, 1291.2766)
            };

            foreach (var tuple in expectedMzs)
            {
                int offset             = Transition.OrdinalToOffset(tuple.Item1, tuple.Item2, peptide.Sequence.Length);
                var transition         = new Transition(transitionGroup, tuple.Item1, offset, 0, Adduct.FromChargeProtonated(tuple.Item3));
                var complexFragmentIon = new ComplexFragmentIon(transition, null, explicitMods.Crosslinks);
                if (complexFragmentIon.IncludesAaIndex(explicitMod.IndexAA))
                {
                    complexFragmentIon = complexFragmentIon.AddChild(explicitMod.ModificationSite,
                                                                     new ComplexFragmentIon(linkedTransition, null, LinkedPeptide.EMPTY_CROSSLINK_STRUCTURE));
                }
                var complexTransitionDocNode = complexFragmentIon.MakeTransitionDocNode(srmSettings, explicitMods, null);
                Assert.AreEqual(tuple.Item4, complexTransitionDocNode.Mz, .0001, "{0}{1}{2}", tuple.Item1, tuple.Item2,
                                Transition.GetChargeIndicator(Adduct.FromChargeProtonated(tuple.Item3)));
            }
        }
Ejemplo n.º 3
0
        public void TestIncludesAaIndex()
        {
            var peptide         = new Peptide("AD");
            var transitionGroup = new TransitionGroup(peptide, Adduct.SINGLY_PROTONATED, IsotopeLabelType.light);
            var precursor       =
                new ComplexFragmentIon(new Transition(transitionGroup, IonType.precursor, peptide.Length - 1, 0, Adduct.SINGLY_PROTONATED), null, LinkedPeptide.EMPTY_CROSSLINK_STRUCTURE);

            Assert.IsTrue(precursor.IncludesAaIndex(0));
            Assert.IsTrue(precursor.IncludesAaIndex(1));
            var y1 = new ComplexFragmentIon(new Transition(transitionGroup, IonType.y, Transition.OrdinalToOffset(IonType.y, 1, peptide.Length), 0, Adduct.SINGLY_PROTONATED), null, LinkedPeptide.EMPTY_CROSSLINK_STRUCTURE);

            Assert.AreEqual(1, y1.Transition.Ordinal);
            Assert.IsFalse(y1.IncludesAaIndex(0));
            Assert.IsTrue(y1.IncludesAaIndex(1));
            var b1 = new ComplexFragmentIon(new Transition(transitionGroup, IonType.b, Transition.OrdinalToOffset(IonType.b, 1, peptide.Length), 0, Adduct.SINGLY_PROTONATED), null, LinkedPeptide.EMPTY_CROSSLINK_STRUCTURE);

            Assert.AreEqual(1, b1.Transition.Ordinal);
            Assert.IsTrue(b1.IncludesAaIndex(0));
            Assert.IsFalse(b1.IncludesAaIndex(1));
        }
Ejemplo n.º 4
0
 private void WriteLinkedIon(XmlWriter writer, ModificationSite modificationSite, ComplexFragmentIon complexFragmentIon)
 {
     writer.WriteStartElement(EL.linked_fragment_ion);
     if (!complexFragmentIon.IsOrphan)
     {
         // blank fragment type means orphaned fragment ion
         writer.WriteAttribute(ATTR.fragment_type, complexFragmentIon.Transition.IonType);
     }
     if (complexFragmentIon.Transition.IonType != IonType.precursor)
     {
         writer.WriteAttribute(ATTR.fragment_ordinal, complexFragmentIon.Transition.Ordinal);
     }
     writer.WriteAttribute(ATTR.index_aa, modificationSite.IndexAa);
     writer.WriteAttribute(ATTR.modification_name, modificationSite.ModName);
     WriteTransitionLosses(writer, complexFragmentIon.TransitionLosses);
     foreach (var child in complexFragmentIon.Children)
     {
         WriteLinkedIon(writer, child.Key, child.Value);
     }
     writer.WriteEndElement();
 }
Ejemplo n.º 5
0
 public IEnumerable <IonType> GetAllIonTypes(ComplexFragmentIon complexFragmentIon)
 {
     return(new[] { complexFragmentIon.Transition.IonType }.Concat(
                complexFragmentIon.Children.Values.SelectMany(child => GetAllIonTypes(child))));
 }