code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
p = OptionParser(error.__doc__)
opts, args = p.parse_args(args)
if len(args) != 2:
sys.exit(not p.print_help())
version, backup_folder = args
mkdir(backup_folder)
fw = open("errors.log", "w")
seen = set()
for g in glob("../5-consensus/*.err"):
if "partitioned" in... | def error(args) | %prog error version backup_folder
Find all errors in ../5-consensus/*.err and pull the error unitigs into
backup/ folder. | 4.502097 | 3.453841 | 1.303504 |
p = OptionParser(trace.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(p.print_help())
s, = args
version, partID, unitigID = get_ID(s)
flist = glob("../5-consensus/*_{0:03d}.err".format(int(partID)))
assert len(flist) == 1
fp = open(flist[0])
ins... | def trace(args) | %prog trace unitig{version}.{partID}.{unitigID}
Call `grep` to get the erroneous fragment placement. | 4.325444 | 3.63393 | 1.190294 |
from jcvi.formats.base import SetFile
p = OptionParser(cut.__doc__)
p.add_option("-s", dest="shredafter", default=False, action="store_true",
help="Shred fragments after the given fragID [default: %default]")
p.add_option("--notest", default=False, action="store_true",
... | def cut(args) | %prog cut unitigfile fragID
Cut the unitig at a given fragment. Run `%prog trace unitigfile` first to
see which fragment breaks the unitig. | 3.708344 | 3.270413 | 1.133907 |
p = OptionParser(shred.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
s, = args
u = UnitigLayout(s)
u.shred()
u.print_to_file(inplace=True) | def shred(args) | %prog shred unitigfile
Shred the unitig into one fragment per unitig to fix. This is the last
resort as a desperate fix. | 3.550711 | 2.831628 | 1.253947 |
p = OptionParser(pull.__doc__)
opts, args = p.parse_args(args)
if len(args) != 3:
sys.exit(not p.print_help())
prefix = get_prefix()
version, partID, unitigID = args
s = ".".join(args)
cmd = "tigStore"
cmd += " -g ../{0}.gkpStore -t ../{0}.tigStore".format(prefix)
cmd... | def pull(args) | %prog pull version partID unitigID
For example, `%prog pull 5 530` will pull the utg530 from partition 5
The layout is written to `unitig530` | 6.408407 | 4.927637 | 1.300503 |
p = OptionParser(push.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
s, = args
prefix = get_prefix()
version, partID, unitigID = get_ID(s)
cmd = "tigStore"
cmd += " -g ../{0}.gkpStore -t ../{0}.tigStore".format(prefix)
cmd += ... | def push(args) | %prog push unitig{version}.{partID}.{unitigID}
For example, `%prog push unitig5.530` will push the modified `unitig530`
and replace the one in the tigStore | 6.489043 | 4.345288 | 1.493351 |
p = OptionParser(pushall.__doc__)
opts, args = p.parse_args(args)
if len(args) < 1:
sys.exit(not p.print_help())
flist = args
for f in flist:
if f.endswith(".log"):
continue
push([f]) | def pushall(args) | %prog pushall unitig1.*
Push a bunch of unitig layout changes. | 2.942125 | 2.848445 | 1.032888 |
p = OptionParser(pomegranate.__doc__)
opts, args, iopts = p.set_image_options(args, figsize="9x7")
if len(args) != 5:
sys.exit(not p.print_help())
seqidsfile, klayout, datafile, bedfile, slayout = args
fig = plt.figure(1, (iopts.w, iopts.h))
root = fig.add_axes([0, 0, 1, 1])
... | def pomegranate(args) | %prog cotton seqids karyotype.layout mcscan.out all.bed synteny.layout
Build a figure that calls graphics.karyotype to illustrate the high ploidy
of WGD history of pineapple genome. The script calls both graphics.karyotype
and graphic.synteny. | 3.30592 | 2.730197 | 1.210872 |
p = OptionParser(birch.__doc__)
opts, args, iopts = p.set_image_options(args, figsize="8x6")
if len(args) != 2:
sys.exit(not p.print_help())
seqids, layout = args
fig = plt.figure(1, (iopts.w, iopts.h))
root = fig.add_axes([0, 0, 1, 1])
K = Karyotype(fig, root, seqids, layout... | def birch(args) | %prog birch seqids layout
Plot birch macro-synteny, with an embedded phylogenetic tree to the right. | 2.777821 | 2.594034 | 1.07085 |
from jcvi.graphics.dotplot import check_beds, dotplot
p = OptionParser(mtdotplots.__doc__)
p.set_beds()
opts, args, iopts = p.set_image_options(args, figsize="16x8", dpi=90)
if len(args) != 3:
sys.exit(not p.print_help())
a, b, ac = args
fig = plt.figure(1, (iopts.w, iopts.h)... | def mtdotplots(args) | %prog mtdotplots Mt3.5 Mt4.0 medicago.medicago.lifted.1x1.anchors
Plot Mt3.5 and Mt4.0 side-by-side. This is essentially combined from two
graphics.dotplot() function calls as panel A and B. | 2.247959 | 2.097967 | 1.071494 |
p = OptionParser(oropetium.__doc__)
p.add_option("--extra", help="Extra features in BED format")
opts, args, iopts = p.set_image_options(args, figsize="9x6")
if len(args) != 4:
sys.exit(not p.print_help())
datafile, bedfile, slayout, switch = args
fig = plt.figure(1, (iopts.w, iop... | def oropetium(args) | %prog oropetium mcscan.out all.bed layout switch.ids
Build a composite figure that calls graphis.synteny. | 3.237121 | 3.106246 | 1.042133 |
p = OptionParser(amborella.__doc__)
p.add_option("--tree",
help="Display trees on the bottom of the figure [default: %default]")
p.add_option("--switch",
help="Rename the seqid with two-column file [default: %default]")
opts, args, iopts = p.set_image_options(args,... | def amborella(args) | %prog amborella seqids karyotype.layout mcscan.out all.bed synteny.layout
Build a composite figure that calls graphics.karyotype and graphics.synteny. | 3.930954 | 3.412042 | 1.152083 |
p = OptionParser(cotton.__doc__)
p.add_option("--depthfile",
help="Use depth info in this file [default: %default]")
p.add_option("--switch",
help="Rename the seqid with two-column file [default: %default]")
opts, args, iopts = p.set_image_options(args, figsize="8x... | def cotton(args) | %prog cotton seqids karyotype.layout mcscan.out all.bed synteny.layout
Build a composite figure that calls graphics.karyotype and graphic.synteny. | 3.418792 | 3.184576 | 1.073547 |
trackgap = .06
tracklen = .12
xa, xb = x - tracklen, x + tracklen
ya, yb = y + trackgap, y - trackgap
hsps = (((60, 150), (50, 130)),
((190, 225), (200, 240)),
((330, 280), (360, 310)))
for yy in (ya, yb):
ax.plot((xa, xb), (yy, yy), "-", color="gray", lw=2, z... | def plot_diagram(ax, x, y, label="S", title="syntenic", gradient=True) | Part of the diagrams that are re-used. (x, y) marks the center of the
diagram. Label determines the modification to the "S" graph. | 3.265697 | 3.233669 | 1.009905 |
p = OptionParser(__doc__)
opts, args = p.parse_args()
fig = plt.figure(1, (6, 4))
root = fig.add_axes([0, 0, 1, 1])
# Separators
linestyle = dict(lw=2, color="b", alpha=.2, zorder=2)
root.plot((0, 1), (.5, .5), "--", **linestyle)
for i in (1./3, 2./3):
root.plot((i, i), (.... | def epoch(args) | %prog epoch
Illustrate the methods used in Maggie's epoch paper, in particular, how to
classifiy S/G/F/FB/FN for the genes. | 3.089583 | 2.89167 | 1.068442 |
from jcvi.formats.agp import AGP, bed, tidy
p = OptionParser(annotate.__doc__)
p.add_option("--minsize", default=200,
help="Smallest component size [default: %default]")
opts, args = p.parse_args(args)
if len(args) != 3:
sys.exit(not p.print_help())
agpfile, link... | def annotate(args) | %prog annotate agpfile gaps.linkage.bed assembly.fasta
Annotate AGP file with linkage info of `paired-end` or `map`.
File `gaps.linkage.bed` is generated by assembly.gaps.estimate(). | 3.174102 | 2.95804 | 1.073043 |
from collections import defaultdict
from jcvi.formats.bed import intersectBed_wao
from jcvi.formats.posmap import MatesFile
p = OptionParser(estimate.__doc__)
p.add_option("--minlinks", default=3, type="int",
help="Minimum number of links to place [default: %default]")
opt... | def estimate(args) | %prog estimate gaps.bed all.spans.bed all.mates
Estimate gap sizes based on mate positions and library insert sizes. | 3.368481 | 3.09596 | 1.088025 |
from jcvi.formats.base import DictFile
from jcvi.apps.align import blast
p = OptionParser(sizes.__doc__)
opts, args = p.parse_args(args)
if len(args) != 3:
sys.exit(not p.print_help())
gapsbed, afasta, bfasta = args
pf = gapsbed.rsplit(".", 1)[0]
extbed = pf + ".ext.bed"
... | def sizes(args) | %prog sizes gaps.bed a.fasta b.fasta
Take the flanks of gaps within a.fasta, map them onto b.fasta. Compile the
results to the gap size estimates in b. The output is detailed below:
Columns are:
1. A scaffold
2. Start position
3. End position
4. Gap identifier
5. Gap size in A (= ... | 3.841211 | 3.584246 | 1.071693 |
p = OptionParser(flanks.__doc__)
p.add_option("--extend", default=2000, type="int",
help="Extend seq flanking the gaps [default: %default]")
opts, args = p.parse_args(args)
if len(args) != 2:
sys.exit(not p.print_help())
gapsbed, fastafile = args
Ext = opts.extend... | def flanks(args) | %prog flanks gaps.bed fastafile
Create sequences flanking the gaps. | 2.545047 | 2.349674 | 1.083149 |
p = OptionParser(main.__doc__)
p.add_option("--format", default=" \'6 qseqid sseqid pident length " \
"mismatch gapopen qstart qend sstart send evalue bitscore\' ",
help="0-11, learn more with \"blastp -help\". [default: %default]")
p.add_option("--path", dest="blast_path", def... | def main() | %prog database.fa query.fa [options]
Wrapper for NCBI BLAST+. | 3.379375 | 3.246794 | 1.040835 |
p = OptionParser(index.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(p.print_help())
frgscffile, = args
gzfile = frgscffile + ".gz"
cmd = "bgzip -c {0}".format(frgscffile)
if not op.exists(gzfile):
sh(cmd, outfile=gzfile)
tbifile = gzfile ... | def index(args) | %prog index frgscf.sorted
Compress frgscffile.sorted and index it using `tabix`. | 3.571834 | 2.774478 | 1.28739 |
p = OptionParser(query.__doc__)
opts, args = p.parse_args(args)
if len(args) != 2:
sys.exit(p.print_help())
frgscffile, region = args
gzfile = frgscffile + ".gz"
tbifile = gzfile + ".tbi"
outfile = region + ".posmap"
if not (op.exists(gzfile) and op.exists(tbifile)):
... | def query(args) | %prog query frgscf.sorted scfID:start-end
Query certain region to get frg placement, using random access. Build index
if not present. | 3.556906 | 2.957788 | 1.202556 |
p = OptionParser(reads.__doc__)
p.add_option("-p", dest="prefix_length", default=4, type="int",
help="group the reads based on the first N chars [default: %default]")
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(p.print_help())
frgscffile, = args
prefix_... | def reads(args) | %prog reads frgscffile
Report read counts per scaffold (based on frgscf). | 3.508725 | 3.00685 | 1.16691 |
p = OptionParser(bed.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
frgscffile, = args
bedfile = frgscffile.rsplit(".", 1)[0] + ".bed"
fw = open(bedfile, "w")
fp = open(frgscffile)
for row in fp:
f = FrgScfLine(row)
... | def bed(args) | %prog bed frgscffile
Convert the frgscf posmap file to bed format. | 3.051165 | 2.471297 | 1.234641 |
p = OptionParser(dup.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(p.print_help())
frgscffile, = args
fp = open(frgscffile)
data = [FrgScfLine(row) for row in fp]
# we need to separate forward and reverse reads, because the position
# collisions are... | def dup(args) | %prog dup frgscffile
Use the frgscf posmap file as an indication of the coverage of the library.
Large insert libraries are frequently victims of high levels of redundancy. | 2.692125 | 2.424886 | 1.110207 |
x, y = zip(*cluster)[:2]
return min(len(set(x)), len(set(y))) | def _score(cluster) | score of the cluster, in this case, is the number of non-repetitive matches | 5.035396 | 4.987967 | 1.009509 |
filtered_blast = []
seen = set()
bl = Blast(blast_file)
for b in bl:
query, subject = b.query, b.subject
if query == subject:
continue
if ostrip:
query, subject = gene_name(query), gene_name(subject)
if query not in qorder or subject not in so... | def read_blast(blast_file, qorder, sorder, is_self=False, ostrip=True) | Read the blast and convert name into coordinates | 3.386809 | 3.399628 | 0.996229 |
all_anchors = defaultdict(list)
nanchors = 0
anchor_to_block = {}
for a, b, idx in ac.iter_pairs(minsize=minsize):
if a not in qorder or b not in sorder:
continue
qi, q = qorder[a]
si, s = sorder[b]
pair = (qi, si)
all_anchors[(q.seqid, s.seqid)... | def read_anchors(ac, qorder, sorder, minsize=0) | anchors file are just (geneA, geneB) pairs (with possible deflines) | 3.016659 | 2.900795 | 1.039942 |
clusters = Grouper()
n = len(points)
points.sort()
for i in range(n):
for j in range(i - 1, -1, -1):
# x-axis distance
del_x = points[i][0] - points[j][0]
if del_x > xdist:
break
# y-axis distance
del_y = points[i][... | def synteny_scan(points, xdist, ydist, N) | This is the core single linkage algorithm which behaves in O(n):
iterate through the pairs, foreach pair we look back on the
adjacent pairs to find links | 3.362789 | 3.413328 | 0.985194 |
chr_pair_points = group_hits(points)
clusters = []
for chr_pair in sorted(chr_pair_points.keys()):
points = chr_pair_points[chr_pair]
clusters.extend(synteny_scan(points, xdist, ydist, N))
return clusters | def batch_scan(points, xdist=20, ydist=20, N=5) | runs synteny_scan() per chromosome pair | 4.255176 | 3.241607 | 1.312675 |
from scipy.spatial import cKDTree
points = np.array(points, dtype=int)
ppoints = points[:, :2] if points.shape[1] > 2 else points
tree = cKDTree(anchors, leafsize=16)
#print tree.data
dists, idxs = tree.query(ppoints, p=1, distance_upper_bound=dist)
for point, dist, idx in zip(points,... | def synteny_liftover(points, anchors, dist) | This is to get the nearest anchors for all the points (useful for the
`liftover` operation below). | 3.638551 | 3.527097 | 1.031599 |
p.set_beds()
p.add_option("--dist", default=dist, type="int",
help="Extent of flanking regions to search [default: %default]")
opts, args = p.parse_args(args)
if len(args) != 2:
sys.exit(not p.print_help())
blast_file, anchor_file = args
return blast_file, anchor_fil... | def add_options(p, args, dist=10) | scan and liftover has similar interfaces, so share common options
returns opts, files | 3.637511 | 3.800032 | 0.957232 |
from jcvi.algorithms.ec import GA_setup, GA_run
p = OptionParser(layout.__doc__)
p.set_beds()
p.set_cpus(cpus=32)
opts, args = p.parse_args(args)
if len(args) != 3:
sys.exit(not p.print_help())
simplefile, qseqids, sseqids = args
qbed, sbed, qorder, sorder, is_self = chec... | def layout(args) | %prog layout query.subject.simple query.seqids subject.seqids
Compute optimal seqids order in a second genome, based on seqids on one
genome, given the pairwise blocks in .simple format. | 3.510069 | 3.215974 | 1.091448 |
p = OptionParser(fromaligns.__doc__)
p.set_outfile()
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
alignsfile, = args
fp = must_open(alignsfile)
fw = must_open(opts.outfile, "w")
for row in fp:
if row.startswith("## Alignment"):
... | def fromaligns(args) | %prog fromaligns out.aligns
Convert aligns file (old MCscan output) to anchors file. | 2.784593 | 2.594113 | 1.073428 |
p = OptionParser(mcscanq.__doc__)
p.add_option("--color", help="Add color highlight, used in plotting")
p.add_option("--invert", default=False, action="store_true",
help="Invert query and subject [default: %default]")
opts, args = p.parse_args(args)
if len(args) < 2:
s... | def mcscanq(args) | %prog mcscanq query.ids blocksfile
Query multiple synteny blocks to get the closest alignment feature. Mostly
used for 'highlighting' the lines in the synteny plot, drawn by
graphics.karyotype and graphics.synteny. | 3.641677 | 3.108229 | 1.171624 |
from jcvi.algorithms.graph import merge_paths
from jcvi.utils.cbook import uniqify
p = OptionParser(spa.__doc__)
p.add_option("--unmapped", default=False, action="store_true",
help="Include unmapped scaffolds in the list [default: %default]")
opts, args = p.parse_args(args)
... | def spa(args) | %prog spa spafiles
Convert chromosome ordering from SPA to simple lists. First column is the
reference order. | 2.633211 | 2.560175 | 1.028528 |
p = OptionParser(rebuild.__doc__)
p.add_option("--header", default=False, action="store_true",
help="First line is header [default: %default]")
p.add_option("--write_blast", default=False, action="store_true",
help="Get blast records of rebuilt anchors [default: %defau... | def rebuild(args) | %prog rebuild blocksfile blastfile
Rebuild anchors file from pre-built blocks file. | 3.30768 | 2.814394 | 1.175272 |
p = OptionParser(coge.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
cogefile, = args
fp = must_open(cogefile)
cogefile = cogefile.replace(".gz", "")
ksfile = cogefile + ".ks"
anchorsfile = cogefile + ".anchors"
fw_ks = must_op... | def coge(args) | %prog coge cogefile
Convert CoGe file to anchors file. | 3.352454 | 3.099933 | 1.08146 |
p = OptionParser(matrix.__doc__)
p.add_option("--seqids", help="File with seqids [default: %default]")
opts, args = p.parse_args(args)
if len(args) != 3:
sys.exit(not p.print_help())
bedfile, anchorfile, matrixfile = args
ac = AnchorFile(anchorfile)
seqidsfile = opts.seqids
... | def matrix(args) | %prog matrix all.bed anchorfile matrixfile
Make oxford grid based on anchors file. | 2.69564 | 2.521209 | 1.069186 |
p = OptionParser(screen.__doc__)
p.set_beds()
p.add_option("--ids", help="File with block IDs (0-based) [default: %default]")
p.add_option("--seqids", help="File with seqids [default: %default]")
p.add_option("--seqpairs", help="File with seqpairs [default: %default]")
p.add_option("--noin... | def screen(args) | %prog screen anchorfile newanchorfile --qbed=qbedfile --sbed=sbedfile [options]
Extract subset of blocks from anchorfile. Provide several options:
1. Option --ids: a file with IDs, 0-based, comma separated, all in one line.
2. Option --seqids: only allow seqids in this file.
3. Option --seqpairs: only... | 2.586671 | 2.245147 | 1.152117 |
from jcvi.utils.cbook import SummaryStats
p = OptionParser(summary.__doc__)
p.add_option("--prefix", help="Generate per block stats [default: %default]")
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
anchorfile, = args
ac = AnchorFile(anchorf... | def summary(args) | %prog summary anchorfile
Provide statistics for pairwise blocks. | 3.492258 | 3.262692 | 1.070361 |
from jcvi.utils.cbook import percentage
p = OptionParser(stats.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
blocksfile, = args
fp = open(blocksfile)
counts = defaultdict(int)
total = orthologous = 0
for row in fp:
at... | def stats(args) | %prog stats blocksfile
Provide statistics for MCscan-style blocks. The count of homologs in each
pivot gene is recorded. | 2.290813 | 2.201261 | 1.040682 |
for a, b, depth in details:
for i in xrange(a, b):
gi = bed[i].accn
print("\t".join((gi, str(depth))), file=fw) | def write_details(fw, details, bed) | Write per gene depth to file | 6.423331 | 5.372918 | 1.195501 |
'''
This will look for the point where cumulative cutoff is reached. For
example:
>>> find_peak({0: 27, 1: 71, 2: 1})
1
'''
total_length = sum(data.values())
count_cutoff = cutoff * total_length
cum_sum = 0
for i, count in sorted(data.items()):
cum_sum += count
i... | def find_peak(data, cutoff=.9) | This will look for the point where cumulative cutoff is reached. For
example:
>>> find_peak({0: 27, 1: 71, 2: 1})
1 | 4.655818 | 2.278 | 2.043819 |
from jcvi.formats.blast import bed
from jcvi.utils.range import range_interleave
p = OptionParser(breakpoint.__doc__)
p.add_option("--xdist", type="int", default=20,
help="xdist (in related genome) cutoff [default: %default]")
p.add_option("--ydist", type="int", default=200000... | def breakpoint(args) | %prog breakpoint blastfile bedfile [options]
Identify breakpoints where collinearity ends. `blastfile` contains mapping
from markers (query) to scaffolds (subject). `bedfile` contains marker
locations in the related species. | 3.111914 | 2.992932 | 1.039754 |
p = OptionParser(scan.__doc__)
p.add_option("-n", "--min_size", dest="n", type="int", default=4,
help="minimum number of anchors in a cluster [default: %default]")
p.add_option("--liftover",
help="Scan BLAST file to find extra anchors [default: %default]")
p.set_stripnames()... | def scan(args) | %prog scan blastfile anchor_file [options]
pull out syntenic anchors from blastfile based on single-linkage algorithm | 4.922809 | 4.570222 | 1.077149 |
p = OptionParser(liftover.__doc__)
p.set_stripnames()
blast_file, anchor_file, dist, opts = add_options(p, args)
qbed, sbed, qorder, sorder, is_self = check_beds(blast_file, p, opts)
filtered_blast = read_blast(blast_file, qorder, sorder,
is_self=is_self, ostrip=op... | def liftover(args) | %prog liftover blastfile anchorfile [options]
Typical use for this program is given a list of anchors (syntennic
genes), choose from the blastfile the pairs that are close to the anchors.
Anchorfile has the following format, each row defines a pair.
geneA geneB
geneC geneD | 4.949388 | 4.978943 | 0.994064 |
from jcvi.formats.blast import BlastSlow, BlastLineByConversion
if not outfile:
outfile = self.filename + ".blast"
if blastfile is not None:
blasts = BlastSlow(blastfile).to_dict()
else:
blasts = None
fw = must_open(outfile, "w", ch... | def blast(self, blastfile=None, outfile=None) | convert anchor file to 12 col blast file | 3.131261 | 3.192284 | 0.980884 |
qi = self.columns[0].index(gene)
ndata = len(self.data)
for col in self.columns[1:]:
upstream_dist = downstream_dist = 1000
# search upstream
for i in range(qi - 1, -1, -1):
if col[i] not in (".", ""):
upstream = co... | def query_gene(self, gene, color=None, invert=False) | Used in mcscanq() for query | 3.012578 | 3.023142 | 0.996506 |
p = OptionParser(__doc__)
opts, args = p.parse_args(args)
fig = plt.figure(1, (5, 5))
root = fig.add_axes([0, 0, 1, 1])
plt.plot((.2, .8), (.6, .6), 'r-', lw=3)
plt.plot((.4, .6), (.6, .6), 'b>-', mfc='g', mec='w', ms=12, lw=3)
plt.plot((.3, .7), (.5, .5), 'r-', lw=3)
plt.plot((.5... | def excision(args) | %prog excision
Illustrate the mechanism of illegitimate recombination. | 2.852103 | 2.85168 | 1.000148 |
p = OptionParser(__doc__)
opts, args = p.parse_args()
fig = plt.figure(1, (5, 5))
root = fig.add_axes([0, 0, 1, 1])
root.set_xlim(0, 1)
root.set_ylim(0, 1)
root.set_axis_off()
# Layout format: (x, y, label, (chr lengths))
anc = (.5, .9, "Ancestor", (1,))
s1 = (.2, .6, "Ge... | def scenario(args) | %prog scenario
Illustration of the two-step genome merger process for B. rapa companion paper. | 3.550089 | 3.47766 | 1.020827 |
p = OptionParser(filter.__doc__)
p.add_option("--score", dest="score", default=0, type="int",
help="Score cutoff")
p.set_align(pctid=95, hitlen=100, evalue=.01)
p.add_option("--noself", default=False, action="store_true",
help="Remove self-self hits")
p.add_opt... | def filter(args) | %prog filter test.blast
Produce a new blast file and filter based on:
- score: >= cutoff
- pctid: >= cutoff
- hitlen: >= cutoff
- evalue: <= cutoff
- ids: valid ids
Use --inverse to obtain the complementary records for the criteria above.
- noself: remove self-self hits | 2.779216 | 2.462167 | 1.128768 |
key = lambda x: x.sstart if use_subject else x.qstart
blast.sort(key=key)
for a, b in zip(blast, blast[1:]):
if use_subject:
if a.sstop < b.sstart:
yield b.sstart - a.sstop
else:
if a.qstop < b.qstart:
yield b.qstart - a.qstop | def collect_gaps(blast, use_subject=False) | Collect the gaps between adjacent HSPs in the BLAST file. | 2.226606 | 2.131328 | 1.044704 |
p = OptionParser(gaps.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
blastfile, = args
blast = BlastSlow(blastfile)
logging.debug("A total of {} records imported".format(len(blast)))
query_gaps = list(collect_gaps(blast))
subject_... | def gaps(args) | %prog gaps A_vs_B.blast
Find distribution of gap sizes betwen adjacent HSPs. | 3.035538 | 2.904936 | 1.044958 |
p = OptionParser(rbbh.__doc__)
opts, args = p.parse_args(args)
if len(args) != 2:
sys.exit(not p.print_help())
abfile, bafile, = args
ab = Blast(abfile)
ba = Blast(bafile)
ab_hits = ab.best_hits
ba_hits = ba.best_hits
for aquery in ab_hits:
ahit = ab_hits[aqu... | def rbbh(args) | %prog rbbh A_vs_B.blast B_vs_A.blast
Identify the reciprocal best blast hit for each query sequence in set A
when compared to set B.
This program assumes that the BLAST results have already been filtered
based on a combination of %id, %cov, e-value cutoffs. BLAST output should
be in tabular `-m 8`... | 2.753721 | 2.62179 | 1.050321 |
from jcvi.formats.base import SetFile
from jcvi.formats.fasta import Fasta
p = OptionParser(score.__doc__)
opts, args = p.parse_args(args)
if len(args) != 3:
sys.exit(not p.print_help())
blastfile, fastafile, idsfile = args
ids = SetFile(idsfile)
blast = Blast(blastfile)... | def score(args) | %prog score blastfile query.fasta A.ids
Add up the scores for each query seq. Go through the lines and for each
query sequence, add up the scores when subject is in each pile by A.ids. | 2.688904 | 2.506609 | 1.072726 |
from jcvi.formats.base import DictFile
p = OptionParser(annotation.__doc__)
p.add_option("--queryids", help="Query IDS file to switch [default: %default]")
p.add_option("--subjectids", help="Subject IDS file to switch [default: %default]")
opts, args = p.parse_args(args)
if len(args) != 1... | def annotation(args) | %prog annotation blastfile > annotations
Create simple two column files from the first two coluns in blastfile. Use
--queryids and --subjectids to switch IDs or descriptions. | 2.291834 | 1.92888 | 1.188168 |
from jcvi.utils.range import range_minmax
from jcvi.utils.cbook import SummaryStats
p = OptionParser(completeness.__doc__)
p.add_option("--ids",
help="Save ids that are over 50% complete [default: %default]")
opts, args = p.parse_args(args)
if len(args) != 2:
sys.... | def completeness(args) | %prog completeness blastfile ref.fasta > outfile
Print statistics for each gene, the coverage of the alignment onto the best hit,
as an indicator for completeness of the gene model. For example, one might
BLAST sugarcane ESTs against sorghum annotations as reference, to find
full-length transcripts. | 2.902169 | 2.843491 | 1.020636 |
from jcvi.assembly.goldenpath import Cutoff, Overlap, Overlap_types
p = OptionParser(annotate.__doc__)
p.set_align(pctid=94, hitlen=500)
p.add_option("--hang", default=500, type="int",
help="Maximum overhang length")
opts, args = p.parse_args(args)
if len(args) != 3:
... | def annotate(args) | %prog annotate blastfile query.fasta subject.fasta
Annotate overlap types (dovetail, contained, etc) in BLAST tabular file. | 3.70224 | 3.373397 | 1.097482 |
from jcvi.formats.base import DictFile
p = OptionParser(top10.__doc__)
p.add_option("--top", default=10, type="int",
help="Top N taxa to extract [default: %default]")
p.add_option("--ids", default=None,
help="Two column ids file to query seqid [default: %default]")
... | def top10(args) | %prog top10 blastfile.best
Count the most frequent 10 hits. Usually the BLASTFILE needs to be screened
the get the best match. You can also provide an .ids file to query the ids.
For example the ids file can contain the seqid to species mapping.
The ids file is two-column, and can sometimes be generat... | 2.763558 | 2.450477 | 1.127763 |
p = OptionParser(sort.__doc__)
p.add_option("--query", default=False, action="store_true",
help="Sort by query position [default: %default]")
p.add_option("--ref", default=False, action="store_true",
help="Sort by reference position [default: %default]")
p.add_option("--refs... | def sort(args) | %prog sort <blastfile|coordsfile>
Sort lines so that same query grouped together with scores descending. The
sort is 'in-place'. | 2.388368 | 2.256397 | 1.058487 |
from jcvi.utils.cbook import gene_name
p = OptionParser(cscore.__doc__)
p.add_option("--cutoff", default=.9999, type="float",
help="Minimum C-score to report [default: %default]")
p.add_option("--pct", default=False, action="store_true",
help="Also include pct as last colum... | def cscore(args) | %prog cscore blastfile > cscoreOut
See supplementary info for sea anemone genome paper, C-score formula:
cscore(A,B) = score(A,B) /
max(best score for A, best score for B)
A C-score of one is the same as reciprocal best hit (RBH).
Output file will be 3-column (query, subject, cscore... | 2.248253 | 2.192979 | 1.025205 |
if xaxis:
arange = ("0", a.qstart, a.qstop, a.orientation) # 0 is the dummy chromosome
brange = ("0", b.qstart, b.qstop, b.orientation)
else:
arange = ("0", a.sstart, a.sstop, a.orientation)
brange = ("0", b.sstart, b.sstop, b.orientation)
dist, oo = range_distance(ara... | def get_distance(a, b, xaxis=True) | Returns the distance between two blast HSPs. | 4.16887 | 3.536526 | 1.178804 |
m = a[0]
if len(a) == 1:
return m
for b in a[1:]:
assert m.query == b.query
assert m.subject == b.subject
m.hitlen += b.hitlen
m.nmismatch += b.nmismatch
m.ngaps += b.ngaps
m.qstart = min(m.qstart, b.qstart)
m.qstop = max(m.qstop, b.qstop... | def combine_HSPs(a) | Combine HSPs into a single BlastLine. | 1.98912 | 1.934937 | 1.028002 |
key = lambda x: (x.query, x.subject)
blast.sort(key=key)
clusters = Grouper()
for qs, points in groupby(blast, key=key):
points = sorted(list(points), \
key=lambda x: (x.qstart, x.qstop, x.sstart, x.sstop))
n = len(points)
for i in xrange(n):
a ... | def chain_HSPs(blast, xdist=100, ydist=100) | Take a list of BlastLines (or a BlastSlow instance), and returns a list of
BlastLines. | 2.930836 | 2.980756 | 0.983253 |
p = OptionParser(chain.__doc__)
p.add_option("--dist", dest="dist",
default=100, type="int",
help="extent of flanking regions to search [default: %default]")
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
blastfile, = args
... | def chain(args) | %prog chain blastfile
Chain adjacent HSPs together to form larger HSP. | 3.363863 | 3.005276 | 1.119319 |
p = OptionParser(condense.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
blastfile, = args
blast = BlastSlow(blastfile)
key = lambda x: x.query
blast.sort(key=key)
clusters = []
for q, lines in groupby(blast, key=key):
... | def condense(args) | %prog condense blastfile > blastfile.condensed
Condense HSPs that belong to the same query-subject pair into one. | 2.94195 | 2.723927 | 1.08004 |
from jcvi.utils.cbook import percentage
from jcvi.graphics.histogram import stem_leaf_plot
p = OptionParser(mismatches.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
blastfile, = args
data = []
matches = 0
b = Blast(blastfil... | def mismatches(args) | %prog mismatches blastfile
Print out histogram of mismatches of HSPs, usually for evaluating SNP level. | 3.984178 | 3.61167 | 1.10314 |
p = OptionParser(swap.__doc__)
opts, args = p.parse_args(args)
if len(args) < 1:
sys.exit(not p.print_help())
blastfile, = args
swappedblastfile = blastfile + ".swapped"
fp = must_open(blastfile)
fw = must_open(swappedblastfile, "w")
for row in fp:
b = BlastLine(r... | def swap(args) | %prog swap blastfile
Print out a new blast file with query and subject swapped. | 2.882731 | 2.628273 | 1.096816 |
from jcvi.formats.bed import sort as bed_sort
p = OptionParser(bed.__doc__)
p.add_option("--swap", default=False, action="store_true",
help="Write query positions [default: %default]")
p.add_option("--both", default=False, action="store_true",
help="Generate one l... | def bed(args) | %prog bed blastfile
Print out bed file based on coordinates in BLAST report. By default, write
out subject positions. Use --swap to write query positions. | 3.115505 | 2.811642 | 1.108073 |
import jcvi.formats.bed
p = OptionParser(pairs.__doc__)
p.set_pairs()
opts, targs = p.parse_args(args)
if len(targs) != 1:
sys.exit(not p.print_help())
blastfile, = targs
bedfile = bed([blastfile])
args[args.index(blastfile)] = bedfile
return jcvi.formats.bed.pairs(a... | def pairs(args) | See __doc__ for OptionParser.set_pairs(). | 3.828263 | 3.440959 | 1.112557 |
p = OptionParser(best.__doc__)
p.add_option("-n", default=1, type="int",
help="get best N hits [default: %default]")
p.add_option("--nosort", default=False, action="store_true",
help="assume BLAST is already sorted [default: %default]")
p.add_option("--hsps", default=False,... | def best(args) | %prog best blastfile
print the best hit for each query in the blastfile | 2.730089 | 2.608936 | 1.046438 |
p = OptionParser(summary.__doc__)
p.add_option("--strict", default=False, action="store_true",
help="Strict 'gapless' mode. Exclude gaps from covered base.")
p.add_option("--tabular", default=False, action="store_true",
help="Print succint tabular output")
opts, arg... | def summary(args) | %prog summary blastfile
Provide summary on id% and cov%, for both query and reference. Often used in
comparing genomes (based on NUCMER results). | 3.848005 | 3.459956 | 1.112154 |
p = OptionParser(subset.__doc__)
p.add_option("--qchrs", default=None,
help="query chrs to extract, comma sep [default: %default]")
p.add_option("--schrs", default=None,
help="subject chrs to extract, comma sep [default: %default]")
p.add_option("--convert", default=... | def subset(args) | %prog subset blastfile qbedfile sbedfile
Extract blast hits between given query and subject chrs.
If --qchrs or --schrs is not given, then all chrs from q/s genome will
be included. However one of --qchrs and --schrs must be specified.
Otherwise the script will do nothing. | 2.534715 | 2.278145 | 1.112622 |
p = OptionParser(flanking.__doc__)
p.add_option("-N", default=50, type="int",
help="How many genes on both directions")
opts, args = p.parse_args(args)
if len(args) != 4:
sys.exit(not p.print_help())
SI, liftover, master, te = args
N = opts.N
SI = SetFile(SI,... | def flanking(args) | %prog flanking SI.ids liftover.bed master.txt master-removed.txt
Extract flanking genes for given SI loci. | 3.743202 | 3.283607 | 1.139966 |
p = OptionParser(geneinfo.__doc__)
opts, args = p.parse_args(args)
if len(args) != 5:
sys.exit(not p.print_help())
scfbed, liftoverbed, lgbed, note, ipr = args
note = DictFile(note, delimiter="\t")
scfbed = Bed(scfbed)
lgorder = Bed(lgbed).order
liftover = Bed(liftoverbed)... | def geneinfo(args) | %prog geneinfo pineapple.20141004.bed liftover.bed pineapple.20150413.bed \
note.txt interproscan.txt
Build gene info table from various sources. The three beds contain
information on the original scaffolds, linkage groups, and final selected
loci (after removal of TEs and split loci). T... | 3.81296 | 3.434209 | 1.110288 |
p = OptionParser(ploidy.__doc__)
p.add_option("--switch", help="Rename the seqid with two-column file")
opts, args, iopts = p.set_image_options(args, figsize="9x7")
if len(args) != 5:
sys.exit(not p.print_help())
seqidsfile, klayout, datafile, bedfile, slayout = args
fig = plt.fi... | def ploidy(args) | %prog ploidy seqids karyotype.layout mcscan.out all.bed synteny.layout
Build a figure that calls graphics.karyotype to illustrate the high ploidy
of WGD history of pineapple genome. The script calls both graphics.karyotype
and graphic.synteny. | 3.420846 | 3.028938 | 1.129388 |
outgoing = defaultdict(set)
incoming = defaultdict(set) if directed else outgoing
nodes = set()
for i, edge in enumerate(edges):
a, b, = edge[:2]
outgoing[a].add(i)
incoming[b].add(i)
nodes.add(a)
nodes.add(b)
nodes = sorted(nodes)
if directed:
... | def node_to_edge(edges, directed=True) | From list of edges, record per node, incoming and outgoing edges | 2.520562 | 2.378962 | 1.059522 |
edges = populate_edge_weights(edges)
incident, nodes = node_to_edge(edges, directed=False)
DUMMY = "DUMMY"
dummy_edges = edges + [(DUMMY, x, 0) for x in nodes]
if directed:
dummy_edges += [(x, DUMMY, 0) for x in nodes]
dummy_edges = reformulate_atsp_as_tsp(dummy_edges)
tour... | def hamiltonian(edges, directed=False, precision=0) | Calculates shortest path that traverses each node exactly once. Convert
Hamiltonian path problem to TSP by adding one dummy point that has a distance
of zero to all your other points. Solve the TSP and get rid of the dummy
point - what remains is the Hamiltonian Path.
>>> g = [(1,2), (2,3), (3,4), (4,2... | 3.993184 | 4.226913 | 0.944704 |
incident, nodes = node_to_edge(edges, directed=False)
new_edges = []
for a, b, w in edges:
new_edges.append(((a, '*'), b, w))
for n in nodes:
new_edges.append((n, (n, '*'), NEG_INF)) # A negative weight
return new_edges | def reformulate_atsp_as_tsp(edges) | To reformulate the ATSP as a TSP, for each city a dummy city (e.g, for New
York, a dummy city New York* is added. Between each city and its
corresponding dummy city a negative or very small distance with value cheap
is used. This makes sure that each cities always occurs in the solution
together with it... | 5.394728 | 5.478557 | 0.984699 |
fw = must_open(tspfile, "w")
incident, nodes = node_to_edge(edges, directed=False)
self.nodes = nodes
nodes_indices = dict((n, i) for i, n in enumerate(nodes))
self.nnodes = nnodes = len(nodes)
# TSPLIB requires explicit weights to be integral, and non-negative
... | def print_to_tsplib(self, edges, tspfile, precision=0) | See TSPlib format:
<https://www.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/>
NAME: bayg29
TYPE: TSP
COMMENT: 29 Cities in Bavaria, geographical distances
DIMENSION: 29
EDGE_WEIGHT_TYPE: EXPLICIT
EDGE_WEIGHT_FORMAT: UPPER_ROW
DISPLAY_DATA_TYPE: ... | 2.798088 | 2.920539 | 0.958072 |
p = OptionParser(resample.__doc__)
opts, args, iopts = p.set_image_options(args, figsize="8x4", dpi=300)
if len(args) != 2:
sys.exit(not p.print_help())
dataA, dataB = args
fig = plt.figure(1, (iopts.w, iopts.h))
root = fig.add_axes([0, 0, 1, 1])
A = fig.add_axes([.1, .18, .32... | def resample(args) | %prog resample yellow-catfish-resample.txt medicago-resample.txt
Plot ALLMAPS performance across resampled real data. | 3.221163 | 2.835523 | 1.136003 |
p = OptionParser(resamplestats.__doc__)
opts, args = p.parse_args(args)
if len(args) != 2:
sys.exit(not p.print_help())
pf, runlog = args
fp = open(runlog)
Real = "real"
times = []
for row in fp:
# real 10m31.513s
if not row.startswith(Real):
... | def resamplestats(args) | %prog resamplestats prefix run.log
Prepare resample results table. Ten subsets of original data were generated
and ALLMAPS were iterated through them, creating `run.log` which contains the
timing results. The anchor rate can be found in `prefix.0.{1-10}.summary.txt`. | 3.84429 | 3.476401 | 1.105825 |
p = OptionParser(comparebed.__doc__)
opts, args = p.parse_args(args)
if len(args) != 2:
sys.exit(not p.print_help())
abed, bbed = args
abed = Bed(abed)
bbed = Bed(bbed)
query_links(abed, bbed)
query_links(bbed, abed) | def comparebed(args) | %prog comparebed AP.chr.bed infer.bed
Compare the scaffold links indicated in two bed files. | 2.620813 | 2.357155 | 1.111854 |
p = OptionParser(simulation.__doc__)
opts, args, iopts = p.set_image_options(args, dpi=300)
if len(args) != 4:
sys.exit(not p.print_help())
dataA, dataB, dataC, dataD = args
fig = plt.figure(1, (iopts.w, iopts.h))
root = fig.add_axes([0, 0, 1, 1])
A = fig.add_axes([.12, .62, .... | def simulation(args) | %prog simulation inversion.txt translocation.txt maps.txt multimaps.txt
Plot ALLMAPS accuracy across a range of simulated datasets. | 2.463133 | 2.230401 | 1.104346 |
p = OptionParser(digest.__doc__)
p.set_outfile()
opts, args = p.parse_args(args)
if len(args) != 2:
sys.exit(not p.print_help())
fastafile, enzymes = args
enzymes = enzymes.split(",")
enzymes = [x for x in AllEnzymes if str(x) in enzymes]
f = Fasta(fastafile, lazy=True)
... | def digest(args) | %prog digest fastafile NspI,BfuCI
Digest fasta sequences to map restriction site positions. | 2.558452 | 2.350785 | 1.08834 |
for s in sites:
newid = "{0}:{1}".format(rec.name, s)
left = max(s - flank, 0)
right = min(s + flank, len(rec))
frag = rec.seq[left:right].strip("Nn")
newrec = SeqRecord(frag, id=newid, description="")
SeqIO.write([newrec], fw, "fasta") | def extract_full(rec, sites, flank, fw) | Full extraction of seq flanking the sites. | 3.047724 | 3.078704 | 0.989937 |
nsites = len(sites)
size = len(rec)
for i, s in enumerate(sites):
newid = "{0}:{1}".format(rec.name, s)
recs = []
if i == 0 or s - sites[i - 1] <= maxfragsize:
newidL = newid + "L"
left = max(s - flank, 0)
right = s
frag = rec.seq... | def extract_ends(rec, sites, flank, fw, maxfragsize=800) | Extraction of ends of fragments above certain size. | 2.31047 | 2.30433 | 1.002664 |
p = OptionParser(fragment.__doc__)
p.add_option("--flank", default=150, type="int",
help="Extract flanking bases of the cut sites [default: %default]")
p.add_option("--full", default=False, action="store_true",
help="The full extraction mode [default: %default]")
opts, args ... | def fragment(args) | %prog fragment fastafile enzyme
Cut the fastafile using the specified enzyme, and grab upstream and
downstream nucleotide sequence along with the cut site. In this case, the
sequences extracted are:
|- PstI
============|===========
(-------)
Sometimes we need to limit ... | 3.396236 | 3.269901 | 1.038636 |
ctgsizes = np.array(ctgsizes, dtype="int")
ctgsizes = np.sort(ctgsizes)[::-1]
ctgsizes = ctgsizes[ctgsizes >= cutoff]
a50 = np.cumsum(ctgsizes)
total = np.sum(ctgsizes)
idx = bisect(a50, total * percent / 100.)
l50 = ctgsizes[idx]
n50 = idx + 1
return a50, l50, n50 | def calculate_A50(ctgsizes, cutoff=0, percent=50) | Given an array of contig sizes, produce A50, N50, and L50 values | 2.507998 | 2.304257 | 1.088419 |
return n * delta * 1. / G - k * ln2 | def Astat(delta, k, G, n) | delta: contig size
k: reads mapped in contig
G: total genome size
n: total reads mapped to genome | 17.078449 | 21.846581 | 0.781745 |
from jcvi.graphics.histogram import loghistogram
p = OptionParser(n50.__doc__)
p.add_option("--print0", default=False, action="store_true",
help="Print size and L50 to stdout [default: %default]")
opts, args = p.parse_args(args)
if len(args) < 1:
sys.exit(not p.print... | def n50(args) | %prog n50 filename
Given a file with a list of numbers denoting contig lengths, calculate N50.
Input file can be both FASTA or a list of sizes. | 3.348954 | 3.256357 | 1.028436 |
p = OptionParser(fromovl.__doc__)
opts, args = p.parse_args(args)
if len(args) != 2:
sys.exit(not p.print_help())
ovlfile, fastafile = args
ovl = OVL(ovlfile)
g = ovl.graph
fw = open("contained.ids", "w")
print("\n".join(sorted(ovl.contained)), file=fw)
graph_to_agp(... | def fromovl(args) | %prog graph nucmer2ovl.ovl fastafile
Build overlap graph from ovl file which is converted using NUCMER2OVL. | 3.677111 | 3.031838 | 1.212832 |
from collections import defaultdict
from jcvi.compara.synteny import AnchorFile, check_beds
from jcvi.formats.bed import Bed
from jcvi.formats.base import get_number
p = OptionParser(bed.__doc__)
p.add_option("--switch", default=False, action="store_true",
help="Switch ref... | def bed(args) | %prog bed anchorsfile
Convert ANCHORS file to BED format. | 3.110564 | 3.028607 | 1.027061 |
trans = maketrans("[](){}", " ")
row = row.strip().strip("+")
row = row.translate(trans)
scfs = [x.strip("+") for x in row.split(":")]
for a, b in pairwise(scfs):
oa = '<' if a.strip()[0] == '-' else '>'
ob = '<' if b.strip()[0] == '-' else '>'
is_uncertain = a[-1]... | def happy_edges(row, prefix=None) | Convert a row in HAPPY file and yield edges. | 3.908707 | 3.74716 | 1.043112 |
allowed_format = ("png", "ps")
p = OptionParser(partition.__doc__)
p.add_option("--prefix", help="Add prefix to the name [default: %default]")
p.add_option("--namestart", default=0, type="int",
help="Use a shorter name, starting index [default: %default]")
p.add_option("--forma... | def partition(args) | %prog partition happy.txt synteny.graph
Select edges from another graph and merge it with the certain edges built
from the HAPPY mapping data. | 4.326428 | 3.98115 | 1.086728 |
p = OptionParser(merge.__doc__)
p.add_option("--colorlist", default="black,red,pink,blue,green",
help="The color palette [default: %default]")
opts, args = p.parse_args(args)
if len(args) < 1:
sys.exit(not p.print_help())
colorlist = opts.colorlist.split(",")
asse... | def merge(args) | %prog merge graphs
Merge multiple graphs together and visualize. | 3.254705 | 2.958706 | 1.100044 |
p = OptionParser(happy.__doc__)
p.add_option("--prefix", help="Add prefix to the name [default: %default]")
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
happyfile, = args
certain = "certain.graph"
uncertain = "uncertain.graph"
fw1 = open... | def happy(args) | %prog happy happy.txt
Make bi-directed graph from HAPPY mapping data. JCVI encodes uncertainties
in the order of the contigs / scaffolds.
: separates scaffolds
+ means telomere (though the telomere repeats may not show because the
telomere-adjacent sequence is missing)
- means that the scaffol... | 3.518713 | 3.532917 | 0.99598 |
from jcvi.formats.blast import sort
from jcvi.utils.range import range_distance
p = OptionParser(fromblast.__doc__)
p.add_option("--clique", default=False, action="store_true",
help="Populate clique instead of linear path [default: %default]")
p.add_option("--maxdist", default... | def fromblast(args) | %prog fromblast blastfile subject.fasta
Generate path from BLAST file. If multiple subjects map to the same query,
an edge is constructed between them (with the link provided by the query).
The BLAST file MUST be filtered, chained, supermapped. | 3.362765 | 3.20849 | 1.048083 |
p = OptionParser(connect.__doc__)
p.add_option("--clip", default=2000, type="int",
help="Only consider end of contigs [default: %default]")
opts, args = p.parse_args(args)
if len(args) != 2:
sys.exit(not p.print_help())
fastafile, blastfile = args
clip = opts.clip
... | def connect(args) | %prog connect assembly.fasta read_mapping.blast
Connect contigs using long reads. | 2.731477 | 2.597786 | 1.051463 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.