scripts/export/fasta_gen_handler.py
def fasta_gen_handler(seq_file, out_dir, rfam_accessions=None):
    """
    The purpose of this script is to handle the fasta generation process,
    generate individual shell scripts for each available family and submit
    them to the cluster

    seq_file:   Path to the input sequence file (e.g. rfamseq11.fa)
    out_dir:    The output directory where the fasta files will be generated

    """

    # fetch family accessions
    families = []

    if rfam_accessions is None:
        cnx = RfamDB.connect()

        cursor = cnx.cursor(buffered=True)

        query = ("SELECT rfam_acc FROM family")

        cursor.execute(query)

        entries = cursor.fetchall()

        cursor.close()
        RfamDB.disconnect(cnx)

        families = [str(fam[0]) for fam in entries]
    else:
        fp = open(rfam_accessions, 'r')
        families = [x.strip() for x in fp]
        fp.close()

    # create scripts dir within output directory
    if not os.path.exists(os.path.join(out_dir, "scripts")):
        os.mkdir(os.path.join(out_dir, "scripts"))

    if not os.path.exists(os.path.join(out_dir, "log")):
        os.mkdir(os.path.join(out_dir, "log"))

    for fam in families:

        # 1. Generate script file
        sh_path = shell_script_generator(
            seq_file, fam, out_dir, os.path.join(out_dir, "scripts"))

        # 2. submit job under group
        cmd = "bsub < %s" % (sh_path)
        subprocess.call(cmd, shell=True)

    The purpose of this script is to handle the fasta generation process,
    generate individual shell scripts for each available family and submit
    them to the cluster

    seq_file:   Path to the input sequence file (e.g. rfamseq11.fa)
    out_dir:    The output directory where the fasta files will be generated

    
The purpose of this script is to handle the fasta generation process,
generate individual shell scripts for each available family and submit
them to the cluster

Path to the input sequence file
out_dir:    The output directory where the fasta files will be generated
The purpose of this script is to handle the fasta generation process generate individual shell scripts for each available family and submit them to the cluster Path to the input sequence file out_dir : The output directory where the fasta files will be generated
def fasta_gen_handler(seq_file, out_dir, rfam_accessions=None):
    families = []
    if rfam_accessions is None:
        cnx = RfamDB.connect()
        cursor = cnx.cursor(buffered=True)
        query = ("SELECT rfam_acc FROM family")
        cursor.execute(query)
        entries = cursor.fetchall()
        cursor.close()
        RfamDB.disconnect(cnx)
        families = [str(fam[0]) for fam in entries]
    else:
        fp = open(rfam_accessions, 'r')
        families = [x.strip() for x in fp]
        fp.close()
    if not os.path.exists(os.path.join(out_dir, "scripts")):
        os.mkdir(os.path.join(out_dir, "scripts"))
    if not os.path.exists(os.path.join(out_dir, "log")):
        os.mkdir(os.path.join(out_dir, "log"))
    for fam in families:
        sh_path = shell_script_generator(
            seq_file, fam, out_dir, os.path.join(out_dir, "scripts"))
        cmd = "bsub < %s" % (sh_path)
        subprocess.call(cmd, shell=True)
def fasta_gen_handler ( seq_file , out_dir , rfam_accessions = None ) : families = [ ] if rfam_accessions is None : cnx = RfamDB . connect ( ) cursor = cnx . cursor ( buffered = True ) query = ( "SELECT rfam_acc FROM family" ) cursor . execute ( query ) entries = cursor . fetchall ( ) cursor . close ( ) RfamDB . disconnect ( cnx ) families = [ str ( fam [ 0 ] ) for fam in entries ] else : fp = open ( rfam_accessions , 'r' ) families = [ x . strip ( ) for x in fp ] fp . close ( ) if not os . path . exists ( os . path . join ( out_dir , "scripts" ) ) : os . mkdir ( os . path . join ( out_dir , "scripts" ) ) if not os . path . exists ( os . path . join ( out_dir , "log" ) ) : os . mkdir ( os . path . join ( out_dir , "log" ) ) for fam in families : sh_path = shell_script_generator ( seq_file , fam , out_dir , os . path . join ( out_dir , "scripts" ) ) cmd = "bsub < %s" % ( sh_path ) subprocess . call ( cmd , shell = True )
The purpose of this script is to handle the fasta generation process,
generate individual shell scripts for each available family and submit
them to the cluster
The purpose of this script is to handle the fasta generation process generate individual shell scripts for each available family and submit them to the cluster
"""
    The purpose of this script is to handle the fasta generation process,
    generate individual shell scripts for each available family and submit
    them to the cluster

    seq_file:   Path to the input sequence file (e.g. rfamseq11.fa)
    out_dir:    The output directory where the fasta files will be generated

    """ # fetch family accessions # create scripts dir within output directory # 1. Generate script file # 2. submit job under group
seq_file
out_dir
rfam_accessions