|
a |
|
b/BioAid/diluter.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 calculate_dilution(count_per_square: int|float, final_plate: int|float) -> None: |
|
|
5 |
""" |
|
|
6 |
Calculates the dilution factor and dilution amounts for a given cell count and final plate volume. |
|
|
7 |
|
|
|
8 |
Args: |
|
|
9 |
count_per_square (float): The number of cells counted per square on a hemocytometer. |
|
|
10 |
final_plate (float): The desired number of cells per plate. |
|
|
11 |
|
|
|
12 |
Returns: |
|
|
13 |
None |
|
|
14 |
|
|
|
15 |
Examples: |
|
|
16 |
>>> calculate_dilution(50, 100) |
|
|
17 |
|
|
|
18 |
You should dilute by using 0.25 of cell culture with 0.75uL ddH2O |
|
|
19 |
and then with three steps of 100uL of diluted culture and 900uL ddH2O. |
|
|
20 |
Plate with 100uL of diluted solution per plate |
|
|
21 |
""" |
|
|
22 |
init_cells_ml = (count_per_square/4.0)*10**6 |
|
|
23 |
final_cells_ml = final_plate*10 |
|
|
24 |
|
|
|
25 |
dilution_factor = init_cells_ml/final_cells_ml |
|
|
26 |
dilution_factor = dilution_factor/1000 |
|
|
27 |
|
|
|
28 |
fourth_dilution_amount = 1000/dilution_factor |
|
|
29 |
|
|
|
30 |
print(f"\nYou should dilute by using {fourth_dilution_amount} of cell culture with {1000-fourth_dilution_amount}uL ddH2O \nand then with three steps of 100uL of diluted culture and 900uL ddH2O.\nPlate with 100uL of diluted solution per plate") |
|
|
31 |
|
|
|
32 |
def dilute() -> None: |
|
|
33 |
""" |
|
|
34 |
Prompts the user for input and calculates the dilution factor and dilution amounts using the calculate_dilution function. |
|
|
35 |
|
|
|
36 |
Args: |
|
|
37 |
None |
|
|
38 |
|
|
|
39 |
Returns: |
|
|
40 |
None |
|
|
41 |
|
|
|
42 |
Raises: |
|
|
43 |
None |
|
|
44 |
|
|
|
45 |
Examples: |
|
|
46 |
>>> dilute() |
|
|
47 |
|
|
|
48 |
Welcome to the Diluter 1.0. Enjoy not doing the math yourself! |
|
|
49 |
|
|
|
50 |
Initial number of cells refers to the average number of cells on the 1/16th of hematocrit slide. |
|
|
51 |
For best results take the average of at least three of these squares. |
|
|
52 |
|
|
|
53 |
Type initial number of cells in media or enter 'x' to exit: 50 |
|
|
54 |
|
|
|
55 |
Type in desired number of colonies per plate (100uL of media): 100 |
|
|
56 |
|
|
|
57 |
You should dilute by using 0.25 of cell culture with 0.75uL ddH2O |
|
|
58 |
and then with three steps of 100uL of diluted culture and 900uL ddH2O. |
|
|
59 |
Plate with 100uL of diluted solution per plate |
|
|
60 |
""" |
|
|
61 |
|
|
|
62 |
welcome_message = "\nWelcome to the Diluter 1.0. Enjoy not doing the math yourself!\n" |
|
|
63 |
print(welcome_message) |
|
|
64 |
|
|
|
65 |
print("Initial number of cells refers to the average number of cells on the 1/16th of hematocrit slide.\nFor best results take the average of at least three of these squares.") |
|
|
66 |
|
|
|
67 |
looping = True |
|
|
68 |
|
|
|
69 |
while looping: |
|
|
70 |
initial_cells = input("\nType initial number of cells in media or enter 'x' to exit: ") |
|
|
71 |
if initial_cells == "x": |
|
|
72 |
looping = False |
|
|
73 |
continue |
|
|
74 |
initial_cells = float(initial_cells) |
|
|
75 |
final_cells = input("\nType in desired number of colonies per plate (100uL of media): ") |
|
|
76 |
final_cells = float(final_cells) |
|
|
77 |
|
|
|
78 |
calculate_dilution(initial_cells,final_cells) |