|
a |
|
b/BioAid/popDub.py |
|
|
1 |
# This code was developed and authored by Jerzy Twarowski in Malkova Lab at the University of Iowa |
|
|
2 |
# Contact: jerzymateusz-twarowski@uiowa.edu, tvarovski1@gmail.com |
|
|
3 |
|
|
|
4 |
def calculatePopulationDoublings(initial_population: int|float, final_population_ml: int|float, final_culture_volume: int|float) -> None: |
|
|
5 |
""" |
|
|
6 |
Calculates the number of population doublings required to reach a final population size. |
|
|
7 |
|
|
|
8 |
Args: |
|
|
9 |
initial_population (int|float): The initial population size. |
|
|
10 |
final_population_ml (int|float): The final population size in milliliters. |
|
|
11 |
final_culture_volume (int|float): The final culture volume in milliliters. |
|
|
12 |
|
|
|
13 |
Returns: |
|
|
14 |
None: This function does not return anything, but prints the number of population doublings required to reach the final population size. |
|
|
15 |
""" |
|
|
16 |
final_population = final_population_ml * final_culture_volume |
|
|
17 |
doubling_cycle_size = final_population |
|
|
18 |
doublings = 0 |
|
|
19 |
while doubling_cycle_size > initial_population: |
|
|
20 |
if doubling_cycle_size < initial_population*2: |
|
|
21 |
doublings = doublings + (doubling_cycle_size-initial_population)/initial_population |
|
|
22 |
break |
|
|
23 |
doubling_cycle_size = doubling_cycle_size/2.0 |
|
|
24 |
doublings += 1 |
|
|
25 |
print(f"Starting from the population size of {initial_population} to the final size of {final_population} cells,\\nthere were {doublings} population doublings") |