-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmap.py
More file actions
executable file
·43 lines (33 loc) · 1.35 KB
/
map.py
File metadata and controls
executable file
·43 lines (33 loc) · 1.35 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
#!/usr/bin/env python3
from sys import stderr
from BBToolsMap import BBMapper
from BBWrapper import BBWrapper
from BwaMemMap import BWAMEM
from parallel_command_parse import run_parallel_command_with_args
class MapperFactory:
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
def get_mapper(self):
if 'bwamem' in self.kwargs.keys():
return (BWAMEM(*self.args, **self.kwargs))
# Stats and Wrap are mutually exclusive -- cannot get mapping stats
# if using the bbwrap.sh script
if 'wrap' in self.kwargs.keys(): # --wrap : use index one time only
if self.kwargs['wrap']:
if 'read_groups' in self.kwargs.keys() or \
'stats' in self.kwargs.keys():
print("BBWrapper cannot assign read groups or print stats",
file=stderr)
raise (RuntimeError("Contradictory options"))
return(BBWrapper(*self.args, **self.kwargs))
else:
return (BBMapper(*self.args, **self.kwargs))
def main(*args, **kwargs):
bb = MapperFactory(*args, **kwargs)
mapper = bb.get_mapper()
mapper.modules = ['java', 'samtools', 'bwa']
return(mapper.run())
if __name__ == "__main__":
jobs = run_parallel_command_with_args(main)
print(jobs)