Answered step by step
Verified Expert Solution
Question
1 Approved Answer
On Python 2 In the Wright-Fisher Model, assuming no mutation, migration or selection, the number of alleles in generation t+1, given the number of alleles
On Python 2
In the Wright-Fisher Model, assuming no mutation, migration or selection, the number of alleles in generation t+1, given the number of alleles in generation t follows a binomial distribution, i.e, in which N is the population size, and Hence, the random variable X_ft+1 follows a binomial distribution. This can be implemented using np.random.binomial. P1 1. Using binomial random function in python, write a function that given an initial frequency of allele A and a given population size N, simulates the population history (i.e., an array of counts of allele A over different genereations) for a given number of generations. For example a possible output of your function wF mode1(N,f,t), in which N and t are integers and f is a float, for N-10e,f-0.1,t-18 could be the array [10,5,4,8,11,15,19,20,22,27] 2. Modify your function so that if allele A goes to fixation before reaching the specified number of generations t, i.e, fA-0 or fA-1, the iteration stops and only returns the history up to the point when the allele got fixed 3. Plot results of 10 different runs of this simulation
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started