-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreport_apc
executable file
·69 lines (57 loc) · 1.59 KB
/
report_apc
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
#!/usr/bin/env python3
import argparse
import gzip
import isoform
# CLI
parser = argparse.ArgumentParser(description='apc gene reporter')
parser.add_argument('apc', help='apc directory')
parser.add_argument('models', help='models directory')
parser.add_argument('isos', help='file of isoformer performances')
parser.add_argument('opts', help='file of optiso performances')
arg = parser.parse_args()
# Collect data from files
isos = []
with gzip.open(arg.isos, 'rt') as fp:
for line in fp: isos.append(round(float(line), 4))
opts = []
perfs = []
dons = []
accs = []
emms = []
imms = []
elens = []
ilens = []
icosts = []
names = []
with gzip.open(arg.opts, 'rt') as fp:
for line in fp:
perf, don, acc, emm, imm, elen, ilen, icost, name = line.split()
opts.append(float(perf))
dons.append(float(don))
accs.append(float(acc))
emms.append(float(emm))
imms.append(float(imm))
elens.append(float(elen))
ilens.append(float(ilen))
icosts.append(float(icost))
names.append(name)
lens = []
for name in names:
defline, seq = next(isoform.read_fasta(f'{arg.apc}/{name}.fa'))
lens.append(len(seq))
for name, le, opt, iso in zip(names, lens, opts, isos):
print(name, le, opt, iso, sep='\t')
"""
params = {
'--min_exon': 25,
'--min_intron': 35,
'--flank': 99,
'--limit': 100,
'--apwm': f'{os.path.abspath(arg.models)}/acc.pwm',
'--dpwm': f'{os.path.abspath(arg.models)}/don.pwm',
'--emm': f'{os.path.abspath(arg.models)}/exon.mm',
'--imm': f'{os.path.abspath(arg.models)}/intron.mm',
'--elen': f'{os.path.abspath(arg.models)}/exon.len',
'--ilen': f'{os.path.abspath(arg.models)}/intron.len',
}
"""