def prepare_synteny(tourfile, lastfile, odir, p, opts):
    """
    Prepare synteny plots for movie().
    """
    qbedfile, sbedfile = get_bed_filenames(lastfile, p, opts)
    qbedfile = op.abspath(qbedfile)
    sbedfile = op.abspath(sbedfile)

    qbed = Bed(qbedfile, sorted=False)
    contig_to_beds = dict(qbed.sub_beds())

    # Create a separate directory for the subplots and movie
    mkdir(odir, overwrite=True)
    os.chdir(odir)
    logging.debug("Change into subdir `{}`".format(odir))

    # Make anchorsfile
    anchorsfile = ".".join(op.basename(lastfile).split(".", 2)[:2]) \
                  + ".anchors"
    fw = open(anchorsfile, "w")
    for b in Blast(lastfile):
        print("\t".join((gene_name(b.query), gene_name(b.subject),
                                str(int(b.score)))), file=fw)
    fw.close()

    # Symlink sbed
    symlink(sbedfile, op.basename(sbedfile))

    return anchorsfile, qbedfile, contig_to_beds
def prepare_synteny ( tourfile , lastfile , odir , p , opts ) : qbedfile , sbedfile = get_bed_filenames ( lastfile , p , opts ) qbedfile = op . abspath ( qbedfile ) sbedfile = op . abspath ( sbedfile ) qbed = Bed ( qbedfile , sorted = False ) contig_to_beds = dict ( qbed . sub_beds ( ) ) mkdir ( odir , overwrite = True ) os . chdir ( odir ) logging . debug ( "Change into subdir `{}`" . format ( odir ) ) anchorsfile = "." . join ( op . basename ( lastfile ) . split ( "." , 2 ) [ : 2 ] ) + ".anchors" fw = open ( anchorsfile , "w" ) for b in Blast ( lastfile ) : print ( "\t" . join ( ( gene_name ( b . query ) , gene_name ( b . subject ) , str ( int ( b . score ) ) ) ) , file = fw ) fw . close ( ) symlink ( sbedfile , op . basename ( sbedfile ) ) return anchorsfile , qbedfile , contig_to_beds
Prepare synteny plots for movie().