scripts/export/genomes/genome_fetch.py
def genome_download_validator(genome_dir):
    """
    Loop over Genome Download output directory and report any upids with
    erroneous output

    genome_dir: The path to Genome Download output directory
    """

    erroneous_genomes = {}

    # list all kingdom dirs under genome output directory
    project_dirs = os.listdir(genome_dir)
    # filter out items that are not directories
    kingdom_dirs = [x for x in project_dirs if os.path.isdir(os.path.join(genome_dir, x))]

    for kingdom in kingdom_dirs:
        erroneous_genomes[kingdom] = []
        # list all genome directories per kindom
        kingdom_dir_loc = os.path.join(genome_dir, kingdom)
        kingdom_dirs = os.listdir(kingdom_dir_loc)

        for genome in kingdom_dirs:
            genome_dir_loc = os.path.join(kingdom_dir_loc, genome)

            if os.path.exists(os.path.join(genome_dir_loc, "download.out")):
                download_fp = open(os.path.join(genome_dir_loc, "download.out"))

                for line in download_fp.readlines():
                    if line.find("Success") != -1:
                        success = 1
                        break

                download_fp.close()

                if success == 0:
                    erroneous_genomes[kingdom].append(genome)

            success = 0

    fp_out = open(os.path.join(genome_dir, "download_report.txt"), 'w')

    for kingdom in erroneous_genomes.keys():
        if len(erroneous_genomes[kingdom]) > 0:
            fp_out.write(kingdom + '\n')
            for proteome in erroneous_genomes[kingdom]:
                fp_out.write(proteome + '\n')

            fp_out.write('\n')

    fp_out.close()

    Loop over Genome Download output directory and report any upids with
    erroneous output

    genome_dir: The path to Genome Download output directory
    
Loop over Genome Download output directory and report any upids with
erroneous output

The path to Genome Download output directory
Loop over Genome Download output directory and report any upids with erroneous output The path to Genome Download output directory
def genome_download_validator(genome_dir):
    erroneous_genomes = {}
    project_dirs = os.listdir(genome_dir)
    kingdom_dirs = [x for x in project_dirs if os.path.isdir(os.path.join(genome_dir, x))]
    for kingdom in kingdom_dirs:
        erroneous_genomes[kingdom] = []
        kingdom_dir_loc = os.path.join(genome_dir, kingdom)
        kingdom_dirs = os.listdir(kingdom_dir_loc)
        for genome in kingdom_dirs:
            genome_dir_loc = os.path.join(kingdom_dir_loc, genome)
            if os.path.exists(os.path.join(genome_dir_loc, "download.out")):
                download_fp = open(os.path.join(genome_dir_loc, "download.out"))
                for line in download_fp.readlines():
                    if line.find("Success") != -1:
                        success = 1
                        break
                download_fp.close()
                if success == 0:
                    erroneous_genomes[kingdom].append(genome)
            success = 0
    fp_out = open(os.path.join(genome_dir, "download_report.txt"), 'w')
    for kingdom in erroneous_genomes.keys():
        if len(erroneous_genomes[kingdom]) > 0:
            fp_out.write(kingdom + '\n')
            for proteome in erroneous_genomes[kingdom]:
                fp_out.write(proteome + '\n')
            fp_out.write('\n')
    fp_out.close()
def genome_download_validator ( genome_dir ) : erroneous_genomes = { } project_dirs = os . listdir ( genome_dir ) kingdom_dirs = [ x for x in project_dirs if os . path . isdir ( os . path . join ( genome_dir , x ) ) ] for kingdom in kingdom_dirs : erroneous_genomes [ kingdom ] = [ ] kingdom_dir_loc = os . path . join ( genome_dir , kingdom ) kingdom_dirs = os . listdir ( kingdom_dir_loc ) for genome in kingdom_dirs : genome_dir_loc = os . path . join ( kingdom_dir_loc , genome ) if os . path . exists ( os . path . join ( genome_dir_loc , "download.out" ) ) : download_fp = open ( os . path . join ( genome_dir_loc , "download.out" ) ) for line in download_fp . readlines ( ) : if line . find ( "Success" ) != - 1 : success = 1 break download_fp . close ( ) if success == 0 : erroneous_genomes [ kingdom ] . append ( genome ) success = 0 fp_out = open ( os . path . join ( genome_dir , "download_report.txt" ) , 'w' ) for kingdom in erroneous_genomes . keys ( ) : if len ( erroneous_genomes [ kingdom ] ) > 0 : fp_out . write ( kingdom + '\n' ) for proteome in erroneous_genomes [ kingdom ] : fp_out . write ( proteome + '\n' ) fp_out . write ( '\n' ) fp_out . close ( )
Loop over Genome Download output directory and report any upids with
erroneous output
Loop over Genome Download output directory and report any upids with erroneous output
"""
    Loop over Genome Download output directory and report any upids with
    erroneous output

    genome_dir: The path to Genome Download output directory
    """ # list all kingdom dirs under genome output directory # filter out items that are not directories # list all genome directories per kindom
genome_dir