scripts/support/restore_genome.py
def redownload_genome_from_gca_report(updir, gca_report_file):
    """
    Re-downloads a genome using the GCA report file located in
    the upid directory

    return:
    """

    if not os.path.exists(updir):
        os.mkdir(updir)

    fp = open(gca_report_file, 'r')

    # parse and store accessions in a list
    accessions = [x.strip().split('\t')[0] for x in fp]

    fp.close()

    # remove GCA report header
    accessions.pop(0)

    seq_dir = os.path.join(updir, "sequences")

    # create directory or clean up old download
    if not os.path.exists(seq_dir):
        os.mkdir(seq_dir)
    else:
        shutil.rmtree(seq_dir)
        os.mkdir(seq_dir)
        os.chmod(seq_dir, 0777)

    for accession in accessions:
        gf.fetch_ena_file(accession, "fasta", seq_dir, compressed=False)

    Re-downloads a genome using the GCA report file located in
    the upid directory

    return:
    
Re-downloads a genome using the GCA report file located in
the upid directory


Re - downloads a genome using the GCA report file located in the upid directory
def redownload_genome_from_gca_report(updir, gca_report_file):
    if not os.path.exists(updir):
        os.mkdir(updir)
    fp = open(gca_report_file, 'r')
    accessions = [x.strip().split('\t')[0] for x in fp]
    fp.close()
    accessions.pop(0)
    seq_dir = os.path.join(updir, "sequences")
    if not os.path.exists(seq_dir):
        os.mkdir(seq_dir)
    else:
        shutil.rmtree(seq_dir)
        os.mkdir(seq_dir)
        os.chmod(seq_dir, 0777)
    for accession in accessions:
        gf.fetch_ena_file(accession, "fasta", seq_dir, compressed=False)
def redownload_genome_from_gca_report ( updir , gca_report_file ) : if not os . path . exists ( updir ) : os . mkdir ( updir ) fp = open ( gca_report_file , 'r' ) accessions = [ x . strip ( ) . split ( '\t' ) [ 0 ] for x in fp ] fp . close ( ) accessions . pop ( 0 ) seq_dir = os . path . join ( updir , "sequences" ) if not os . path . exists ( seq_dir ) : os . mkdir ( seq_dir ) else : shutil . rmtree ( seq_dir ) os . mkdir ( seq_dir ) os . chmod ( seq_dir , 0777 ) for accession in accessions : gf . fetch_ena_file ( accession , "fasta" , seq_dir , compressed = False )
Re-downloads a genome using the GCA report file located in
the upid directory
Re - downloads a genome using the GCA report file located in the upid directory
"""
    Re-downloads a genome using the GCA report file located in
    the upid directory

    return:
    """ # parse and store accessions in a list # remove GCA report header # create directory or clean up old download
updir
gca_report_file