Skip to content

Commit ab2882d

Browse files
committed
bug fix
1 parent 600eb30 commit ab2882d

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

pipred.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,14 @@
8888
exit()
8989
try:
9090
parsed_pssm = np.genfromtxt(pssm_fn, skip_header=3, skip_footer=5, usecols=(i for i in range(2, 22)))
91+
if parsed_pssm.shape[0] == len(seq) - 2:
92+
parsed_pssm = np.genfromtxt(pssm_fn, skip_header=3, skip_footer=3, usecols=(i for i in range(2, 22)))
93+
9194
except ValueError:
9295
print("ERROR: Malformed PSSM file for entry %s!" % entry)
9396
exit()
9497

95-
if not parsed_pssm.shape[0] == len(seq) and parsed_pssm.shape[1] == 20:
96-
if parsed_pssm.shape[0] == len(seq)-2:
97-
parsed_pssm = np.genfromtxt(pssm_fn, skip_header=3, skip_footer=3, usecols=(i for i in range(2, 22)))
98-
else:
99-
print("ERROR: Malformed PSSM file for entry %s!" % entry)
100-
exit()
98+
10199
pssm_files.append(pssm_fn)
102100

103101
print("Encoding sequences...")

utils.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,10 @@ def enc_pssm(pssm_file, pad_length=None, pad_left=0):
7171
return pssm_matrix
7272

7373
# Decodes predictions (takes into the account padding of sequence)
74-
def decode(pred, enc_seq):
75-
decoded_pred = []
76-
for pos_pred, pos_seq in zip(pred, enc_seq):
77-
if not np.array_equal(pos_seq, np.zeros(40)):
78-
decoded_pred.append(pos_pred)
79-
return np.asarray(decoded_pred)
74+
def decode(pred, enc_sec):
75+
return pred[np.any(enc_sec, axis=-1), :]
76+
77+
8078

8179
# Pipred model architecture
8280
def PiPred_Model():

0 commit comments

Comments
 (0)