scripts/export/fasta_gen_handler.py
def shell_script_generator(seq_file, rfam_acc, fa_outdir, out_dir=None):
    """
    Generates family specific shell scripts to split fasta generation into
    individual jobs

    seq_file:   The path to sequence file (e.g. )
    rfam_acc:   A valid Rfam family accession
    fa_outdir:  A path to where fasta files will be generated
    out_dir:    A path to an output directory where the shell scripts will be
                generated. If None, fa_outdir is used by default
    """

    # If no specific directory is provided for the shell scripts, generate them
    # in the fa output directory

    file_path = ''
    if out_dir is None:
        file_path = os.path.join(fa_outdir, rfam_acc + ".sh")

    else:
        file_path = os.path.join(out_dir, rfam_acc + ".sh")

    log_dir = os.path.join(fa_outdir, "log")

    output_fp = open(file_path, 'w')

    output_fp.write("#!/bin/csh\n")
    output_fp.write("#BSUB -q production-rh74\n")
    output_fp.write("#BSUB -M 8000\n")
    output_fp.write("#BSUB -R \"rusage[mem=8000,tmp=1000]\"\n")
    output_fp.write("#BSUB -o \"/tmp/%J.out\"\n")
    output_fp.write("#BSUB -e \"/tmp/%J.err\"\n")

    output_fp.write(
        "#BSUB -f \"%s/%s.out < /tmp/%sJ.out\"\n" % (log_dir, rfam_acc, chr(37)))

    output_fp.write(
        "#BSUB -f \"%s/%s.err < /tmp/%sJ.err\"\n" % (log_dir, rfam_acc, chr(37)))

    output_fp.write("#BSUB -Ep \"rm /tmp/$LSB_JOBID.*\"\n")
    output_fp.write("#BSUB -g %s \n\n" % (LSF_GROUP))
    output_fp.write("python %s %s %s %s \n" % (os.path.join(os.getcwd(),"fasta_generator.py"), seq_file,
                                               rfam_acc, fa_outdir))

    output_fp.close()

    return file_path

    Generates family specific shell scripts to split fasta generation into
    individual jobs

    seq_file:   The path to sequence file (e.g. )
    rfam_acc:   A valid Rfam family accession
    fa_outdir:  A path to where fasta files will be generated
    out_dir:    A path to an output directory where the shell scripts will be
                generated. If None, fa_outdir is used by default
    
Generates family specific shell scripts to split fasta generation into
individual jobs

The path to sequence file
rfam_acc:   A valid Rfam family accession
fa_outdir:  A path to where fasta files will be generated
out_dir:    A path to an output directory where the shell scripts will be
generated. If None, fa_outdir is used by default
Generates family specific shell scripts to split fasta generation into individual jobs The path to sequence file rfam_acc : A valid Rfam family accession fa_outdir : A path to where fasta files will be generated out_dir : A path to an output directory where the shell scripts will be generated . If None fa_outdir is used by default
def shell_script_generator(seq_file, rfam_acc, fa_outdir, out_dir=None):
    file_path = ''
    if out_dir is None:
        file_path = os.path.join(fa_outdir, rfam_acc + ".sh")
    else:
        file_path = os.path.join(out_dir, rfam_acc + ".sh")
    log_dir = os.path.join(fa_outdir, "log")
    output_fp = open(file_path, 'w')
    output_fp.write("#!/bin/csh\n")
    output_fp.write("#BSUB -q production-rh74\n")
    output_fp.write("#BSUB -M 8000\n")
    output_fp.write("#BSUB -R \"rusage[mem=8000,tmp=1000]\"\n")
    output_fp.write("#BSUB -o \"/tmp/%J.out\"\n")
    output_fp.write("#BSUB -e \"/tmp/%J.err\"\n")
    output_fp.write(
        "#BSUB -f \"%s/%s.out < /tmp/%sJ.out\"\n" % (log_dir, rfam_acc, chr(37)))
    output_fp.write(
        "#BSUB -f \"%s/%s.err < /tmp/%sJ.err\"\n" % (log_dir, rfam_acc, chr(37)))
    output_fp.write("#BSUB -Ep \"rm /tmp/$LSB_JOBID.*\"\n")
    output_fp.write("#BSUB -g %s \n\n" % (LSF_GROUP))
    output_fp.write("python %s %s %s %s \n" % (os.path.join(os.getcwd(),"fasta_generator.py"), seq_file,
                                               rfam_acc, fa_outdir))
    output_fp.close()
    return file_path
def shell_script_generator ( seq_file , rfam_acc , fa_outdir , out_dir = None ) : file_path = '' if out_dir is None : file_path = os . path . join ( fa_outdir , rfam_acc + ".sh" ) else : file_path = os . path . join ( out_dir , rfam_acc + ".sh" ) log_dir = os . path . join ( fa_outdir , "log" ) output_fp = open ( file_path , 'w' ) output_fp . write ( "#!/bin/csh\n" ) output_fp . write ( "#BSUB -q production-rh74\n" ) output_fp . write ( "#BSUB -M 8000\n" ) output_fp . write ( "#BSUB -R \"rusage[mem=8000,tmp=1000]\"\n" ) output_fp . write ( "#BSUB -o \"/tmp/%J.out\"\n" ) output_fp . write ( "#BSUB -e \"/tmp/%J.err\"\n" ) output_fp . write ( "#BSUB -f \"%s/%s.out < /tmp/%sJ.out\"\n" % ( log_dir , rfam_acc , chr ( 37 ) ) ) output_fp . write ( "#BSUB -f \"%s/%s.err < /tmp/%sJ.err\"\n" % ( log_dir , rfam_acc , chr ( 37 ) ) ) output_fp . write ( "#BSUB -Ep \"rm /tmp/$LSB_JOBID.*\"\n" ) output_fp . write ( "#BSUB -g %s \n\n" % ( LSF_GROUP ) ) output_fp . write ( "python %s %s %s %s \n" % ( os . path . join ( os . getcwd ( ) , "fasta_generator.py" ) , seq_file , rfam_acc , fa_outdir ) ) output_fp . close ( ) return file_path
Generates family specific shell scripts to split fasta generation into
individual jobs
Generates family specific shell scripts to split fasta generation into individual jobs
"""
    Generates family specific shell scripts to split fasta generation into
    individual jobs

    seq_file:   The path to sequence file (e.g. )
    rfam_acc:   A valid Rfam family accession
    fa_outdir:  A path to where fasta files will be generated
    out_dir:    A path to an output directory where the shell scripts will be
                generated. If None, fa_outdir is used by default
    """ # If no specific directory is provided for the shell scripts, generate them # in the fa output directory
seq_file
rfam_acc
fa_outdir
out_dir