CS代考 # mutates a sequence according to the Jukes-Cantor model

# mutates a sequence according to the Jukes-Cantor model
# X is an numpy.array with entries in {0,1,2,3}
# t is branch length
# mu is mutation rate

Copyright By PowCoder代写 加微信 powcoder

def mutate(X,t,mu):
import numpy.random as rand
mutatedSeq = X.copy()

numMutation = rand.poisson(L*mu*t)
for i in range(numMutation):
site = rand.randint(0,L)
mutatedSeq[site] = rand.randint(0,4)

return mutatedSeq

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com