Question: Build on your answer to question 4 on assignment 7c. Write a function that will examine how a population evolves over several generations due to

Build on your answer to question 4 on assignment 7c. Write a function that will examine how a population evolves over several generations due to genetic drift. You will use your two functions that you have already written, draw_alleles(fA) and generate_population(fA, N). The new function, evolve_time(fA, N), will track the number of generations, starting with 0. Each time it calls generate_population(fA, N), it will check if fA is equal to 0 or 1. If either of these is true, it will stop running and return whether the A allele fixed (fA equals 1) or was lost (fA equals 0) and the number of generations that past.

Two functions already written:

def draw_alleles(fA): genotype='' rand_1=random.random() rand_2=random.random() if (rand_1fA) and (rand_2>fA): genotype='aa' else: if (rand_1

def generate_population(fA, N): aa_counter=0 Aa_counter=0 AA_counter=0 for i in range (N): this= draw_alleles (fA) if(this =='aa'): aa_counter=aa_counter+1 elif(this =='Aa'): Aa_counter=Aa_counter+1 else : AA_counter=AA_counter+1 return AA_counter, Aa_counter, aa_counter

What will this new function be? Language is python.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!