scripts/validation/validate_genomes.py
def check_file_format(seq_file):
    """
    Performs some sanity checks on the sequence file. Checks if file is
    compressed and if not validates the format using esl-seqstat. It will also
    check if the sequence file provided is empty or not

    seq_file: The path to a valid sequence file
    returns: True if file passed validation checks, False otherwise
    """

    status = True

    # compressed file
    if seq_file.endswith(".gz"):
        if not os.path.exists(seq_file):
            return False
        else:
            return check_compressed_file(seq_file)

    # uncompressed fasta format
    elif seq_file.endswith(".fa"):

        # check that file exists
        if not os.path.exists(seq_file):
            return False

        # check content
        else:
            cmd_args = [rc.ESL_SEQSTAT, '--informat', "fasta", "--dna", seq_file]
            channel = subprocess.Popen(cmd_args, stdout=subprocess.PIPE)

            # fetch esl-seqstat result
            proc_output = channel.communicate()

            # process the response
            esl_seqstat_out = proc_output[0].split('\n')
            # check only first line of response
            if esl_seqstat_out[0].find("Parse failed") != -1 \
                or esl_seqstat_out[0].find("Format") == -1:
                return False

    # check the size of the file
    if os.path.getsize(seq_file) == 0:
        return False

    return status

    Performs some sanity checks on the sequence file. Checks if file is
    compressed and if not validates the format using esl-seqstat. It will also
    check if the sequence file provided is empty or not

    seq_file: The path to a valid sequence file
    returns: True if file passed validation checks, False otherwise
    
Performs some sanity checks on the sequence file. Checks if file is
compressed and if not validates the format using esl-seqstat. It will also
check if the sequence file provided is empty or not

The path to a valid sequence file
returns: True if file passed validation checks, False otherwise
Performs some sanity checks on the sequence file . Checks if file is compressed and if not validates the format using esl - seqstat . It will also check if the sequence file provided is empty or not The path to a valid sequence file returns : True if file passed validation checks False otherwise
def check_file_format(seq_file):
    status = True
    if seq_file.endswith(".gz"):
        if not os.path.exists(seq_file):
            return False
        else:
            return check_compressed_file(seq_file)
    elif seq_file.endswith(".fa"):
        if not os.path.exists(seq_file):
            return False
        else:
            cmd_args = [rc.ESL_SEQSTAT, '--informat', "fasta", "--dna", seq_file]
            channel = subprocess.Popen(cmd_args, stdout=subprocess.PIPE)
            proc_output = channel.communicate()
            esl_seqstat_out = proc_output[0].split('\n')
            if esl_seqstat_out[0].find("Parse failed") != -1 \
                or esl_seqstat_out[0].find("Format") == -1:
                return False
    if os.path.getsize(seq_file) == 0:
        return False
    return status
def check_file_format ( seq_file ) : status = True if seq_file . endswith ( ".gz" ) : if not os . path . exists ( seq_file ) : return False else : return check_compressed_file ( seq_file ) elif seq_file . endswith ( ".fa" ) : if not os . path . exists ( seq_file ) : return False else : cmd_args = [ rc . ESL_SEQSTAT , '--informat' , "fasta" , "--dna" , seq_file ] channel = subprocess . Popen ( cmd_args , stdout = subprocess . PIPE ) proc_output = channel . communicate ( ) esl_seqstat_out = proc_output [ 0 ] . split ( '\n' ) if esl_seqstat_out [ 0 ] . find ( "Parse failed" ) != - 1 or esl_seqstat_out [ 0 ] . find ( "Format" ) == - 1 : return False if os . path . getsize ( seq_file ) == 0 : return False return status
Performs some sanity checks on the sequence file.
Performs some sanity checks on the sequence file .
"""
    Performs some sanity checks on the sequence file. Checks if file is
    compressed and if not validates the format using esl-seqstat. It will also
    check if the sequence file provided is empty or not

    seq_file: The path to a valid sequence file
    returns: True if file passed validation checks, False otherwise
    """ # compressed file # uncompressed fasta format # check that file exists # check content # fetch esl-seqstat result # process the response # check only first line of response # check the size of the file
seq_file