

def scaffold(args):
    '\n    %prog scaffold scaffold.fasta synteny.blast synteny.sizes synteny.bed\n                         physicalmap.blast physicalmap.sizes physicalmap.bed\n\n    As evaluation of scaffolding, visualize external line of evidences:\n    * Plot synteny to an external genome\n    * Plot alignments to physical map\n    * Plot alignments to genetic map (TODO)\n\n    Each trio defines one panel to be plotted. blastfile defines the matchings\n    between the evidences vs scaffolds. Then the evidence sizes, and evidence\n    bed to plot dot plots.\n\n    This script will plot a dot in the dot plot in the corresponding location\n    the plots are one contig/scaffold per plot.\n    '
    from jcvi.utils.iter import grouper
    p = OptionParser(scaffold.__doc__)
    p.add_option('--cutoff', type='int', default=1000000, help='Plot scaffolds with size larger than [default: %default]')
    p.add_option('--highlights', help='A set of regions in BED format to highlight [default: %default]')
    (opts, args, iopts) = trios.set_image_options(args, figsize='14x8', dpi=150)
    if ((len(args) < 4) or ((len(args) % 3) != 1)):
        sys.exit((not p.print_help()))
    highlights = opts.highlights
    scafsizes = Sizes(args[0])
    trios = list(grouper(args[1:], 3))
    trios = [(a, Sizes(b), Bed(c)) for (a, b, c) in trios]
    if highlights:
        hlbed = Bed(highlights)
    for (scaffoldID, scafsize) in scafsizes.iter_sizes():
        if (scafsize < opts.cutoff):
            continue
        logging.debug('Loading {0} (size={1})'.format(scaffoldID, thousands(scafsize)))
        tmpname = (scaffoldID + '.sizes')
        tmp = open(tmpname, 'w')
        tmp.write('{0}\t{1}'.format(scaffoldID, scafsize))
        tmp.close()
        tmpsizes = Sizes(tmpname)
        tmpsizes.close(clean=True)
        if highlights:
            subhighlights = list(hlbed.sub_bed(scaffoldID))
        imagename = '.'.join((scaffoldID, opts.format))
        plot_one_scaffold(scaffoldID, tmpsizes, None, trios, imagename, iopts, highlights=subhighlights)

dataset/ETHPy150Open tanghaibao/jcvi/graphics/assembly.py scaffold/VarMisuse@68/391 `p`->`trios`