annotate seg2matrix/CGData/GenomicMatrix.py @ 31:ab20c0d04f4a

add seg2matrix tool
author jingchunzhu
date Fri, 24 Jul 2015 13:10:11 -0700
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
1
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
2 import csv
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
3 import CGData
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
4 import CGData.BaseMatrix
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
5
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
6 class GenomicMatrix(CGData.BaseMatrix.BaseMatrix):
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
7
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
8 __format__ = {
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
9 "name" : "genomicMatrix",
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
10 "type" : "type",
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
11 "form" : "matrix",
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
12 "rowType" : "probeMap",
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
13 "colType" : "idMap",
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
14 "valueType" : "float",
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
15 "nullString" : "NA",
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
16 "links" : {
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
17 "dataSubType" : {}
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
18 }
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
19 }
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
20
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
21 def __init__(self):
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
22 CGData.BaseMatrix.BaseMatrix.__init__(self)
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
23
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
24 def init_blank(self, cols, rows):
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
25 super(GenomicMatrix, self).init_blank(cols=cols,rows=rows)
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
26 if 'cgdata' not in self:
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
27 self['cgdata'] = { 'type' : 'genomicMatrix' }
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
28
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
29 def get_probe_list(self):
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
30 return self.get_row_list()
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
31
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
32 def get_sample_list(self):
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
33 return self.get_col_list()
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
34
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
35 def get_data_subtype(self):
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
36 return self.get('cgdata', {}).get('dataSubType', None)
ab20c0d04f4a add seg2matrix tool
jingchunzhu
parents:
diff changeset
37