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()
评论列表
文章目录