forked from gmaline/SeniorProject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.py
43 lines (36 loc) · 1.45 KB
/
helper.py
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
# Commonly used data for protein names
protein_names = ["thiolase", "beta hydroxybutyryl-CoA dehydrogenase",
"crotonase", "butyryl-CoA dehydrogenase",
"electron transfer flavoprotein alpha-subunit",
"electron transfer flavoprotein beta-subunit",
"butyryl-COA-transferase", "phoasephate butyryltransferase",
"butyrate kinase"]
protein_namesCore = ["thiolase", "beta hydroxybutyryl-CoA dehydrogenase",
"crotonase", "butyryl-CoA dehydrogenase",
"electron transfer flavoprotein alpha-subunit",
"electron transfer flavoprotein beta-subunit"]
protein_namesBCT = ["butyryl-COA-transferase"]
protein_namesBK = ["phoasephate butyryltransferase", "butyrate kinase"]
# Commonly used small helper methods.
def dict_contains(check_key, dict):
for key in dict.keys():
if key == check_key:
return True
return False
def has_protein(list, check_protein, threshold):
for x in list:
if x[0] == check_protein and x[1] > threshold:
return True
return False
def highest_identity(list, check_protein):
highest = 0
for x in list:
if x[0] == check_protein:
if x[1] > highest:
highest = x[1]
return highest
def reaches_threshold(list, threshold):
for x in list:
if x[1] > threshold:
return True
return False