Skip to content

Commit

Permalink
Merge pull request #27 from Kalan-Lab/updated-db-downloading
Browse files Browse the repository at this point in the history
Updated annotation db downloading script
  • Loading branch information
raufs authored Aug 25, 2023
2 parents 5b91a6c + e6e27f7 commit e8aff42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions scripts/setup_annotation_dbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,27 @@ def setup_annot_dbs():
os.system('rm -rf %s %s' % (download_path + 'profiles/', download_path + 'profiles.tar.gz'))

pgap_info_file = download_path + 'hmm_PGAP.tsv'
pgap_hmm_file = download_path + 'PGAP.hmm'
pgap_phmm_file = download_path + 'PGAP.hmm'

if not os.path.isfile(pgap_info_file) or not os.path.isfile(pgap_hmm_file):
# Download PGAP HMMs (Includes TIGR)
print('Setting up PGAP database!')
os.system('wget https://ftp.ncbi.nlm.nih.gov/hmm/current/hmm_PGAP.HMM.tgz')
os.system('wget https://ftp.ncbi.nlm.nih.gov/hmm/current/hmm_PGAP.tsv')
os.system('tar -zxvf hmm_PGAP.HMM.tgz')

assert(os.path.isfile(pgap_info_file))
assert(os.path.isdir(download_path + 'hmm_PGAP.HMM/'))

for f in os.listdir(download_path + 'hmm_PGAP.HMM/'):
os.system('cat %s >> %s' % (download_path + 'hmm_PGAP.HMM/' + f, pgap_hmm_file))
assert(os.path.isfile(pgap_hmm_file))
extract_hmm_dir = 'hmm_PGAP.HMM/'
os.mkdir(extract_hmm_dir)
os.system(' '.join(['tar', '-zxf', 'hmm_PGAP.HMM.tgz', '-C', 'hmm_PGAP.HMM/']))
assert (os.path.isfile(pgap_info_file))
assert (os.path.isdir(download_path + 'hmm_PGAP.HMM/'))
for folder, subs, files in os.walk(extract_hmm_dir):
for filename in files:
if filename.endswith('.HMM') or filename.endswith('.hmm'):
hmm_file_path = os.path.abspath(folder + '/' + filename)
os.system(' '.join(['cat', hmm_file_path, '>>', pgap_phmm_file]))
assert(os.path.isfile(pgap_phmm_file))
listing_handle = open(listing_file, 'a+')
listing_handle.write('pgap\t' + pgap_info_file + '\t' + pgap_hmm_file + '\n')
listing_handle.write('pgap\t' + pgap_info_file + '\t' + pgap_phmm_file + '\n')
listing_handle.close()
os.system('rm -rf %s %s' % (download_path + 'hmm_PGAP.HMM/', download_path + 'hmm_PGAP.HMM.tgz'))

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup

setup(name='lsaBGC',
version='1.39',
version='1.40',
description='Suite for comparative genomic, population genetics and evolutionary analysis, as well as metagenomic mining of micro-evolutionary novelty in BGCs all in the context of a single lineage of interest.',
url='http://github.com/Kalan-Lab/lsaBGC/',
author='Rauf Salamzade',
Expand Down

0 comments on commit e8aff42

Please sign in to comment.