Ludovic PLATON

Fix missing rejection threshold for prediction

""" Test SLSOM model on ncRNA.
Usage:
predict.py --featurer=<path> --file=<path_fasta> --model=<path> --output=<path> [--keep_features]
predict.py --featurer=<path> --file=<path_fasta> --model=<path> --output=<path> [--reject=<value>] [--keep_features]
predict.py (-h | --help)
predict.py --version
......@@ -11,6 +11,7 @@ Options:
--file=<path> Path to the fasta file
--model=<path> Path to the folder containing the model
--output=<path> Path to the output dir
--reject=<value> Rejection threshold.
--keep_features Keep the features computed in the "output" folder.
--version
......@@ -27,7 +28,7 @@ from SLSOM.SOM import *
from SLSOM.util import *
def save_pred(som,data,data_names,y,proba,bmu,path):
y_label = ["Noncoding" if x==1 else "Coding" for x in y]
y_label = ["Noncoding" if x==1 else if x==0 "Coding" else "Rejected" for x in y]
res = np.array([
[data_names[i],bmu[i],y_label[i]]+[proba[i,j] for j in range(proba.shape[1])]
for i in range(data.shape[0])])
......@@ -66,6 +67,8 @@ def main():
print("Model loaded")
y,proba = ssom.predict(data)
y = np.array(y)
if not arguments["--reject"]:
y[proba < float(arguments["--reject"])] = -1
bmu = np.array(som.get_BMUS(data))
save_pred(som,data,data_names,y,proba,bmu,output_path)
......