Пример #1
0
 public void AddRange(PolymorphismCollection otherPolys)
 {
     foreach (var v in otherPolys)
     {
         Add(v);
     }
 }
Пример #2
0
        public PhyloTreeNodev2(XmlNode node, PhyloTreeNodev2 parentNode = null)
        {
            this.NodeID = ++NodeIDCounter;
            Children    = new List <PhyloTreeNodev2>();
            Mutations   = new PolymorphismCollection();
            //set the haplogroup
            haplogroup = new Haplogroup(node.Attributes.GetNamedItem("name").Value);
            var details = node.SelectSingleNode("details");

            haplogroup.AccessionId = details.Attributes.GetNamedItem("accessionNr").Value;
            if (String.IsNullOrEmpty(haplogroup.AccessionId))
            {
                NodesWithNoAccession++;
            }
            haplogroup.Reference = details.Attributes.GetNamedItem("reference").Value;
            //now copy polymorphism if needed
            if (parentNode != null)
            {
                Mutations.AddRange(parentNode.Mutations);
            }
            //now update with the mutations here
            var polys = details.SelectNodes("poly");

            foreach (XmlNode p in polys)
            {
                if (p.InnerText.Contains("X"))
                {     //System.Console.WriteLine("Skipping: " + p.InnerText);
                    continue;
                }
                var currentPoly = new Polymorphism(p.InnerText);
                Mutations.Add(currentPoly);
            }
            //now make the children
            var children = node.SelectNodes("haplogroup");

            foreach (XmlNode currentElement in children)
            {
                Children.Add(new PhyloTreeNodev2(currentElement, this));
            }
        }