-
Notifications
You must be signed in to change notification settings - Fork 4
/
catt
executable file
·66 lines (54 loc) · 2.78 KB
/
catt
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
#!python3
import argparse
import os
import sys
def CommandLineParser():
parser = argparse.ArgumentParser(
prog="CATT",
description="What the program does",
epilog='Text at the bottom of help'
)
group = parser.add_mutually_exclusive_group()
group.add_argument('-f', '--file', action='append', default=[], help="Input file path")
group.add_argument("--f1", action='append', default=[], help='Input file path with #1 mates')
parser.add_argument("--f2", action='append', default=[], help='Input file path with #2 mates')
parser.add_argument('-o', '--output', action='append', default=[], required=True, help='Output path, prefix shoulde be included.')
parser.add_argument('-t', '--thread', default=4, type=int, help='Thread number used by CATT')
parser.add_argument('-k', '--kmer', default=10000, type=int)
parser.add_argument("--chain", default="TRB", choices=['TRB', 'TRA', 'IGH', 'IGL', 'TRD', 'TRG'])
parser.add_argument("--region", '-r', default="CDR3", choices=['CDR1', 'CDR2', 'CDR3'])
parser.add_argument("--bowt", type=int, default=8, help="Thread used for bowtie align.")
parser.add_argument("--sc", action="store_true", default=False)
parser.add_argument("--debug", action='store_true', default=False)
parser.add_argument("--bowsc", default=12, type=int)
parser.add_argument('--penality',default=1, type=int)
parser.add_argument("--bam", action="store_true", dest='bam', default=False)
parser.add_argument("--species", default='hs', choices=['hs', 'ms', 'pig'])
parser.add_argument('--proV', dest='proV', action='append', default=[], help="processed file pathV ")
parser.add_argument('--proJ', dest='proJ', action='append', default=[], help="processed file pathJ ")
return parser.parse_args()
def convert( arg ):
if arg is None:
return "nothing"
if type(arg) == str:
return '"' + arg + '"'
elif type(arg) == int:
return arg
elif type(arg) == bool:
return "true" if arg else "false"
else:
return arg
if __name__ == '__main__':
abp = os.path.abspath(sys.argv[0])[0:-5]
args = CommandLineParser()
#Index check
if not os.path.exists("./resource/TR/hs/%sV.fa.bwt" % getattr(args, 'chain')):
os.system("bwa index ./resource/TR/hs/%sV.fa" % getattr(args, 'chain'))
os.system("bwa index ./resource/TR/hs/%sJ.fa" % getattr(args, 'chain'))
with open("%s/config.jl" % abp, "w") as handle:
handle.write("parsed_args = Dict(\n")
for arg in vars(args):
line = "{} => {},\n".format(convert(arg), convert((getattr(args, arg))))
handle.write(line.replace('\'', "\""))
handle.write(")")
os.system('export JULIA_NUM_THREADS=%d && julia %s/catt.jl' % (getattr(args, "thread"), abp) )