def birch(args):
    """
    %prog birch seqids layout

    Plot birch macro-synteny, with an embedded phylogenetic tree to the right.
    """
    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)
    L = K.layout

    xs = .79
    dt = dict(rectangle=False, circle=False)
    # Embed a phylogenetic tree to the right
    coords = {}
    coords["Amborella"] = (xs, L[0].y)
    coords["Vitis"] = (xs, L[1].y)
    coords["Prunus"] = (xs, L[2].y)
    coords["Betula"] = (xs, L[3].y)
    coords["Populus"] = (xs, L[4].y)
    coords["Arabidopsis"] = (xs, L[5].y)
    coords["fabids"] = join_nodes(root, coords, "Prunus", "Betula", xs, **dt)
    coords["malvids"] = join_nodes(root, coords, \
                                   "Populus", "Arabidopsis", xs, **dt)
    coords["rosids"] = join_nodes(root, coords, "fabids", "malvids", xs, **dt)
    coords["eudicots"] = join_nodes(root, coords, "rosids", "Vitis", xs, **dt)
    coords["angiosperm"] = join_nodes(root, coords, \
                                      "eudicots", "Amborella", xs, **dt)

    # Show branch length
    branch_length(root, coords["Amborella"], coords["angiosperm"], ">160.0")
    branch_length(root, coords["eudicots"], coords["angiosperm"],
                  ">78.2", va="top")
    branch_length(root, coords["Vitis"], coords["eudicots"], "138.5")
    branch_length(root, coords["rosids"], coords["eudicots"],
                  "19.8", va="top")
    branch_length(root, coords["Prunus"], coords["fabids"],
                  "104.2", ha="right", va="top")
    branch_length(root, coords["Arabidopsis"], coords["malvids"],
                  "110.2", va="top")
    branch_length(root, coords["fabids"], coords["rosids"],
                  "19.8", ha="right", va="top")
    branch_length(root, coords["malvids"], coords["rosids"],
                  "8.5", va="top")

    root.set_xlim(0, 1)
    root.set_ylim(0, 1)
    root.set_axis_off()

    pf = "birch"
    image_name = pf + "." + iopts.format
    savefig(image_name, dpi=iopts.dpi, iopts=iopts)
def birch ( args ) : 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 ) L = K . layout xs = .79 dt = dict ( rectangle = False , circle = False ) coords = { } coords [ "Amborella" ] = ( xs , L [ 0 ] . y ) coords [ "Vitis" ] = ( xs , L [ 1 ] . y ) coords [ "Prunus" ] = ( xs , L [ 2 ] . y ) coords [ "Betula" ] = ( xs , L [ 3 ] . y ) coords [ "Populus" ] = ( xs , L [ 4 ] . y ) coords [ "Arabidopsis" ] = ( xs , L [ 5 ] . y ) coords [ "fabids" ] = join_nodes ( root , coords , "Prunus" , "Betula" , xs , ** dt ) coords [ "malvids" ] = join_nodes ( root , coords , "Populus" , "Arabidopsis" , xs , ** dt ) coords [ "rosids" ] = join_nodes ( root , coords , "fabids" , "malvids" , xs , ** dt ) coords [ "eudicots" ] = join_nodes ( root , coords , "rosids" , "Vitis" , xs , ** dt ) coords [ "angiosperm" ] = join_nodes ( root , coords , "eudicots" , "Amborella" , xs , ** dt ) branch_length ( root , coords [ "Amborella" ] , coords [ "angiosperm" ] , ">160.0" ) branch_length ( root , coords [ "eudicots" ] , coords [ "angiosperm" ] , ">78.2" , va = "top" ) branch_length ( root , coords [ "Vitis" ] , coords [ "eudicots" ] , "138.5" ) branch_length ( root , coords [ "rosids" ] , coords [ "eudicots" ] , "19.8" , va = "top" ) branch_length ( root , coords [ "Prunus" ] , coords [ "fabids" ] , "104.2" , ha = "right" , va = "top" ) branch_length ( root , coords [ "Arabidopsis" ] , coords [ "malvids" ] , "110.2" , va = "top" ) branch_length ( root , coords [ "fabids" ] , coords [ "rosids" ] , "19.8" , ha = "right" , va = "top" ) branch_length ( root , coords [ "malvids" ] , coords [ "rosids" ] , "8.5" , va = "top" ) root . set_xlim ( 0 , 1 ) root . set_ylim ( 0 , 1 ) root . set_axis_off ( ) pf = "birch" image_name = pf + "." + iopts . format savefig ( image_name , dpi = iopts . dpi , iopts = iopts )
%prog birch seqids layout

    Plot birch macro-synteny, with an embedded phylogenetic tree to the right.