-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculate_probabilities.py
More file actions
47 lines (45 loc) · 1.99 KB
/
calculate_probabilities.py
File metadata and controls
47 lines (45 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from data_processing import *
data_extract()
female_genes_list = [] # inputted from the user
male_genes_list = [] # inputted from the user
viewed = []
probabilities = {}
def calculate_probability(mother_disorders, father_disorders):
female_genes_list = mother_disorders
male_genes_list = father_disorders
for gene in female_genes_list:
if disorder_gene[gene] == 'D' or disorder_gene[gene] == 'dominant':
if gene in male_genes_list and gene not in viewed:
#print(f"Probability of the offspring having {gene} is 93.75%")
viewed.append(gene)
probabilities[gene] = "93.75%"
elif gene not in male_genes_list and gene not in viewed:
print(f"Probability of the offspring having {gene} is 75%")
viewed.append(gene)
probabilities[gene] = "75%"
else:
pass
if disorder_gene[gene] == 'recessive':
if gene in male_genes_list and gene not in viewed:
print(f"Probability of the offspring having {gene} is 100%")
viewed.append(gene)
probabilities[gene] = "100%"
elif gene not in male_genes_list and gene not in viewed:
print(f"Probability of the offspring {gene} disorder is 25%")
viewed.append(gene)
probabilities[gene] = "25%"
else:
pass
for gene in male_genes_list:
if gene not in viewed:
viewed.append(gene)
if disorder_gene[gene] == 'D' or disorder_gene[gene] == 'dominant':
print(f"Probability of the offspring having {gene} is 75%")
probabilities[gene] = "75%"
elif disorder_gene[gene] == 'recessive':
print(f"Probability of the offspring {gene} disorder is 25%")
probabilities[gene] = "25%"
else:
pass
return probabilities
calculate_probability(female_genes_list,male_genes_list)