forked from kshulgina/codetta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodetta_download.py
executable file
·50 lines (38 loc) · 2.1 KB
/
codetta_download.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
from codetta import *
def argument_parsing():
# initialize parser
parser = argparse.ArgumentParser(description="download GenBank genome assembly or nucleotide sequences")
parser.add_argument('identifier', help='GenBank genome assembly accession or GenBank nucleotide accession', type=str)
parser.add_argument('download_type', help='specify whether download is for GenBank genome assembly accession (a) or GenBank nucleotide accession (c)',
type=str, choices=['a', 'c'])
# remaining arguments all are set optionally, otherwise default values
parser.add_argument('--prefix', help='specify prefix of where to download the FASTA file (ie [PREFIX].fna). This can include \
a path. (default: [IDENTIFIER].fna)')
parser.add_argument('--resource_directory', help='directory where resource files can be found (default: [script dir]/resources)', type=str)
parser.add_argument('--hmmer_directory', help='directory where HMMER and Easel executables can be found (default: [script dir]/hmmer-3.1b2/bin)', type=str)
return parser.parse_args()
def main():
args = argument_parsing()
if args.resource_directory == None:
args.resource_directory = os.path.join(os.path.dirname(__file__), 'resources')
args.resource_directory = os.path.normpath(args.resource_directory)
if args.hmmer_directory == None:
args.hmmer_directory = os.path.join(os.path.dirname(__file__), 'hmmer-3.1b2/bin')
args.hmmer_directory = os.path.normpath(args.hmmer_directory)
# initialize genetic code with command line args and download genome
initialize_globals(args.resource_directory)
args.results_summary = None
args.evalue = None
args.probability_threshold = None
args.max_fraction = None
args.mito_pfams = None
args.transposon_pfams = None
args.viral_pfams = None
args.selenocysteine_pfams = None
args.pyrrolysine_pfams = None
gc = GeneticCode(args)
# infer genetic code
gc.get_genome()
if __name__ == "__main__":
sys.exit(main())