本文整理汇总了Python中jcvi.formats.bed.Bed.split方法的典型用法代码示例。如果您正苦于以下问题:Python Bed.split方法的具体用法?Python Bed.split怎么用?Python Bed.split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jcvi.formats.bed.Bed
的用法示例。
在下文中一共展示了Bed.split方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: composite
# 需要导入模块: from jcvi.formats.bed import Bed [as 别名]
# 或者: from jcvi.formats.bed.Bed import split [as 别名]
def composite(args):
"""
%prog composite fastafile chr1
Combine line plots, feature bars and alt-bars, different data types
specified in options. Inputs must be BED-formatted. Three types of viz are
currently supported:
--lines: traditional line plots, useful for plotting feature freq
--bars: show where the extent of features are
--altbars: similar to bars, yet in two alternating tracks, e.g. scaffolds
"""
from jcvi.graphics.chromosome import HorizontalChromosome
p = OptionParser(composite.__doc__)
p.add_option("--lines",
help="Features to plot in lineplot [default: %default]")
p.add_option("--bars",
help="Features to plot in bars [default: %default]")
p.add_option("--altbars",
help="Features to plot in alt-bars [default: %default]")
p.add_option("--fatten", default=False, action="store_true",
help="Help visualize certain narrow features [default: %default]")
p.add_option("--mode", default="span", choices=("span", "count", "score"),
help="Accumulate feature based on [default: %default]")
add_window_options(p)
opts, args, iopts = p.set_image_options(args, figsize="8x5")
if len(args) != 2:
sys.exit(not p.print_help())
fastafile, chr = args
window, shift, subtract = check_window_options(opts)
linebeds, barbeds, altbarbeds = [], [], []
fatten = opts.fatten
if opts.lines:
lines = opts.lines.split(",")
linebeds = get_beds(lines)
if opts.bars:
bars = opts.bars.split(",")
barbeds = get_beds(bars)
if opts.altbars:
altbars = opts.altbars.split(",")
altbarbeds = get_beds(altbars)
linebins = get_binfiles(linebeds, fastafile, shift, mode=opts.mode)
margin = .12
clen = Sizes(fastafile).mapping[chr]
nbins = get_nbins(clen, shift)
plt.rcParams["xtick.major.size"] = 0
plt.rcParams["ytick.major.size"] = 0
fig = plt.figure(1, (iopts.w, iopts.h))
root = fig.add_axes([0, 0, 1, 1])
root.text(.5, .95, chr, ha="center", color="darkslategray")
xstart, xend = margin, 1 - margin
xlen = xend - xstart
ratio = xlen / clen
# Line plots
ax = fig.add_axes([xstart, .6, xlen, .3])
lineplot(ax, linebins, nbins, chr, window, shift)
# Bar plots
yy = .5
yinterval = .08
xs = lambda x: xstart + ratio * x
r = .01
fattend = .0025
for bb in barbeds:
root.text(xend + .01, yy, bb.split(".")[0], va="center")
HorizontalChromosome(root, xstart, xend, yy, height=.02)
bb = Bed(bb)
for b in bb:
start, end = xs(b.start), xs(b.end)
span = end - start
if fatten and span < fattend:
span = fattend
root.add_patch(Rectangle((start, yy - r), span, 2 * r, \
lw=0, fc="darkslategray"))
yy -= yinterval
# Alternative bar plots
offset = r / 2
for bb in altbarbeds:
root.text(xend + .01, yy, bb.split(".")[0], va="center")
bb = Bed(bb)
for i, b in enumerate(bb):
start, end = xs(b.start), xs(b.end)
span = end - start
if span < .0001:
continue
offset = -offset
root.add_patch(Rectangle((start, yy + offset), end - start, .003, \
lw=0, fc="darkslategray"))
yy -= yinterval
#.........这里部分代码省略.........