def movieframe(args):
    """
    %prog movieframe tour test.clm contigs.ref.anchors

    Draw heatmap and synteny in the same plot.
    """
    p = OptionParser(movieframe.__doc__)
    p.add_option("--label", help="Figure title")
    p.set_beds()
    p.set_outfile(outfile=None)
    opts, args, iopts = p.set_image_options(args, figsize="16x8",
                                            style="white", cmap="coolwarm",
                                            format="png", dpi=120)

    if len(args) != 3:
        sys.exit(not p.print_help())

    tour, clmfile, anchorsfile = args
    tour = tour.split(",")
    image_name = opts.outfile or ("movieframe." + iopts.format)
    label = opts.label or op.basename(image_name).rsplit(".", 1)[0]

    clm = CLMFile(clmfile)
    totalbins, bins, breaks = make_bins(tour, clm.tig_to_size)
    M = read_clm(clm, totalbins, bins)

    fig = plt.figure(1, (iopts.w, iopts.h))
    root = fig.add_axes([0, 0, 1, 1])        # whole canvas
    ax1 = fig.add_axes([.05, .1, .4, .8])    # heatmap
    ax2 = fig.add_axes([.55, .1, .4, .8])    # dot plot
    ax2_root = fig.add_axes([.5, 0, .5, 1])  # dot plot canvas

    # Left axis: heatmap
    plot_heatmap(ax1, M, breaks, iopts)

    # Right axis: synteny
    qbed, sbed, qorder, sorder, is_self = check_beds(anchorsfile, p, opts,
                                                     sorted=False)
    dotplot(anchorsfile, qbed, sbed, fig, ax2_root, ax2, sep=False, title="")

    root.text(.5, .98, clm.name, color="g", ha="center", va="center")
    root.text(.5, .95, label, color="darkslategray", ha="center", va="center")
    normalize_axes(root)
    savefig(image_name, dpi=iopts.dpi, iopts=iopts)
def movieframe ( args ) : p = OptionParser ( movieframe . __doc__ ) p . add_option ( "--label" , help = "Figure title" ) p . set_beds ( ) p . set_outfile ( outfile = None ) opts , args , iopts = p . set_image_options ( args , figsize = "16x8" , style = "white" , cmap = "coolwarm" , format = "png" , dpi = 120 ) if len ( args ) != 3 : sys . exit ( not p . print_help ( ) ) tour , clmfile , anchorsfile = args tour = tour . split ( "," ) image_name = opts . outfile or ( "movieframe." + iopts . format ) label = opts . label or op . basename ( image_name ) . rsplit ( "." , 1 ) [ 0 ] clm = CLMFile ( clmfile ) totalbins , bins , breaks = make_bins ( tour , clm . tig_to_size ) M = read_clm ( clm , totalbins , bins ) fig = plt . figure ( 1 , ( iopts . w , iopts . h ) ) root = fig . add_axes ( [ 0 , 0 , 1 , 1 ] ) ax1 = fig . add_axes ( [ .05 , .1 , .4 , .8 ] ) ax2 = fig . add_axes ( [ .55 , .1 , .4 , .8 ] ) ax2_root = fig . add_axes ( [ .5 , 0 , .5 , 1 ] ) plot_heatmap ( ax1 , M , breaks , iopts ) qbed , sbed , qorder , sorder , is_self = check_beds ( anchorsfile , p , opts , sorted = False ) dotplot ( anchorsfile , qbed , sbed , fig , ax2_root , ax2 , sep = False , title = "" ) root . text ( .5 , .98 , clm . name , color = "g" , ha = "center" , va = "center" ) root . text ( .5 , .95 , label , color = "darkslategray" , ha = "center" , va = "center" ) normalize_axes ( root ) savefig ( image_name , dpi = iopts . dpi , iopts = iopts )
%prog movieframe tour test.clm contigs.ref.anchors

    Draw heatmap and synteny in the same plot.