示例#1
0
 protected virtual void SetFixedMods(AminoAcidPolymer peptide)
 {
     foreach (Modification mod in _fixedMods)
     {
         peptide.SetModification(mod);
     }
 }
示例#2
0
 public Fragment(FragmentTypes type, int number, double monoisotopicMass, AminoAcidPolymer parent)
 {
     Type             = type;
     Number           = number;
     Parent           = parent;
     MonoisotopicMass = monoisotopicMass;
 }
示例#3
0
 /// <summary>
 /// Create a new peptide based on another amino acid polymer
 /// </summary>
 /// <param name="aminoAcidPolymer">The other amino acid polymer to copy</param>
 /// <param name="includeModifications">Whether to copy the modifications to the new peptide</param>
 public Peptide(AminoAcidPolymer aminoAcidPolymer, bool includeModifications = true)
     : base(aminoAcidPolymer, includeModifications)
 {
     Parent       = aminoAcidPolymer;
     StartResidue = 0;
     EndResidue   = Length - 1;
 }
示例#4
0
        internal IEnumerable <int> GetModifiableSites(AminoAcidPolymer peptide)
        {
            if (Sites == ModificationSites.None || peptide == null)
            {
                yield break;
            }

            if ((Sites & ModificationSites.NPep) == ModificationSites.NPep)
            {
                yield return(0);
            }

            int i = 1;

            foreach (AminoAcid aa in peptide.AminoAcids)
            {
                if ((Sites & aa.Site) == aa.Site)
                {
                    yield return(i);
                }
                i++;
            }

            if ((Sites & ModificationSites.PepC) == ModificationSites.PepC)
            {
                yield return(i);
            }
        }
示例#5
0
        /// <summary>
        /// Parse and apply an omssa modification line to this current amino acid polymer
        /// </summary>
        /// <param name="aap"></param>
        /// <param name="omssaModificationLine"></param>
        /// <returns></returns>
        public static AminoAcidPolymer SetModifications(this AminoAcidPolymer aap, string omssaModificationLine)
        {
            if (string.IsNullOrEmpty(omssaModificationLine))
            {
                return(aap);
            }

            foreach (Tuple <Modification, int> modPosition in OmssaModification.ParseModificationLine(omssaModificationLine))
            {
                int pos = modPosition.Item2;
                if (pos == 0)
                {
                    aap.NTerminusModification = modPosition.Item1;
                }
                else if (pos == aap.Length + 1)
                {
                    aap.CTerminusModification = modPosition.Item1;
                }
                else
                {
                    aap.SetModification(modPosition.Item1, pos);
                }
            }

            return(aap);
        }
示例#6
0
 public Peptide(AminoAcidPolymer aminoAcidPolymer, int firstResidue, int length, bool includeModifications = true)
     : base(aminoAcidPolymer, firstResidue, length, includeModifications)
 {
     Parent            = aminoAcidPolymer;
     StartResidue      = firstResidue;
     EndResidue        = firstResidue + length - 1;
     PreviousAminoAcid = aminoAcidPolymer.GetResidue(StartResidue - 1);
     NextAminoAcid     = aminoAcidPolymer.GetResidue(EndResidue + 1);
 }
示例#7
0
        protected virtual void SetVariableMods(AminoAcidPolymer peptide, string modname, int residue)
        {
            IMass mod;

            if (_variableMods.TryGetValue(modname, out mod))
            {
                peptide.SetModification(mod, residue);
            }
        }
示例#8
0
        public void TestGetDigestionPointsWithMethionineAndSemiDigestion()
        {
            var ok = AminoAcidPolymer.GetDigestionPointsAndLengths("MDERLEK", new List <TestProtease> {
                new TestProtease()
            }, 0, 0, 10000, true, true).ToList();

            IEqualityComparer <DigestionPointAndLength> jj = new OkComparer();
            var yee = new HashSet <DigestionPointAndLength>(ok, jj);

            Assert.AreEqual(1 + 3 + 1 + (8 - 1) + 1 + 1, yee.Count);
        }
示例#9
0
        public static AminoAcidPolymer SetModifications(this AminoAcidPolymer aap, string mods)
        {
            if (string.IsNullOrEmpty(mods))
            {
                return(aap);
            }

            foreach (Tuple <Modification, int> modPosition in OmssaModification.ParseModificationLine(mods))
            {
                aap.SetModification(modPosition.Item1, modPosition.Item2);
            }

            return(aap);
        }
示例#10
0
        public void TestGetDigestionPointsWithMethionine()
        {
            var ok = AminoAcidPolymer.GetDigestionPointsAndLengths("MDERLEKDERLE", new List <TestProtease> {
                new TestProtease()
            }, 0, 0, 10000, true, false).ToList();

            Assert.AreEqual(1, ok[0].Index);  // Methionine cleaved, digestion is at 1
            Assert.AreEqual(4, ok[0].Length); // The test protease cleaves at index 4, so after L.
            Assert.AreEqual(0, ok[1].Index);  // Regular digestion 1
            Assert.AreEqual(5, ok[1].Length); // Regular digestion 1
            Assert.AreEqual(5, ok[2].Index);  // Regular digestion 2
            Assert.AreEqual(1, ok[2].Length); // Regular digestion 2
            Assert.AreEqual(6, ok[3].Index);  // Regular digestion 3
            Assert.AreEqual(6, ok[3].Length); // Regular digestion 3
        }
