public DnaSequence Evolve(DnaSequence dnaSequence, double time) { DnaSequence evolvedDnaSequence = new DnaSequence(dnaSequence.Size()); for (int i = 0; i < dnaSequence.Size(); i++) { evolvedDnaSequence[i] = this.evolutionModel.GenerateNextBase(dnaSequence.ElementAt(i), time); } return(evolvedDnaSequence); }
// Constructor for root node public PhyloTreeNode(DnaSequence dnaSequence) { this.dnaSequence = dnaSequence; double timeToEvolve = ExponentialDistribution.randomExponential.NextDouble(); this.timeFromStart = timeToEvolve; this.creationTime = 0; this.childrenNodes = new List <PhyloTreeNode>(); NodeEvolutionScheduler.scheduler.ScheduleNodeEvolution(this, timeToEvolve); }
private void Evolve() { DnaSequence evolvedDnaSequence1 = DnaSequenceEvolver.evolver.Evolve(this.dnaSequence, this.timeFromStart); DnaSequence evolvedDnaSequence2 = DnaSequenceEvolver.evolver.Evolve(this.dnaSequence, this.timeFromStart); List <PhyloTreeNode> childrenNodes = new List <PhyloTreeNode>() { new PhyloTreeNode(this, evolvedDnaSequence1), new PhyloTreeNode(this, evolvedDnaSequence2) }; this.childrenNodes = childrenNodes; }
static void Main(string[] args) { string userInputSequence = string.Empty; SetupEnviroment(); Console.WriteLine("Please input root sequence:"); userInputSequence = Console.ReadLine(); DnaSequence userSequence = new DnaSequence(userInputSequence); NodeEvolutionScheduler.scheduler.StartScheduler(); PhyloTree tree = new PhyloTree(userSequence); Program.tree = tree; Program.evolutionTimer.Enabled = true; Console.ReadLine(); }
public PhyloTree(DnaSequence rootDnaSequence) { this.rootNode = new PhyloTreeNode(rootDnaSequence); }