Exemplo n.º 1
0
        private PhyloTreeNode(PhyloTreeNode parent, DnaSequence dnaSequence)
        {
            this.dnaSequence = dnaSequence;
            double timeToEvolve = ExponentialDistribution.randomExponential.NextDouble();

            this.creationTime  = parent.GetTimeFromStart();
            this.timeFromStart = parent.GetTimeFromStart() + timeToEvolve;
            this.childrenNodes = new List <PhyloTreeNode>();
            NodeEvolutionScheduler.scheduler.ScheduleNodeEvolution(this, timeToEvolve);
        }
Exemplo n.º 2
0
 public void ScheduleNodeEvolution(PhyloTreeNode node, double timeToEvolve)
 {
     if (this.SchedulerActive)
     {
         Timer evolutionTimer = new Timer(timeToEvolve);
         evolutionTimer.Elapsed  += new ElapsedEventHandler(node.EvolveNodeCallback);
         evolutionTimer.AutoReset = false;
         evolutionTimer.Enabled   = true;
         this.timers.Add(evolutionTimer);
     }
 }
Exemplo n.º 3
0
        private string PrintTreeRecursive(PhyloTreeNode node, int depthLevel)
        {
            string partialString          = new string(' ', depthLevel);
            List <PhyloTreeNode> children = node.GetChildrenNodes();

            partialString += $"-{node.GetNodeSequence()}; Edge: {node.creationTime}ms\n";
            foreach (var childNode in children)
            {
                partialString += this.PrintTreeRecursive(childNode, depthLevel + 1);
            }
            return(partialString);
        }
Exemplo n.º 4
0
 public PhyloTree(DnaSequence rootDnaSequence)
 {
     this.rootNode = new PhyloTreeNode(rootDnaSequence);
 }