Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Write a method to simulate sequences down a simulated tree according to the Jukes-Cantor substitution model. Your method should take a tree with n

image text in transcribed

2. Write a method to simulate sequences down a simulated tree according to the Jukes-Cantor substitution model. Your method should take a tree with n leaves, sequence length L, and a mutation rate ?. It should return either a matrix of sequences corresponding to nodes in the tree or the tree with sequences stored at the nodes. Your method should generate a uniform random sequence of length L at the root node and recursively mutate it down the branches of the tree, using the node heights to calculate branch length. Pseudocode methods for random sequence generation and mutation down a lineage are provided at the end of this problem.

randseq(L) for (i in 1 to L) 
 seq[i] = choice([A,C,G,T], [0.25,0.25,0.25,0.25]) return seq 

The mutate method below allows mutations from a base to itself. The uncorrected mutation rate (? rather than 3?) can therefore be used.

4

mutate(X,t,mu) L= X.length() \\ the number of mutations is Poisson with total rate L*mu*t numMutation = randpoiss(L*mu*t) \\ for each mutation, choose a site to mutate and mutate it for (i in 1 to numMutation) 
 \\ choose a site site = ceiling(random()*L) \\ mutate that site X[site] = choice([A,C,G,T], [0.25,0.25,0.25,0.25]) 

return X

2. Write a method to simulate sequences down a simulated tree according to the Jukes-Cantor substitution model. Your method should take a tree with n leaves, sequence length L, and a mutation rate ?. It should return either a matrix of sequences corresponding to nodes in the tree or the tree with sequences stored at the nodes. Your method should generate a uniform random sequence of length L at the root node and recursively mutate it down the branches of the tree, using the node heights to calculate branch length. Pseudocode methods for random sequence generation and mutation down a lineage are provided at the end of this problem 2. Write a method to simulate sequences down a simulated tree according to the Jukes-Cantor substitution model. Your method should take a tree with n leaves, sequence length L, and a mutation rate ?. It should return either a matrix of sequences corresponding to nodes in the tree or the tree with sequences stored at the nodes. Your method should generate a uniform random sequence of length L at the root node and recursively mutate it down the branches of the tree, using the node heights to calculate branch length. Pseudocode methods for random sequence generation and mutation down a lineage are provided at the end of this

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

2. Employees and managers participate in development of the system.

Answered: 1 week ago