mainPEP.py 文件源码

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

项目:PEP 作者: ma-compbio 项目源码 文件源码
def run_motif(type,cell,thresh_mode):

    warnings.filterwarnings("ignore")

    print "cross_validation_training"
    print "motif features used"

    # Read data
    filename = "./pairs_%s%s_motif.mat"%(str(type),str(cell))
    data = scipy.io.loadmat(filename)
    x = np.asmatrix(data['seq_m'])
    y = np.ravel(data['lab_m'])
    y[y<0]=0
    print "Positive: %d  Negative: %d" % (sum(y==1), sum(y==0))

    k_fold = 10
    if thresh_mode==0:
        k_fold1 = 0
    elif thresh_mode==1:
        k_fold1 = 1
    else:
        k_fold1 = 5
    metrics_vec, pred, predicted, features1 = parametered_cv(x,y,k_fold,k_fold1,serial)

    filename1 = "test_%s%s_motiflab.txt"%(str(type), str(cell))
    filename2 = "test_%s%s_motifprob.txt"%(str(type), str(cell))
    filename3 = "test_%s%s_motiffeature.txt"%(str(type), str(cell))
    np.savetxt(filename1, pred, fmt='%d %d %d', delimiter='\t')
    np.savetxt(filename2, predicted, fmt='%f %f', delimiter='\t')
    np.savetxt(filename3, features1, fmt='%d %f', delimiter='\t')
    filename4 = "test_%s%s_motifthresh2.txt"%(str(type), str(cell))
    np.savetxt(filename4, metrics_vec, fmt='%f %f %f %f %f', delimiter='\t')

# Cross validation for PEP-Integrate
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号