Пример #1
0
coverage = np.array(cov_list)
position = np.array(pos_list)

hda = list(chain.from_iterable(hdata))
start = min(position)
end = max(position)
pos_space = np.linspace(start, end, end-start)

kde = gaussian_kde(hda)
kde_pdf = kde.evaluate(pos_space)

fig = plt.figure()
# TODO: make this args
#fig.patch.set_alpha(0)

ax = fig.add_subplot(111)
# TODO: Make normed an args
hist, bis, patches = rhist(ax, np.array(hda), normed=True, facecolor="#dc322f", edgecolor='#dc322f', alpha=0.2)

# scale signal
new_max = max(hist)
kde_pdf = kde_pdf / max(kde_pdf) * new_max

plot(pos_space, kde_pdf, color='#268bd2', alpha=0.8)
ax.legend()
ax.set_xlabel('HSR1 nt')
ax.set_ylabel('Coverage')
ax.title.set_fontsize(18)
ax.fill_between(pos_space, kde_pdf, color="#268bd2", alpha=0.4)
rstyle(ax)
show()
Пример #2
0
fig = plt.figure()

if args.transparent:
    fig.patch.set_alpha(0)

ax = fig.add_subplot(111)
defaults = {
    'facecolor': '#dc322f',
    'edgecolor': '#dc322f',
    'alpha': 0.2,
    }
if args.normed:
    defaults.update({'normed': True,})

hist, bis, patches = rhist(ax, np.array(hdata), **defaults)

ax.legend()
ax.set_xlabel('nt')
ax.set_ylabel('Coverage')
ax.title.set_fontsize(18)
if args.kde:
    kde = gaussian_kde(np.array(hdata))
    kde_pdf = kde.evaluate(pos_space)
    # TODO: Implement scaling as a separate funcion
    new_max = max(hist)
    kde_pdf = kde_pdf / max(kde_pdf) * new_max
    plot(pos_space, kde_pdf, color='#268bd2', alpha=0.8)
    ax.fill_between(pos_space, kde_pdf, color="#268bd2", alpha=0.4)
rstyle(ax)
show()