scripts/validation/validate_genomes.py
def check_compressed_file(filename):
    """
    Checks if the provided file is in one of the compressed formats

    filename: The path to input file
    returns: Boolean - True if the file is compressed, False otherwise
    """

    magic_dict = {
        "\x1f\x8b\x08": "gz",
        "\x42\x5a\x68": "bz2",
        "\x50\x4b\x03\x04": "zip"
    }

    max_len = max(len(x) for x in magic_dict)

    with open(filename) as fp_in:
        file_start = fp_in.read(max_len)

    for magic, filetype in magic_dict.items():
        if file_start.startswith(magic):
            return True  # can also return filetype

    fp_in.close()

    return False

    Checks if the provided file is in one of the compressed formats

    filename: The path to input file
    returns: Boolean - True if the file is compressed, False otherwise
    
Checks if the provided file is in one of the compressed formats
filename: The path to input file
returns: Boolean - True if the file is compressed, False otherwise
Checks if the provided file is in one of the compressed formats filename : The path to input file returns : Boolean - True if the file is compressed False otherwise
def check_compressed_file(filename):
    magic_dict = {
        "\x1f\x8b\x08": "gz",
        "\x42\x5a\x68": "bz2",
        "\x50\x4b\x03\x04": "zip"
    }
    max_len = max(len(x) for x in magic_dict)
    with open(filename) as fp_in:
        file_start = fp_in.read(max_len)
    for magic, filetype in magic_dict.items():
        if file_start.startswith(magic):
            return True  
    fp_in.close()
    return False
def check_compressed_file ( filename ) : magic_dict = { "\x1f\x8b\x08" : "gz" , "\x42\x5a\x68" : "bz2" , "\x50\x4b\x03\x04" : "zip" } max_len = max ( len ( x ) for x in magic_dict ) with open ( filename ) as fp_in : file_start = fp_in . read ( max_len ) for magic , filetype in magic_dict . items ( ) : if file_start . startswith ( magic ) : return True fp_in . close ( ) return False
Checks if the provided file is in one of the compressed formats
filename: The path to input file
returns: Boolean - True if the file is compressed, False otherwise
Checks if the provided file is in one of the compressed formats filename : The path to input file returns : Boolean - True if the file is compressed False otherwise
"""
    Checks if the provided file is in one of the compressed formats

    filename: The path to input file
    returns: Boolean - True if the file is compressed, False otherwise
    """ # can also return filetype
filename