-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
98 lines (90 loc) · 3.39 KB
/
main.py
File metadata and controls
98 lines (90 loc) · 3.39 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#################### Imports ####################
import sys
import argparse
from basic_tasks import (reference_task, dumpref_task,
align_task, dumpalign_task)
from helper_functions import AppErr
#################### Program ####################
def readargs(args=None):
parser = argparse.ArgumentParser(
prog='genomic-pseudo-aligner',
)
parser.add_argument('-t', '--task',
help="task",
required=True
)
parser.add_argument('-g', '--genomefile',
help="Path to the reference genome FASTA file.",
)
parser.add_argument('-r', '--referencefile',
help="Path to the reference k-mer database (.kdb).",
)
parser.add_argument('-k', '--kmer-size',
help="length of kmers",
type=int
)
parser.add_argument('-a', '--alignfile',
help="Path to the alignment output file (.aln).",
)
parser.add_argument('--reads',
help="fastq reads file",
)
parser.add_argument('-m', '--unique-threshold',
help="unique k-mer threshold",
)
parser.add_argument('-p', '--ambiguous-threshold',
help="ambiguous k-mer threshold",
)
parser.add_argument('--min-read-quality',
type=int,
)
parser.add_argument('--min-kmer-quality',
type=int,
)
parser.add_argument('--max-genomes',
type=int,
)
parser.add_argument('--genomes',
)
parser.add_argument('--coverage',
action='store_true',
help="Enable coverage extension")
parser.add_argument('--min-coverage',
type=int,
default=1,
)
parser.add_argument('--full-coverage',
action='store_true',
)
parser.add_argument('--detect-variants',
action='store_true',
help="Enable variant detection (EXTVARTRACK)")
parser.add_argument('--min-variant-quality',
type=float,
help="Minimal quality score for variants")
parser.add_argument('--min-variant-coverage',
type=int,
help="Minimal coverage to call changes- variants")
return parser.parse_args(args)
def main():
try:
args = readargs()
if args.task == "reference":
reference_task(args)
elif args.task == "dumpref":
dumpref_task(args)
elif args.task == "align":
align_task(args)
elif args.task == "dumpalign":
dumpalign_task(args)
else:
print("Error: unknown task")
sys.exit(1)
except AppErr as e: # catch the errors raised
sys.stderr.write(f"{e}\n")
sys.exit(1)
except Exception as e:
sys.stderr.write(f"Unexpected System Error: {e}\n")
sys.exit(1)
if __name__=="__main__":
main()