-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMultiMappedGenes.py
More file actions
executable file
·43 lines (32 loc) · 1013 Bytes
/
MultiMappedGenes.py
File metadata and controls
executable file
·43 lines (32 loc) · 1013 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
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
import sys
allPairwise = []
for line in sys.stdin:
vals=line.split()
allPairwise.append(vals)
i=0
toFilter = {}
toKeep = {}
while i < len(allPairwise):
geneStart = i
geneEnd = i+1
overlappedGenes={}
#
# Check how many different genes overlap current gene.
allGenes={}
curGene = allPairwise[geneStart][3]
while geneEnd < len(allPairwise) and allPairwise[geneEnd][3] == allPairwise[geneStart][3]:
allGenes[allPairwise[geneEnd][15]] = True
allGenes[allPairwise[geneEnd][3]] = True
if allPairwise[geneEnd][15] != allPairwise[geneEnd][3]:
overlappedGenes[allPairwise[geneEnd][15]] = True
geneEnd+=1
i=geneEnd
if curGene not in toFilter:
toKeep[curGene] = True
if len(overlappedGenes) > 0:
for g in overlappedGenes.keys():
if g not in toKeep:
toFilter[g] = True
for f in toFilter.keys():
print(f)