This repository was archived by the owner on Jul 16, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexplorepredictionwrapper.py
More file actions
78 lines (53 loc) · 3.27 KB
/
Copy pathexplorepredictionwrapper.py
File metadata and controls
78 lines (53 loc) · 3.27 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
####################################################################################################
# #
# PROJECT Protein Adaptation #
# CLASS ExplorePredictionWrapper #
# PROGRAMMER Jeremy Adams #
# STARTED 09-12-14 #
# LASTMOD 09-12-14 #
# #
# DESCRIPTION class to generate potentially multiple set of figures for all ancestral, #
# derived, PDB sequence triads that are significant hits #
# #
####################################################################################################
from exploreprediction import ExplorePrediction
from staticmethods import getCombinedPValue
import os
class ExplorePredictionWrapper:
"""
Class attributes:
Directory (String): Directory to the analyzed protein family of interest
PValueFile (String): Path to the P-value file
SigPValues_L (List): List of all derived clades of interest that had a significant combined P-value
"""
"CONSTRUCTOR"
def __init__(self, Directory):
#sets the directory and checks if it ends with a "/"
self.Directory = Directory
if self.Directory.endswith("/"):
pass
else:
self.Directory = self.Directory+"/"
#makes the figures directory if it does not already exist
if os.path.exists(self.Directory+"Figures"):
pass
else:
os.system("mkdir " +self.Directory+"Figures")
self.PValueFile = self.Directory+"PValues.txt" #sets the path to the p-value file
self.SigPValues_L = self.getSigPValues() #gets significant clades of interest
self.explorePredictions() #instantiates an explore prediction class for each clade that was a significant hit
"method to get clades that are significant hits according to the algorithm"
def getSigPValues(self):
R = []
#for each p-value line in the file
for line in [line.replace("\n","") for line in open(self.PValueFile,"r").readlines()][1:]:
#executes the combined p-value method and checks if the combined value is less than 0.05
ls = line.split()
PValue = float(ls[-1])
if PValue <= 0.05:
R.append([ls[0].split(">>")[1] , ls[1]])
return R
"method to instantiate an ExplorePrediction class for each significant hit"
def explorePredictions(self):
for pred in self.SigPValues_L:
ExplorePrediction(self.Directory , pred[0] , pred[1])