-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_experiment.py
53 lines (41 loc) · 1.74 KB
/
run_experiment.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
from os import getenv
from dotenv import load_dotenv
from subprocess import run
from argparse import ArgumentParser, RawTextHelpFormatter
def run_experiment(args):
load_dotenv()
graphaligner = getenv('GRAPHALIGNER')
run(
f'{graphaligner} -t {args.threads} -x vg -f {args.fastq} -g {args.graph} '
f'-a {args.alignment}_graphaligner.gam'.split()
)
graphchainer = getenv('GRAPHCHAINER')
run(
f'{graphchainer} -t {args.threads} -f {args.fastq} -g {args.graph} '
f'-a {args.alignment}_graphchainer.gam '.split()
)
minigraph = getenv('MINIGRAPH')
run(
f'{minigraph} -t {args.threads} -c {args.graph} {args.fastq}'.split(),
stdout=open(f'{args.alignment}_minigraph.gaf', 'wb')
)
minichain = getenv('MINICHAIN')
run(
f'{minichain} -t {args.threads} -c {args.graph} {args.fastq}'.split(),
stdout=open(f'{args.alignment}_minichain.gaf', 'wb')
)
if __name__ == '__main__':
parser = ArgumentParser(
description='''
Run aligners GraphAligner, GraphChainer, minigraph and minichain on the vg/gfa and fastq files specified.
''',
formatter_class=RawTextHelpFormatter
)
requiredNamed = parser.add_argument_group('required arguments')
requiredNamed.add_argument('-g', '--graph', type=str, help='Input vg/gfa file', required=True)
requiredNamed.add_argument('-fq', '--fastq', type=str, help='Input fastq file', required=True)
requiredNamed.add_argument(
'-a', '--alignment', type=str, help='Output gam/gaf files (without extension)', required=True
)
parser.add_argument('-t', '--threads', type=int, help='Number of threads', default=30)
run_experiment(parser.parse_args())