def run_auc(job, context, name, compare_id):
"""
AUC of roc plot.
ROC plot is defined with mismapped reads being negatives, correctly-mapped
reads being positives, and AUC expressing how good of a classifier of
correctly-mapped-ness the MAPQ score is. It says nothing about how well the
reads are actually mapped.
"""
if not have_sklearn:
return ["sklearn_not_installed"] * 2
work_dir = job.fileStore.getLocalTempDir()
compare_file = os.path.join(work_dir, '{}.compare.positions'.format(name))
job.fileStore.readGlobalFile(compare_id, compare_file)
try:
data = np.loadtxt(compare_file, dtype=np.int, delimiter =', ', usecols=(1,2)).T
auc = roc_auc_score(data[0], data[1])
aupr = average_precision_score(data[0], data[1])
except:
# will happen if file is empty
auc, aupr = 0, 0
return auc, aupr
评论列表
文章目录