Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
SH = None
draw_tree(ax, tree, rmargin=rmargin, reroot=False, \
supportcolor="r", SH=SH, **kwargs)
root.set_xlim(0, 1)
root.set_ylim(0, 1)
root.set_axis_off()
format = iopts.format if iopts else "pdf"
dpi = iopts.dpi if iopts else 300
if n == 1:
image_name = f.rsplit(".", 1)[0] + "." + format
else:
image_name = "trees{0}.{1}".format(x, format)
image_name = op.join(outdir, image_name)
savefig(image_name, dpi=dpi, iopts=iopts)
plt.clf()
%prog qc postgenomic-s.tsv
Plot basic statistics of a given sample:
Age, Gender, Ethnicity, Cohort, Chemistry
"""
p = OptionParser(heritability.__doc__)
opts, args, iopts = p.set_image_options(args, figsize="10x6")
if len(args) != 1:
sys.exit(not p.print_help())
tsvfile, = args
df = pd.read_csv(tsvfile, sep="\t")
composite_qc(df, size=(iopts.w, iopts.h))
outfile = tsvfile.rsplit(".", 1)[0] + ".qc.pdf"
savefig(outfile)
MZ = list(get_pairs(mz))
DZ = list(get_pairs(dz))
print(len(MZ), "monozygotic twins")
print(len(DZ), "dizygotic twins")
df = pd.read_csv(combined, sep="\t", index_col=0)
df["Sample name"] = np.array(df["Sample name"], dtype=np.str)
gender = extract_trait(df, "Sample name", "hli_calc_gender")
sameGenderMZ = list(filter_same_gender(MZ, gender))
sameGenderDZ = list(filter_same_gender(DZ, gender))
composite(df, sameGenderMZ, sameGenderDZ, size=(iopts.w, iopts.h))
logging.getLogger().setLevel(logging.CRITICAL)
savefig("heritability.pdf")
p = axC.pcolormesh(C, cmap=default_cm)
axA.set_xlim(0, len(gA))
axC.set_xlim(0, len(gC))
x, y, w, h = .35, .1, .3, .05
ax_colorbar = fig.add_axes([x, y, w, h])
fig.colorbar(p, cax=ax_colorbar, orientation='horizontal')
root.text(x - d, y + h / 2, "RPKM", ha="right", va="center")
root.set_xlim(0, 1)
root.set_ylim(0, 1)
for x in (axA, axC, root):
x.set_axis_off()
image_name = "napusf4b." + iopts.format
savefig(image_name, dpi=iopts.dpi, iopts=iopts)
sbed = subset_bed(sbed, sseqids)
fig = plt.figure(1, (iopts.w, iopts.h))
root = fig.add_axes([0, 0, 1, 1]) # the whole canvas
ax = fig.add_axes([.1, .1, .8, .8]) # the dot plot
dotplot(anchorfile, qbed, sbed, fig, root, ax,
vmin=opts.vmin, vmax=opts.vmax, is_self=is_self,
synteny=opts.synteny, cmap_text=opts.cmaptext, cmap=iopts.cmap,
genomenames=opts.genomenames, sample_number=opts.sample_number,
minfont=opts.minfont, palette=palette, sep=(not opts.nosep),
title=opts.title, stdpf=(not opts.nostdpf), chpf=(not opts.nochpf))
image_name = opts.outfile or \
(op.splitext(anchorfile)[0] + "." + opts.format)
savefig(image_name, dpi=iopts.dpi, iopts=iopts)
fig.clear()
root.text(sum(xx) / 2, ypos - pad, "34,115bp", **fontprop)
xx = markers[1], begs[1]
root.plot(xx, (ypos, ypos), "-", lw=2, color=lsg)
root.text(sum(xx) / 2, ypos - pad, "81,276bp", **fontprop)
root.plot((ends[0], begs[1]), (y, y), ":", lw=2, color=lsg)
root.text(sum(markers) / 2, ypos - 3 * pad, r"$\textit{Estimated gap size: 96,433bp}$",
color="r", ha="center", va="center")
labels = ((.05, .95, 'A'), (.05, .6, 'B'), (.05, .27, 'C'))
panel_labels(root, labels)
normalize_axes(root)
pf = "estimategaps"
image_name = pf + "." + iopts.format
savefig(image_name, dpi=iopts.dpi, iopts=iopts)
root.plot((xpos, xpos), (ymax, .63), ":o", **kwargs)
root.plot((xpos, xmin), (ymax, ymin), ":o", **kwargs)
root.plot((xpos, xmax), (ymax, ymin), ":o", **kwargs)
RoundRect(root, (.06, .17), .92, .35, fill=False, lw=2, ec=light)
# Panels
root.text(.05, .95, "a", size=20, fontweight="bold")
root.text(.1, .45, "b", size=20, fontweight="bold")
root.set_xlim(0, 1)
root.set_ylim(0, 1)
root.set_axis_off()
pf = "cotton"
image_name = pf + "." + iopts.format
savefig(image_name, dpi=iopts.dpi, iopts=iopts)
line, = ax.plot(x, y, '-', color=c, lw=2, alpha=.5)
lines.append(line)
legends.append(legend)
leg = ax.legend(lines, legends, shadow=True, fancybox=True)
leg.get_frame().set_alpha(.5)
ylabel = "Average depth per {0}Kb".format(size / bins / 1000)
ax.set_xlim(0, size)
ax.set_ylim(0, opts.ymax)
ax.set_xlabel(ctg)
ax.set_ylabel(ylabel)
set_human_base_axis(ax)
figname ="{0}.{1}.pdf".format(fastafile, ctg)
savefig(figname, dpi=iopts.dpi, iopts=iopts)
# Delete unused axes
for ax in axes[len(loci):]:
ax.set_axis_off()
root = fig.add_axes([0, 0, 1, 1])
pad = .03
if not opts.nopanels:
panel_labels(root, ((pad / 2, 1 - pad, "A"), (.5 + pad, 1 - pad, "B"),
(pad / 2, 2 / 3. - pad / 2, "C"), (.5 + pad, 2 / 3. - pad / 2, "D"),
(pad / 2, 1 / 3. , "E"), (.5 + pad, 1 / 3. , "F"),
))
normalize_axes(root)
image_name = "allelefreq." + iopts.format
savefig(image_name, dpi=iopts.dpi, iopts=iopts)
)
tx = df["BinStart"]
A, B, label = fit_power_law(tx, df["LinkDensity"])
ty = A * tx ** B
ax.plot(tx, ty, "r:", lw=3, label=label)
ax.legend()
if opts.title:
ax.set_title(markup(opts.title))
ax.set_xlabel("Link size (bp)")
ax.set_ylabel("Density (\# of links per bp)")
ax.set_xscale("log", nonposx="clip")
ax.set_yscale("log", nonposy="clip")
ax.xaxis.set_major_formatter(human_base_formatter)
image_name = pf + "." + opts.format
savefig(image_name, dpi=iopts.dpi, iopts=iopts)