scripts/export/genomes/genome_fetch.py
def genome_script_generator(upid, domain, gen_size, out_dir):
    """
    Generates a shell script for a proteome with ip upid under out_dir.
    Memory is reserved according to genome size

    upid: Uniprot's unique proteome id
    domain: The domain under which a proteome has been classified
    gen_size: The genome's size
    out_dir: Destination directory
    """

    # create shell script for upid within
    shell_fp = open(os.path.join(out_dir, upid + ".sh"), 'w')

    # mem = gen_size * something might not need these for downloads
    mem_size = 8000
    tmp_size = gen_size * 2
    tmp_dir = "/tmp/%s_$LSB_JOBID" % (upid)

    # generate proteome destination directory
    prot_dest_dir = os.path.join(
        os.path.join(os.path.split(out_dir)[0], domain), upid)

    shell_fp.write("#!/bin/csh\n")
    shell_fp.write("#BSUB -M %s\n" % mem_size)
    shell_fp.write("#BSUB -R \"rusage[mem=%s,tmp=%s]\"\n" % (mem_size, tmp_size))

    # create a directory using the proteomes unique id extended by jobid
    shell_fp.write("#BSUB -E \"mkdir -m 777 -p %s\"\n" % tmp_dir)
    shell_fp.write("#BSUB -o \"%s/%sJ.out\"\n" % (tmp_dir, chr(37)))
    shell_fp.write("#BSUB -e \"%s/%sJ.err\"\n" % (tmp_dir, chr(37)))

    shell_fp.write("#BSUB -u \"%s\"\n" % gc.USER_EMAIL)  # email this user

    # need to write files back to genome dir prot_dest_dir
    shell_fp.write(
        "#BSUB -f \"%s/download.out < /tmp/%sJ/%sJ.out\"\n" % (prot_dest_dir,
                                                               chr(37),
                                                               chr(37)))

    shell_fp.write(
        "#BSUB -f \"%s/download.err < /tmp/%sJ/%sJ.err\"\n" % (prot_dest_dir,
                                                               chr(37),
                                                               chr(37)))

    # delete everything on termination or completion of job
    shell_fp.write("#BSUB -Ep \"rm -rf %s\"\n" % tmp_dir)

    shell_fp.write("#BSUB -g %s/%s \n\n" % (gc.LSF_GEN_GROUP % domain))

    # call executable
    shell_fp.write("python %s %s %s \n\n" %
                   (gc.GEN_DWLD_EXEC, os.path.join(prot_dest_dir, upid + ".json"),
                    prot_dest_dir))

    # copy files to destination
    shell_fp.write("cp %s/*.gz %s/.\n" % (tmp_dir, prot_dest_dir))

    Generates a shell script for a proteome with ip upid under out_dir.
    Memory is reserved according to genome size

    upid: Uniprot's unique proteome id
    domain: The domain under which a proteome has been classified
    gen_size: The genome's size
    out_dir: Destination directory
    
Generates a shell script for a proteome with ip upid under out_dir.
Memory is reserved according to genome size

