forked from DriesVanDaele/OMEN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
filter_genes.py
16 lines (14 loc) · 892 Bytes
/
filter_genes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def filter_genes_output(filter_genes, path_file, outdir):
with open(outdir + "/" + path_file + ".probabilistic_network", 'r') as filedata:
inputFilelines = filedata.readlines()
with open(outdir + "/" + path_file + ".probabilistic_network", 'w') as filedata:
for textline in inputFilelines:
textline_spl = textline.split(",")
if textline_spl[1].replace("\n","") not in set(filter_genes):
filedata.write(textline)
with open(outdir + "/" + path_file + ".probabilistic_network.desc", 'r') as filedata:
inputFilelines = filedata.readlines()
with open(outdir + "/" + path_file + ".probabilistic_network.desc", 'w') as filedata:
for textline in inputFilelines:
if textline.replace("\n","") not in set(filter_genes):
filedata.write(textline)