import os import sys import time import numpy import theano import theano.tensor as T from theano.tensor.shared_randomstreams import RandomStreams from pprint import pprint from scipy.io import matlab import re import math from theano import shared from collections import OrderedDict from layers import * from theano.misc.pkl_utils import dump import numpy as np from io_utils_MUV_ROC import * from mol_graph import * from process_poc_pretrain import * def eval_ER_MUV(target,thres): ER_5pt=0 ER_one=0 ER_two=0 ER_five=0 total_count=0 pro_name = target PDB_ID = PDB_dict[target] Weights_ID = 'MUV_fix0_assay_nodec_e_1_190000_drop_041519' y_true_4 = numpy.load('../MUV_results_0408/test_labels_'+Weights_ID+'_'+pro_name+'_'+PDB_ID+'.dat') y_prob_4 = numpy.load('../MUV_results_0408/test_probs_'+Weights_ID+'_'+pro_name+'_'+PDB_ID+'.dat') y_true = y_true_4 y_prob = y_prob_4 #+ y_prob_3 from sklearn import metrics from sklearn.metrics import roc_auc_score from sklearn.metrics import confusion_matrix pos = numpy.where(y_prob>=thres) y_pred = numpy.zeros(y_prob.shape) y_pred[pos]=1 tn, fp, fn, tp = confusion_matrix(y_true, y_pred).ravel() fpr = float(fp) / (fp+tn) tpr = float(tp) / (tp+fn) print (pro_name) print ("fpr") print (fpr) print ("tpr") print (tpr) print ("RE") print (tpr/fpr) if __name__ == '__main__': fold_dict = {'846':0,'600':0,'692':1,'859':1,'548':2,'852':2,'466':4,'689':4,'832':5} PDB_dict = {'859':'5cxv','733':'1u9e','692':'1yow','832':'1au8','689':'2y6o','852':'4xe4','466':'3v2y','548':'3poo','713':'5tn7','600':'1yow','846':'5exm'} target = sys.argv[1] thres = float(sys.argv[2]) eval_ER_MUV(target,thres)