motifs.py 文件源码

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

项目:mbin 作者: fanglab 项目源码 文件源码
def transpose_contig_matrix( args ):
    contig  = args[0]
    opts    = args[1]
    logging.info("  Transposing %s" % contig)
    contig_ipds_fn       = os.path.join( opts.tmp, "%s_ipds.tmp"       % contig)
    contig_ipds_kmers_fn = os.path.join( opts.tmp, "%s_ipdskmers.tmp"  % contig)
    contig_ipds_N_fn     = os.path.join( opts.tmp, "%s_ipdsN.tmp"      % contig)
    contig_ipds          = np.loadtxt(contig_ipds_fn,       dtype="float")
    contig_ipds_kmers    = np.loadtxt(contig_ipds_kmers_fn, dtype="str")
    contig_ipds_N        = np.loadtxt(contig_ipds_N_fn,     dtype="int")
    if len(contig_ipds.shape)==1:
        contig_ipds   = contig_ipds.reshape(1,contig_ipds.shape[0])
        contig_ipds_N = contig_ipds_N.reshape(1,contig_ipds_N.shape[0])

    contig_ipds    = contig_ipds.T
    contig_ipds_N  = contig_ipds_N.T
    np.savetxt(contig_ipds_fn+".trans",   contig_ipds,   fmt="%.4f", delimiter="\t")
    np.savetxt(contig_ipds_N_fn+".trans", contig_ipds_N, fmt="%s",   delimiter="\t")
    return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号