public void Parse(XmlDocument data)
        {
            #region Parameter Initialization
            foreach (XmlNode mod in data.SelectNodes(".//parameters/const_mod"))
            {
                MSDigestModification constMod = MSDigestModification.FromURI(mod.InnerText);
                Parameters.ConstantModifications.Add(constMod);
            }
            foreach (XmlNode mod in data.SelectNodes(".//parameters/mod_AA"))
            {
                Parameters.VariableModifications.Add(MSDigestModification.FromURI(mod.InnerText));
            }
            Parameters.Enzyme = data.SelectSingleNode(".//parameters/enzyme").InnerText;
            Parameters.MissedCleavages = Convert.ToInt32(data.SelectSingleNode(".//parameters/missed_cleavages").InnerText);
            Parameters.UserProteinSequence = data.SelectSingleNode(".//parameters/user_protein_sequence").InnerText;
            #endregion

            //No Database extractions for now

            #region Peptide Extraction
            foreach (XmlNode peptideNode in data.SelectNodes(".//peptide"))
            {
                //Console.WriteLine("------------------------------");
                MSDigestPeptide peptideObj = new MSDigestPeptide();
                peptideObj.PeptideIndex = Convert.ToInt32(peptideNode.SelectSingleNode(".//protein_index").InnerText);
                peptideObj.Charge = Convert.ToInt32(peptideNode.SelectSingleNode(".//charge").InnerText);
                peptideObj.Mass = Convert.ToDouble(peptideNode.SelectSingleNode(".//mi_m_over_z").InnerText);
                String modStr = "";
                foreach (XmlNode mod in peptideNode.SelectNodes(".//modification"))
                {
                    //Console.WriteLine(mod.InnerText);
                    modStr += mod.InnerText + " ";
                }
                peptideObj.Modifications = modStr;
                peptideObj.StartAA = Convert.ToInt32(peptideNode.SelectSingleNode(".//start_aa").InnerText);
                peptideObj.EndAA = Convert.ToInt32(peptideNode.SelectSingleNode(".//end_aa").InnerText);
                peptideObj.NextAA = (peptideNode.SelectSingleNode(".//next_aa").InnerText);
                peptideObj.PreviousAA = (peptideNode.SelectSingleNode(".//previous_aa").InnerText);
                peptideObj.MissedCleavages = Convert.ToInt32(peptideNode.SelectSingleNode(".//missed_cleavages").InnerText);
                peptideObj.Sequence = (peptideNode.SelectSingleNode(".//database_sequence").InnerText);
                peptideObj.ProteinID = Parameters.UserProteinSequence;
                peptideObj.NumGlycosylations = PeptideUtilities.CountNGlycanSequons(peptideObj);
                //Console.WriteLine(peptideObj);

                Peptides.Add(peptideObj);
            }
            #endregion
        }
 public MSDigestPeptide ConvertToMSDigestPeptide()
 {
     MSDigestPeptide peptide = new MSDigestPeptide();
     peptide.Charge = Charge;
     peptide.Selected = Selected;
     peptide.PeptideIndex = PeptideIndex;
     peptide.Mass = Mass;
     peptide.Modifications = Modifications;
     peptide.StartAA = StartAA;
     peptide.EndAA = EndAA;
     peptide.MissedCleavages = MissedCleavages;
     peptide.PreviousAA = PreviousAA;
     peptide.StartAA = StartAA;
     peptide.NextAA = NextAA;
     peptide.NumGlycosylations = NumGlycosylations;
     peptide.Sequence = Sequence;
     peptide.ProteinID = ProteinID;
     return peptide;
 }
 public Peptide(MSDigestPeptide other)
     : base()
 {
     this.Selected = other.Selected;
     this.PeptideIndex = other.PeptideIndex;
     this.Mass = other.Mass;
     this.Charge = other.Charge;
     this.Modifications = other.Modifications;
     this.StartAA = other.StartAA;
     this.EndAA = other.EndAA;
     this.MissedCleavages = other.MissedCleavages;
     this.PreviousAA = other.PreviousAA;
     this.Sequence = other.Sequence;
     this.NextAA = other.NextAA;
     this.NumGlycosylations = other.NumGlycosylations;
     this.ProteinID = other.ProteinID;
 }
 public static int CountNGlycanSequons(MSDigestPeptide sequence)
 {
     return CountNGlycanSequons(sequence.Sequence);
 }
        /// <summary>
        /// Combination Cosntructor
        /// </summary>
        /// <param name="glycanComposition"></param>
        /// <param name="peptide"></param>
        public GlycopeptideComposition(GlycanComposition glycanComposition, MSDigestPeptide peptide)
            : base(glycanComposition)
        {
            this.PeptideSequence = peptide.Sequence;
            this.PeptideModification = peptide.Modifications;
            this.StartAA = peptide.StartAA;
            this.EndAA = peptide.EndAA;
            this.GlycosylationCount = peptide.NumGlycosylations;
            this.MassWeight += peptide.Mass - WaterMass - glycanComposition.AdductMass;
            MolecularComposition["Water"] -= 1;
            if (ElementalComposition.ContainsKey("O"))
            {
                ElementalComposition["O"] -= 1;
                ElementalComposition["H"] -= 2;
            }
            this.ProteinID = peptide.ProteinID;

            AdductAmount = 0;
            AdductReplaces = "";
        }
 /// <summary>
 /// Peptide-Only Constructor
 /// </summary>
 /// <param name="peptide"></param>
 public GlycopeptideComposition(MSDigestPeptide peptide)
     : base()
 {
     this.PeptideSequence = peptide.Sequence;
     this.PeptideModification = peptide.Modifications;
     this.StartAA = peptide.StartAA;
     this.EndAA = peptide.EndAA;
     this.GlycosylationCount = peptide.NumGlycosylations;
     this.MassWeight += peptide.Mass;
     this.ProteinID = peptide.ProteinID;
 }