Skip to content

Commit

Permalink
add flag to automatically overwrite when decompressing
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb-easterly committed Nov 2, 2017
1 parent 6c52c7d commit c222afd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions download_eggnog_data.py
Expand Up @@ -11,6 +11,13 @@ def run(cmd):
if not args.simulate:
os.system(cmd)

def gunzip_flag():
if args.force:
return '-f'
else:
return ''


def download_hmm_database(level):
level_base_path = get_level_base_path(level)
target_dir = os.path.split(get_db_info(level)[0])[0]
Expand All @@ -27,7 +34,7 @@ def download_hmm_database(level):

def download_annotations():
url = 'http://eggnogdb.embl.de/download/emapperdb-%s/eggnog.db.gz' %(DATABASE_VERSION)
cmd = 'cd %s && wget -nH --user-agent=Mozilla/5.0 --relative --no-parent --reject "index.html*" --cut-dirs=4 -e robots=off -O eggnog.db.gz %s && echo Decompressing... && gunzip eggnog.db.gz' %(get_data_path(), url)
cmd = 'cd %s && wget -nH --user-agent=Mozilla/5.0 --relative --no-parent --reject "index.html*" --cut-dirs=4 -e robots=off -O eggnog.db.gz %s && echo Decompressing... && gunzip eggnog.db.gz %s' %(get_data_path(), url, gunzip_flag())
run(cmd)

def download_groups():
Expand All @@ -37,7 +44,7 @@ def download_groups():

def download_diamond_db():
url = 'http://eggnogdb.embl.de/download/emapperdb-%s/eggnog_proteins.dmnd.gz' %(DATABASE_VERSION)
cmd = 'cd %s && wget -nH --user-agent=Mozilla/5.0 --relative --no-parent --reject "index.html*" --cut-dirs=4 -e robots=off -O eggnog_proteins.dmnd.gz %s && echo Decompressing... && gunzip eggnog_proteins.dmnd.gz' %(get_data_path(), url)
cmd = 'cd %s && wget -nH --user-agent=Mozilla/5.0 --relative --no-parent --reject "index.html*" --cut-dirs=4 -e robots=off -O eggnog_proteins.dmnd.gz %s && echo Decompressing... && gunzip eggnog_proteins.dmnd.gz %s' %(get_data_path(), url, gunzip_flag())
run(cmd)

def download_og2level():
Expand Down

0 comments on commit c222afd

Please sign in to comment.