-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_ub_databases.py
36 lines (27 loc) · 1.34 KB
/
update_ub_databases.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
import argparse
import sys, os
import subprocess
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse.ArgumentTypeError('Boolean value expected.')
pathname = os.path.dirname(sys.argv[0])
cenote_script_path = os.path.abspath(pathname)
print(cenote_script_path)
parser = argparse.ArgumentParser(description='Update databases associated with Cenote-Taker2/Unlimited Breadsticks. HMM (hmmer) databases: updated March 4th, 2021. CDD (hhsuite) database: not updated from original.')
optional_args = parser.add_argument_group('Use options to pick databases to update.')
optional_args.add_argument("--hmm", dest="HMM_DB", type=str2bool, default=False, help=' Default: False -- choose: True -or- False')
args = parser.parse_args()
print (str(args.HMM_DB))
if str(args.HMM_DB) == "True":
print ("running HMM database update")
subprocess.call(['rm', '-r', str(cenote_script_path) + '/hmmscan_DBs/'])
subprocess.call(['wget', '--directory-prefix=' + str(cenote_script_path), 'https://zenodo.org/record/4966268/files/hmmscan_DBs.tgz'])
subprocess.call(['tar', '-xvf', 'hmmscan_DBs.tgz'])
subprocess.call(['rm', 'hmmscan_DBs.tgz'])