-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2018_0512_EnsembleVariantCALLERS_combination_counter.py
60 lines (42 loc) · 1.4 KB
/
2018_0512_EnsembleVariantCALLERS_combination_counter.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import os, sys, re, string
import datetime, subprocess
import operator
inputFile = sys.argv [ 1 ]
myInput = open(inputFile,'r')
myList = myInput.readlines()
#CALLERS_list=[] #Holds all different variant types
CALLERS_list={} #Holds all different variant types
#################################################################################################
# Following code gets a list (VT_list) of all variant types found in the provided VCF file at the command line
for myLine in myList:
if '#' in myLine:
continue
else:
spline=myLine.split("\t")
# Break up the information column
InforColumn=spline[7].split(";")
for el in InforColumn:
if "CALLERS" in el:
caller=el.strip("CALLERS=")
if caller in CALLERS_list:
CALLERS_list[caller]+=1
else:
CALLERS_list[caller]=1
#print caller
#VT=el[el.index("=")+1:]
#print "VT is: ",VT
#if caller not in CALLERS_list:
#CALLERS_list.append(caller)
#print CALLERS_list
print "dict_length: ", len(CALLERS_list)
#for callers in CALLERS_list:
# if CALLERS_list[callers] == 20:
# print callers
# print CALLERS_list[callers]
for callers in CALLERS_list:
print CALLERS_list[callers],"\t",callers
#sorted_CALLERS_list = sorted(CALLERS_list.items(), key=operator.itemgetter(1))
#for j in VT_list:
# print j
#################################################################################################
myInput.close()