scripts/support/restore_genome.py
def redownload_genome_from_uniprot_json(updir, upid_accession_file):
    """
    Re-downloads a genome using the upid_accessions.json file
    located in the upid directory

    return:
    """

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

    fp = open(upid_accession_file, 'r')
    acc_dict = json.load(fp)
    fp.close() 

    # parse and store accessions in a list
    accessions = acc_dict["OTHER"].values()

    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)

    if acc_dict["WGS"] != -1:
	gf.copy_wgs_set_from_ftp(acc_dict["WGS"], seq_dir)

    Re-downloads a genome using the upid_accessions.json file
    located in the upid directory

    return:
    
Re-downloads a genome using the upid_accessions.json file
located in the upid directory


Re - downloads a genome using the upid_accessions . json file located in the upid directory
def redownload_genome_from_uniprot_json(updir, upid_accession_file):
    if not os.path.exists(updir):
        os.mkdir(updir)
    fp = open(upid_accession_file, 'r')
    acc_dict = json.load(fp)
    fp.close() 
    accessions = acc_dict["OTHER"].values()
    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)
    if acc_dict["WGS"] != -1:
	gf.copy_wgs_set_from_ftp(acc_dict["WGS"], seq_dir)
def redownload_genome_from_uniprot_json ( updir , upid_accession_file ) : if not os . path . exists ( updir ) : os . mkdir ( updir ) fp = open ( upid_accession_file , 'r' ) acc_dict = json . load ( fp ) fp . close ( ) accessions = acc_dict [ "OTHER" ] . values ( ) 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 ) if acc_dict [ "WGS" ] != - 1 : gf . copy_wgs_set_from_ftp ( acc_dict [ "WGS" ] , seq_dir )
Re-downloads a genome using the upid_accessions.json file
located in the upid directory
Re - downloads a genome using the upid_accessions . json file located in the upid directory
"""
    Re-downloads a genome using the upid_accessions.json file
    located in the upid directory

    return:
    """ # parse and store accessions in a list # create directory or clean up old download
updir
upid_accession_file