vg_mapeval.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:toil-vg 作者: vgteam 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号