-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab122.py
More file actions
38 lines (34 loc) · 1.32 KB
/
lab122.py
File metadata and controls
38 lines (34 loc) · 1.32 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
# Calculating the Net Charge of Insulin by Using Python Lists and Loops
# Exercise 1: Assigning variables, lists, and dictionaries
# Python3.6
# Coding: utf-8
# Store the human preproinsulin sequence in a variable called preproinsulin:
preproInsulin = "malwmrllpllallalwgpdpaaafvnqhlcgshlvealylvcgergffytpktrreaedlqvgqvelgggpgagslqplalegslqkrgiveqcctsicslyqlenycn"
# Store the remaining sequence elements of human insulin in variables:
lsInsulin = "malwmrllpllallalwgpdpaaa"
bInsulin = "fvnqhlcgshlvealylvcgergffytpkt"
aInsulin = "giveqcctsicslyqlenycn"
cInsulin = "rreaedlqvgqvelgggpgagslqplalegslqkr"
insulin = bInsulin + aInsulin
pkr = {'y':10.07,
'c':8.18,
'k':10.53,
'h':6.00,
'r':12.48,
'd':3.65,
'e':4.25}
# Exercise 2: Using count() to count the numbers of each amino acid
# count = float(insulin.count('y'))
# print(count)
seqcount = ({x: float(insulin.count(x)) for x in ['y', 'c', 'k', 'h', 'r', 'd', 'e']})
print(seqcount)
# Exercise 3: Writing the net charge formula
ph = 0
while ph <= 14:
netcharge = (
+(sum({x: ((seqcount[x]*(10**pkr[x]))/((10**ph)+(10**pkr[x]))) \
for x in ['k','h','r']}.values()))
-(sum({x: ((seqcount[x]*(10**ph))/((10**ph)+(10**pkr[x]))) \
for x in ['y','c','d','e']}.values())))
print('{0:.2f}'.format(ph), netcharge)
ph += 1