scripts/validation/genome_download_validator.py
def validate_domain_dir(domain_dir, out_file=True):
    """
    Validate sequence files downloaded in domain directory

    domain_dir: The path to a domain directory
    out_file: If True this one will generate an json file with all erroneous
    files per upid that we need to download again.

    return: A dict with all erroneous accessions in the format {upid: [acc1,...]}
    """

    domain_err_accs = {}

    upids = [x for x in os.listdir(domain_dir)
             if os.path.isdir(os.path.join(domain_dir, x))]

    for upid in upids:
        upid_err_accs = []
        upid_dir = os.path.join(domain_dir, upid)
        seq_files = [x for x in os.listdir(upid_dir) if x.endswith(".fa")]
        for seq_file in seq_files:
            seq_file_loc = os.path.join(upid_dir, seq_file)

            if check_file_format(seq_file_loc) is False:
                upid_err_accs.append(seq_file)

        if len(upid_err_accs) > 0:
            domain_err_accs[upid] = upid_err_accs

    if out_file is True:
        fp_out = open(os.path.join(domain_dir, "erroneous_accessions.json"), 'w')
        json.dump(domain_err_accs, fp_out)
        fp_out.close()

    return domain_err_accs

    Validate sequence files downloaded in domain directory

    domain_dir: The path to a domain directory
    out_file: If True this one will generate an json file with all erroneous
    files per upid that we need to download again.

    return: A dict with all erroneous accessions in the format {upid: [acc1,...]}
    
Validate sequence files downloaded in domain directory
domain_dir: The path to a domain directory
out_file: If True this one will generate an json file with all erroneous
files per upid that we need to download again.

A dict with all erroneous accessions in the format {upid: [acc1,...]}
Validate sequence files downloaded in domain directory domain_dir : The path to a domain directory out_file : If True this one will generate an json file with all erroneous files per upid that we need to download again . A dict with all erroneous accessions in the format { upid : [ acc1 ... ] }
def validate_domain_dir(domain_dir, out_file=True):
    domain_err_accs = {}
    upids = [x for x in os.listdir(domain_dir)
             if os.path.isdir(os.path.join(domain_dir, x))]
    for upid in upids:
        upid_err_accs = []
        upid_dir = os.path.join(domain_dir, upid)
        seq_files = [x for x in os.listdir(upid_dir) if x.endswith(".fa")]
        for seq_file in seq_files:
            seq_file_loc = os.path.join(upid_dir, seq_file)
            if check_file_format(seq_file_loc) is False:
                upid_err_accs.append(seq_file)
        if len(upid_err_accs) > 0:
            domain_err_accs[upid] = upid_err_accs
    if out_file is True:
        fp_out = open(os.path.join(domain_dir, "erroneous_accessions.json"), 'w')
        json.dump(domain_err_accs, fp_out)
        fp_out.close()
    return domain_err_accs
def validate_domain_dir ( domain_dir , out_file = True ) : domain_err_accs = { } upids = [ x for x in os . listdir ( domain_dir ) if os . path . isdir ( os . path . join ( domain_dir , x ) ) ] for upid in upids : upid_err_accs = [ ] upid_dir = os . path . join ( domain_dir , upid ) seq_files = [ x for x in os . listdir ( upid_dir ) if x . endswith ( ".fa" ) ] for seq_file in seq_files : seq_file_loc = os . path . join ( upid_dir , seq_file ) if check_file_format ( seq_file_loc ) is False : upid_err_accs . append ( seq_file ) if len ( upid_err_accs ) > 0 : domain_err_accs [ upid ] = upid_err_accs if out_file is True : fp_out = open ( os . path . join ( domain_dir , "erroneous_accessions.json" ) , 'w' ) json . dump ( domain_err_accs , fp_out ) fp_out . close ( ) return domain_err_accs
Validate sequence files downloaded in domain directory
domain_dir: The path to a domain directory
out_file: If True this one will generate an json file with all erroneous
files per upid that we need to download again.
Validate sequence files downloaded in domain directory domain_dir : The path to a domain directory out_file : If True this one will generate an json file with all erroneous files per upid that we need to download again .
"""
    Validate sequence files downloaded in domain directory

    domain_dir: The path to a domain directory
    out_file: If True this one will generate an json file with all erroneous
    files per upid that we need to download again.

    return: A dict with all erroneous accessions in the format {upid: [acc1,...]}
    """
domain_dir
out_file