genseq.py 文件源码

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

项目:DeepEnhancer 作者: minxueric 项目源码 文件源码
def enhchr(indexes):
    """chromosome length vs. enhancer numbers on it"""
    lens = np.array([len(sequences[keys[i]]) for i in range(24)], dtype=np.float)
    nums = np.zeros((24,))
    for index in indexes:
        chrkey = index[0]
        nums[keys.index(chrkey)] += 1
    print "The length of 24 Chromosomes are \n{}".format(np.array(lens, dtype=np.uint64))
    print "The number of enhancers on each chromosome are \n{}".format(np.array(nums, dtype=np.uint64))

    ind = np.arange(24)
    w = 0.35
    fig, ax = plt.subplots()
    rects1 = ax.bar(ind, lens / np.sum(lens), w, color='r')
    rects2 = ax.bar(ind + w, nums / np.sum(nums), w, color='y')
    ax.set_ylabel('Chrom Length & #Enhancers')
    ax.set_xticks(ind + w)
    ax.set_xticklabels(keys)
    ax.legend((rects1[0], rects2[0]), ('Chrom Length (%)', '#Enahncers (%)'))
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号