-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgetvarientcounts.py
More file actions
38 lines (32 loc) · 962 Bytes
/
Copy pathgetvarientcounts.py
File metadata and controls
38 lines (32 loc) · 962 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
import sys
infile1 = open(sys.argv[1], 'r')
infile2 = open(sys.argv[2], 'r')
outfile = open(sys.argv[3], 'w')
genedict1 = {}
genedict2 = {}
for line in infile1:
line = line.split("\t")
gene = line[0]
poslist = line[1:-1]
variants = len(poslist[::2])
# for item in poslist[1::2]:
# if int(item) > 1:
# variants.append(
#
genedict1[gene] = variants
for line in infile2:
line = line.split("\t")
gene = line[0]
poslist = line[1:-1]
variants = len(poslist[::2])
#variants =
for item in poslist[1::2]:
if int(item) > 1:
#variants.append(
genedict2[gene] = variants
tmp = [k for k in genedict2 if k in genedict1]
for gene in tmp:
if genedict1[gene] < genedict2[gene]:
outfile.write("%s\t%s|%s\n" % (gene,genedict1[gene], genedict2[gene]))
#if set(genedict1[gene]) & set(genedict2[gene]):
#outfile.write("%s\n" % gene)