Uniprot's unique proteome id
domain: The domain under which a proteome has been classified
gen_size: The genome's size
out_dir: Destination directory
Generates a shell script for a proteome with ip upid under out_dir . Memory is reserved according to genome size Uniprot ' s unique proteome id domain : The domain under which a proteome has been classified gen_size : The genome ' s size out_dir : Destination directory
def genome_script_generator(upid, domain, gen_size, out_dir):
    shell_fp = open(os.path.join(out_dir, upid + ".sh"), 'w')
    mem_size = 8000
    tmp_size = gen_size * 2
    tmp_dir = "/tmp/%s_$LSB_JOBID" % (upid)
    prot_dest_dir = os.path.join(
        os.path.join(os.path.split(out_dir)[0], domain), upid)
    shell_fp.write("#!/bin/csh\n")
    shell_fp.write("#BSUB -M %s\n" % mem_size)
    shell_fp.write("#BSUB -R \"rusage[mem=%s,tmp=%s]\"\n" % (mem_size, tmp_size))
    shell_fp.write("#BSUB -E \"mkdir -m 777 -p %s\"\n" % tmp_dir)
    shell_fp.write("#BSUB -o \"%s/%sJ.out\"\n" % (tmp_dir, chr(37)))
    shell_fp.write("#BSUB -e \"%s/%sJ.err\"\n" % (tmp_dir, chr(37)))
    shell_fp.write("#BSUB -u \"%s\"\n" % gc.USER_EMAIL)  
    shell_fp.write(
        "#BSUB -f \"%s/download.out < /tmp/%sJ/%sJ.out\"\n" % (prot_dest_dir,
                                                               chr(37),
                                                               chr(37)))
    shell_fp.write(
        "#BSUB -f \"%s/download.err < /tmp/%sJ/%sJ.err\"\n" % (prot_dest_dir,
                                                               chr(37),
                                                               chr(37)))
    shell_fp.write("#BSUB -Ep \"rm -rf %s\"\n" % tmp_dir)
    shell_fp.write("#BSUB -g %s/%s \n\n" % (gc.LSF_GEN_GROUP % domain))
    shell_fp.write("python %s %s %s \n\n" %
                   (gc.GEN_DWLD_EXEC, os.path.join(prot_dest_dir, upid + ".json"),
                    prot_dest_dir))
    shell_fp.write("cp %s/*.gz %s/.\n" % (tmp_dir, prot_dest_dir))
def genome_script_generator ( upid , domain , gen_size , out_dir ) : shell_fp = open ( os . path . join ( out_dir , upid + ".sh" ) , 'w' ) mem_size = 8000 tmp_size = gen_size * 2 tmp_dir = "/tmp/%s_$LSB_JOBID" % ( upid ) prot_dest_dir = os . path . join ( os . path . join ( os . path . split ( out_dir ) [ 0 ] , domain ) , upid ) shell_fp . write ( "#!/bin/csh\n" ) shell_fp . write ( "#BSUB -M %s\n" % mem_size ) shell_fp . write ( "#BSUB -R \"rusage[mem=%s,tmp=%s]\"\n" % ( mem_size , tmp_size ) ) shell_fp . write ( "#BSUB -E \"mkdir -m 777 -p %s\"\n" % tmp_dir ) shell_fp . write ( "#BSUB -o \"%s/%sJ.out\"\n" % ( tmp_dir , chr ( 37 ) ) ) shell_fp . write ( "#BSUB -e \"%s/%sJ.err\"\n" % ( tmp_dir , chr ( 37 ) ) ) shell_fp . write ( "#BSUB -u \"%s\"\n" % gc . USER_EMAIL ) shell_fp . write ( "#BSUB -f \"%s/download.out < /tmp/%sJ/%sJ.out\"\n" % ( prot_dest_dir , chr ( 37 ) , chr ( 37 ) ) ) shell_fp . write ( "#BSUB -f \"%s/download.err < /tmp/%sJ/%sJ.err\"\n" % ( prot_dest_dir , chr ( 37 ) , chr ( 37 ) ) ) shell_fp . write ( "#BSUB -Ep \"rm -rf %s\"\n" % tmp_dir ) shell_fp . write ( "#BSUB -g %s/%s \n\n" % ( gc . LSF_GEN_GROUP % domain ) ) shell_fp . write ( "python %s %s %s \n\n" % ( gc . GEN_DWLD_EXEC , os . path . join ( prot_dest_dir , upid + ".json" ) , prot_dest_dir ) ) shell_fp . write ( "cp %s/*.gz %s/.\n" % ( tmp_dir , prot_dest_dir ) )
Generates a shell script for a proteome with ip upid under out_dir.
Generates a shell script for a proteome with ip upid under out_dir .
"""
    Generates a shell script for a proteome with ip upid under out_dir.
    Memory is reserved according to genome size

    upid: Uniprot's unique proteome id
    domain: The domain under which a proteome has been classified
    gen_size: The genome's size
    out_dir: Destination directory
    """ # create shell script for upid within # mem = gen_size * something might not need these for downloads # generate proteome destination directory # create a directory using the proteomes unique id extended by jobid # email this user # need to write files back to genome dir prot_dest_dir # delete everything on termination or completion of job # call executable # copy files to destination
upid
domain
gen_size
out_dir