-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMISO_2Isoforms.py
More file actions
31 lines (24 loc) · 905 Bytes
/
MISO_2Isoforms.py
File metadata and controls
31 lines (24 loc) · 905 Bytes
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
#Takes a .miso_bf file from run_miso.py --compare-samples.
#These files contain events with more than two isoforms.
#This script removes those events.
#Usage: python MISO_2Isoforms.py <infile> <outfile>
import sys
def getTwoIsoformEvents(miso_bffile, outfile):
twoisoformevents = []
infh = open(miso_bffile, 'r')
for line in infh:
line = line.strip().split('\t')
#This is the header line
if line[0] == 'event_name':
header = line
#Multiple isoform events have psi values separated by commas
elif ',' not in line[1]:
twoisoformevents.append(line)
infh.close()
outfh = open(outfile, 'w')
outfh.write(('\t').join(header) + '\n')
for event in twoisoformevents:
outfh.write(('\t').join(event) + '\n')
outfh.close()
if __name__ == '__main__':
getTwoIsoformEvents(sys.argv[1], sys.argv[2])