forked from kshulgina/codetta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodetta_summary.py
executable file
·47 lines (36 loc) · 2.01 KB
/
codetta_summary.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
#!/usr/bin/env python
from codetta import *
def argument_parsing():
# initialize parser
parser = argparse.ArgumentParser(description="process hmmscan outputs into a summary file that can be used for genetic code inference")
parser.add_argument('prefix', help='specify prefix of output files from gc_alignment (ie [PREFIX].preliminary_translation.faa). This can include \
a path. Hmmscan alignment summary file will be written to [PREFIX].hmmscan_summary.txt.gz')
# remaining arguments all are set optionally, otherwise default values
parser.add_argument('-e', '--evalue', help='Pfam e-value threshold (default: 1e-10)', type=float, default=1e-10)
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
args.results_summary = None
args.identifier = None
args.download_type = 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
initialize_globals(args.resource_directory)
gc = GeneticCode(args)
gc.process_hmmscan_results()
if __name__ == "__main__":
sys.exit(main())