示例#11
0
        public void CleavageIndicesTest()
        {
            IEnumerable <IProtease> proteases = new List <TestProtease> {
                new TestProtease()
            };
            var ok1 = AminoAcidPolymer.GetCleavageIndexes("ACDEFG", proteases, true).ToList();
            var ok2 = AminoAcidPolymer.GetCleavageIndexes("ACDEFG", proteases, false).ToList();
            var ok3 = AminoAcidPolymer.GetCleavageIndexes("ACDE", proteases, true).ToList();
            var ok4 = AminoAcidPolymer.GetCleavageIndexes("ACDE", proteases, false).ToList();

            Assert.AreEqual(3, ok1.Count());
            Assert.AreEqual(2, ok2.Count());
            Assert.AreEqual(4, ok3.Count());
            Assert.AreEqual(2, ok4.Count());
        }
示例#12
0
        public Peptide(string sequence, AminoAcidPolymer parent, int startResidue)
            : base(sequence)
        {
            Parent = parent;
            StartResidue = startResidue;
            EndResidue = startResidue + Length - 1;

            if (parent != null)
            {
                if (StartResidue > 0)
                    PreviousAminoAcid = parent.AminoAcids[StartResidue - 1];

                if (EndResidue < parent.Length - 1)
                    NextAminoAcid = parent.AminoAcids[EndResidue + 1];
            }
        }
示例#13
0
        public static string WriteModificationString(AminoAcidPolymer polymer)
        {
            IMass[]       mods  = polymer.GetModifications();
            int           count = mods.Length;
            StringBuilder sb    = new StringBuilder();

            for (int i = 0; i < count; i++)
            {
                if (mods[i] == null)
                {
                    continue;
                }
                sb.Append(mods[i].ToString());
                sb.Append(":");
                sb.Append(i);
                sb.Append(',');
            }
            if (sb.Length > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            return(sb.ToString());
        }
示例#14
0
 public ChemicalFormulaFragment(FragmentTypes type, int number, ChemicalFormula formula, AminoAcidPolymer parent)
     : base(type, number, formula.MonoisotopicMass, parent)
 {
     ChemicalFormula = new ChemicalFormula(formula);
 }
示例#15
0
 public new bool Equals(AminoAcidPolymer other)
 {
     return(base.Equals(other));
 }
 public ChemicalFormulaFragment(FragmentTypes type, int number, ChemicalFormula formula, AminoAcidPolymer parent)
     : base(type, number, formula.MonoisotopicMass, parent)
 {
     ChemicalFormula = new ChemicalFormula(formula);
 }
 public ChemicalFormulaFragment(FragmentTypes type, int number, string chemicalFormula, AminoAcidPolymer parent)
     : this(type, number, new ChemicalFormula(chemicalFormula), parent)
 {
 }
示例#18
0
        private void SetDynamicMods(AminoAcidPolymer peptide, string modifications)
        {
            if (peptide == null || string.IsNullOrEmpty(modifications))
                return;

            foreach (string modification in modifications.Split(',',';'))
            {
                string[] modParts = modification.Trim().Split(':');
                int location = 0;

                if (int.TryParse(modParts[1], out location))
                {
                    SetVariableMods(peptide, modParts[0], location);
                    OmssaModification omssaModification;
                    if (OmssaModification.TryGetModification(modParts[0], out omssaModification))
                    {
                        peptide.SetModification(omssaModification, location);
                    }
                    else
                    {
                        throw new ArgumentException("Could not find the following OMSSA modification: " + modParts[0]);
                    }
                }
                else
                {
                    throw new ArgumentException("Could not parse the residue position for the following OMSSA modification: " + modification);
                }
            }
        }
示例#19
0
 public int MissedCleavages(AminoAcidPolymer aminoAcidSequence)
 {
     throw new NotImplementedException();
 }
示例#20
0
 public IEnumerable <int> GetDigestionSites(AminoAcidPolymer aminoAcidSequence)
 {
     return(GetDigestionSites(aminoAcidSequence.BaseSequence));
 }
示例#21
0
 public Peptide(string sequence, AminoAcidPolymer parent)
     : this(sequence, parent, 0)
 {
 }
示例#22
0
 protected virtual void SetVariableMods(AminoAcidPolymer peptide, string modname, int residue)
 {
     IMass mod;
     if (_variableMods.TryGetValue(modname, out mod))
     {
         peptide.SetModification(mod, residue);
     }
 }
示例#23
0
        public void DigestionTest()
        {
            IProtease protease = new TestProtease();

            Assert.AreEqual(6, AminoAcidPolymer.Digest(_mockPeptideEveryAminoAcid, protease).Count());
        }
示例#24
0
 protected virtual void SetFixedMods(AminoAcidPolymer peptide)
 {
     foreach (Modification mod in _fixedMods)
     {
         peptide.SetModification(mod);
     }
 }
示例#25
0
 public static string WriteModificationString(AminoAcidPolymer polymer)
 {
     IMass[] mods = polymer.GetModifications();
     int count = mods.Length;
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < count; i++)
     {
         if (mods[i] == null)
             continue;
         sb.Append(mods[i].ToString());
         sb.Append(":");
         sb.Append(i);
         sb.Append(',');
     }
     if(sb.Length > 0) {
         sb.Remove(sb.Length - 1, 1);
     }
     return sb.ToString();
 }
示例#26
0
 public ChemicalFormulaFragment(FragmentTypes type, int number, string chemicalFormula, AminoAcidPolymer parent)
     : this(type, number, new ChemicalFormula(chemicalFormula), parent)
 {
 }
示例#27
0
 public FragmentCollection(IEnumerable <Fragment> fragments, AminoAcidPolymer parent = null)
 {
     _fragments = new List <Fragment>(fragments);
     _parent    = parent;
 }
示例#28
0
 public FragmentCollection(AminoAcidPolymer parent = null)
 {
     _fragments = new List <Fragment>();
     _parent    = parent;
 }