forked from Shivi91/Rosalind-1
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path013_IEV.py
More file actions
30 lines (24 loc) · 717 Bytes
/
Copy path013_IEV.py
File metadata and controls
30 lines (24 loc) · 717 Bytes
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
#!/usr/bin/env python
'''
A solution to a ROSALIND bioinformatics problem.
Problem Title: Calculating Expected Offspring
Rosalind ID: IEV
Rosalind #: 013
URL: http://rosalind.info/problems/iev/
'''
with open('data/rosalind_iev.txt') as input_data:
s = input_data.read().split()
# Probabilities of Child Dominant Genotype
# ----------------------------------------
# s[0]: AA-AA -> 100% chance of dominant
# s[1]: AA-Aa -> 100%
# s[2]: AA-aa -> 100%
# s[3]: Aa-Aa -> 75%
# s[4]: Aa-aa -> 50%
# s[5]: aa-aa -> 0%
p_list = [1, 1, 1, 0.75, 0.5, 0]
EV_list =[]
# A simple application of expected value.
for index, num_parents in enumerate(s):
EV_list.append(2*int(num_parents)*p_list[index])
print sum(EV_list)