-
Notifications
You must be signed in to change notification settings - Fork 1
/
StrainIQ.py
78 lines (71 loc) · 3.15 KB
/
StrainIQ.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import argparse
from scripts.StrainIQ_builder import *
from scripts.StrainIQ_identifier import *
from scripts.StrainIQ_quantifier import *
def main():
my_parser = argparse.ArgumentParser(description='List the content of a folder')
my_parser.add_argument('-p',
metavar='Program',
type=str,
choices=['builder', 'identifier', 'quantifier'],
help='Program to run. Example: builder, identifier, quantifier',
required=True)
my_parser.add_argument('-n',
metavar='n-size',
type=int,
help='Size of the n-gram',
default=21)
my_parser.add_argument('-glist',
metavar='file with a list of reference genome',
type=str,
help='Tab delimited file with list of genomes to be included in the DSEM. Format: gid filelocation')
my_parser.add_argument('-ng',
metavar='total number of genomes in the dasem',
type=int,
help='The number of genomes in the DSEM. This parameteris needed if the DSEM is rebuilt using different sets for references.',
default=471)
my_parser.add_argument('-dsem',
metavar='DSEM',
type=str,
help='The DSEM for this bodysite.')
my_parser.add_argument('-sample',
metavar='sample',
type=str,
help='Input metagenomic sample. Convert the reverse reads in case of paired end sequencing before bombining the reads together')
my_parser.add_argument('-prediction',
metavar='-prediction',
type=str,
help='The prediction file produced by the identifier')
args = my_parser.parse_args()
if args.p == "builder":
if args.glist is None:
my_parser.error("builder requires -glist")
sys.exit()
if not os.path.isfile(args.glist):
print('The path specified does not exist')
sys.exit()
model(args.n, args.glist)
print("builder")
elif args.p == "identifier":
#print(args.p)
#print(args.n)
#print(args.ng)
if args.dsem is None:
my_parser.error("identifier require -dsem")
if args.sample is None:
my_parser.error("identifier require -sample")
#print(args.dsem)
#print(args.sample)
identifier(args.dsem, args.sample)
elif args.p == "quantifier":
if args.dsem is None:
my_parser.error("identifier require -dsem")
if args.sample is None:
my_parser.error("identifier require -sample")
if args.prediction is None:
my_parser.error("identifier require -prediction")
quantifier(args.dsem, args.sample,args.prediction)
#parse_score_file(model, prediction) # generate identified genomes based on the cutoff
print(args.p)
if __name__ == "__main__":
main()