-
Notifications
You must be signed in to change notification settings - Fork 1
/
normalFilter.py
27 lines (25 loc) · 905 Bytes
/
normalFilter.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
#!/usr/bin/python
import sys;
import subprocess;
cmd = subprocess.Popen('ls', stdout=subprocess.PIPE);
cmd_out, cmd_err = cmd.communicate();
cmd_out = cmd_out.decode(sys.stdout.encoding).split("\n");
for i in cmd_out:
normalFusions = [];
if "_N" in i:
sample = i[:-2];
normalFile = open(sample+"_N/Merged_Fusions/Filtered_Fusions_in_"+sample+"_N.tsv");
normalFile.readline();
for line in normalFile:
line = line.strip().split("\t");
normalFusions.append(line[0]);
normalFile.close();
output = open(sample+"_T/Merged_Fusions/Normal_Filtered_Fusions_in_"+sample+"_T.tsv","w");
tumorFile = open(sample+"_T/Merged_Fusions/Filtered_Fusions_in_"+sample+"_T.tsv");
print(tumorFile.readline().strip(),file=output);
for line in tumorFile:
data = line.strip().split("\t");
if data[0] not in normalFusions:
print(line.strip(),file=output);
tumorFile.close();
output.close();