Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

## Hasegawa, Kishino and Yano 1985 (HKY85) model import numpy as np # Make Q matrix with equilibrium pi values # Now put in the

image text in transcribedimage text in transcribed

\#\# Hasegawa, Kishino and Yano 1985 (HKY85) model import numpy as np \# Make Q matrix with equilibrium pi values \# Now put in the kappa values kappa =2 Q[0,1].=Q[[0,1]]kappa Q[1,0].=Q[1,0]]kappa Q[2,3].=Q[2,3]kappa Q[3,2].Q[3,2]]kappa print (Q) \#Lets make the sum of each row zero by filling in the diagonal with the sum of each row. Documentation for sum and diagonal here: zsum=Qsum( axis=1 ) np.fill_diagonal ( Q,z sum ) print (Q) \#Scale the matrix so that t=1 is equivalent to 1 substitution per site. beta =1/sum(zsumpi) Q=Q beta print (Q) \#Finally, exponentiate for some value of t. P=expm(Q1) print (P) Write a function that returns a transition probability matrix P(t) given time 't', the ratio of transitions/transversions k (\$\kappa\$), and a vector of equilibrium nucleotide frequencies $ [A, G, C, T], i.e. under the HKY85 model. Use this function to evaluate the log10 probability of the sSA3 sequences with 't' taking values that range from 0.01 to 1 with a step size of 0.001. Print the largest log 10 probability and the value of ' t ', i.e. the value of $ th that is most likely given the data. Use k($\kappa$)=4 and nucleotides frequencies set to the observed frequencies of the SSA 3 sequences. When using Pij use Seub_SSA3 for i and Spar_SSA3 for j. np.arange is useful for iterating over range of non-integers

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

Step: 3

blur-text-image

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

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions