Exemplo n.º 1
0
 /// <summary>
 /// Populate a mod brick object with the appropriate date
 /// </summary>
 /// <param name="title">Unique designation of mod brick, usually a single letter</param>
 /// <param name="fullName">full name</param>
 /// <param name="monoMass">monoisotopic mass</param>
 /// <param name="avgMass">average mass</param>
 /// <param name="formula">Chemical formula</param>
 public ModBrick(string title, string fullName, double monoMass, double avgMass, ChemFormula formula)
 {
     _title    = title;
     _fullName = fullName;
     _monoMass = monoMass;
     _avgMass  = avgMass;
     _formula  = formula;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Populate an AminoAcid object with the appropriate date
 /// </summary>
 /// <param name="title">Unique designation of Amino Acid, usually a single letter</param>
 /// <param name="shortName">3 letter name</param>
 /// <param name="fullName">full name</param>
 /// <param name="monoMass">monoisotopic mass</param>
 /// <param name="avgMass">average mass</param>
 /// <param name="formula">Chemical formula</param>
 public AminoAcid(string title, string shortName, string fullName, double monoMass, double avgMass, ChemFormula formula)
 {
     _title     = title;
     _shortName = shortName;
     _fullName  = fullName;
     _monoMass  = monoMass;
     _avgMass   = avgMass;
     _formula   = formula;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Populate a modification object with the appropriate data
 /// </summary>
 /// <param name="title">Modification title</param>
 /// <param name="fullName">Modification full name</param>
 /// <param name="monoMass">Modification monoisotopic mass</param>
 /// <param name="avgMass">Modification average mass</param>
 /// <param name="comp">Modifcation composition (UNIMOD style)</param>
 /// <param name="id">UNIMOD record id for modification</param>
 /// <param name="formula">Chemical formula of modification</param>
 public Modification(string title, string fullName, double monoMass, double avgMass, string comp, int id, ChemFormula formula)
 {
     _title       = title;
     _fullName    = fullName;
     _monoMass    = monoMass;
     _avgMass     = avgMass;
     _composition = comp;
     _recordId    = id;
     _formula     = formula;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Read the chemical formula of an item from unimod.xml
        /// </summary>
        /// <param name="reader">XmlReader that is only valid for the scope containing the chemical formula</param>
        /// <returns>List containing the chemical formula</returns>
        private static ChemFormula ReadFormula(XmlReader reader)
        {
            var formula = new ChemFormula();

            reader.MoveToContent();
            while (reader.ReadToFollowing("umod:element"))
            {
                var symbol = reader.GetAttribute("symbol");
                var number = Convert.ToInt32(reader.GetAttribute("number"));
                formula.Add(symbol, number);
            }

            return(formula);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Handle a single umod:brick element and child nodes
        /// Called by ReadModBricks (xml hierarchy)
        /// </summary>
        /// <param name="reader">XmlReader that is only valid for the scope of the single umod:brick element</param>
        private static void ReadModBrick(XmlReader reader)
        {
            reader.MoveToContent(); // Move to the "aa" element

            string title    = reader.GetAttribute("title");
            string fullName = reader.GetAttribute("full_name");
            double monoMass = Convert.ToDouble(reader.GetAttribute("mono_mass"));
            double avgMass  = Convert.ToDouble(reader.GetAttribute("avge_mass"));

            ChemFormula formula = ReadFormula(reader.ReadSubtree());

            var brick = new ModBrick(title, fullName, monoMass, avgMass, formula);

            ModBricks.Add(title, brick);

            reader.Close();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Handle a single umod:aa element and child nodes
        /// Called by ReadAminoAcids (xml hierarchy)
        /// </summary>
        /// <param name="reader">XmlReader that is only valid for the scope of the single umod:aa element</param>
        private static void ReadAminoAcid(XmlReader reader)
        {
            reader.MoveToContent(); // Move to the "aa" element

            string title     = reader.GetAttribute("title");
            string shortName = reader.GetAttribute("three_letter");
            string fullName  = reader.GetAttribute("full_name");
            double monoMass  = Convert.ToDouble(reader.GetAttribute("mono_mass"));
            double avgMass   = Convert.ToDouble(reader.GetAttribute("avge_mass"));

            ChemFormula formula = ReadFormula(reader.ReadSubtree());

            var amAcid = new AminoAcid(title, shortName, fullName, monoMass, avgMass, formula);

            AminoAcids.Add(title, amAcid);

            reader.Close();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Handle a single umod:mod element and child nodes
        /// Called by ReadModifications (xml hierarchy)
        /// </summary>
        /// <param name="reader">XmlReader that is only valid for the scope of the single umod:mod element</param>
        private static void ReadModification(XmlReader reader)
        {
            reader.MoveToContent();

            string title    = reader.GetAttribute("title");
            string fullName = reader.GetAttribute("full_name");
            int    recordId = Convert.ToInt32(reader.GetAttribute("record_id"));

            reader.ReadToDescendant("umod:delta");
            double monoMass    = Convert.ToDouble(reader.GetAttribute("mono_mass"));
            double avgMass     = Convert.ToDouble(reader.GetAttribute("avge_mass"));
            string composition = reader.GetAttribute("composition");

            ChemFormula formula = ReadFormula(reader.ReadSubtree());

            var mod = new Modification(title, fullName, monoMass, avgMass, composition, recordId, formula);

            ModList.Add(title, mod);

            reader.Close();
        }