comparison seg2matrix/mapSegToGeneMatrix.py @ 54:59dbe857f5d4

introduce normal_CNV parameter
author jingchunzhu
date Thu, 17 Sep 2015 22:03:04 -0700
parents 728eda331f07
children bf57076e27b9
comparison
equal deleted inserted replaced
53:7de3db823f90 54:59dbe857f5d4
5 import CGData.GeneMap 5 import CGData.GeneMap
6 import segToProbeMap 6 import segToProbeMap
7 7
8 if __name__ == "__main__": 8 if __name__ == "__main__":
9 9
10 if len(sys.argv[:])!=4: 10 if len(sys.argv[:])!=5:
11 print "python mapSegToGeneMatrix.py genomicsSegmentIn refGene GeneLevelMatrixOut\n" 11 print "python mapSegToGeneMatrix.py genomicsSegmentIn refGene GeneLevelMatrixOut NORMAL_CNV\n"
12 sys.exit() 12 sys.exit()
13 refgene = CGData.RefGene.RefGene() 13 refgene = CGData.RefGene.RefGene()
14 refgene.load( sys.argv[2] ) 14 refgene.load( sys.argv[2] )
15
16 NORMAL_CNV=sys.argv[4]
15 17
16 #* b for cnv 18 #* b for cnv
17 probeMapper = CGData.GeneMap.ProbeMapper('b') 19 probeMapper = CGData.GeneMap.ProbeMapper('b')
18 20
19 fin =open(sys.argv[1],'r') 21 fin =open(sys.argv[1],'r')
72 for gene in genes.keys(): 74 for gene in genes.keys():
73 fout.write(gene) 75 fout.write(gene)
74 for sample in sample_list: 76 for sample in sample_list:
75 list = matrix[samples[sample]][genes[gene]] 77 list = matrix[samples[sample]][genes[gene]]
76 if len(list)==0: 78 if len(list)==0:
77 average =0 79 average = NORMAL_CNV
78 elif len(list)==1: 80 elif len(list)==1:
79 average = list[0] 81 average = list[0]
80 average =round(average,3) 82 average =round(average,3)
81 else: 83 else:
82 total=0.0 84 total=0.0