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); }
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); } }
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); }
public PhyloTree(DnaSequence rootDnaSequence) { this.rootNode = new PhyloTreeNode(rootDnaSequence); }