本文整理汇总了Python中IOTools.readMatrix方法的典型用法代码示例。如果您正苦于以下问题:Python IOTools.readMatrix方法的具体用法?Python IOTools.readMatrix怎么用?Python IOTools.readMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOTools
的用法示例。
在下文中一共展示了IOTools.readMatrix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: import IOTools [as 别名]
# 或者: from IOTools import readMatrix [as 别名]
def __call__(self, track, slice=None):
fn = "ortholog_pairs_with_feature.matrix2"
if not os.path.exists(fn):
return
x = IOTools.openFile(fn)
matrix, rownames, colnames = IOTools.readMatrix(x)
return odict((("matrix", matrix), ("rows", rownames), ("columns", colnames)))
示例2: __call__
# 需要导入模块: import IOTools [as 别名]
# 或者: from IOTools import readMatrix [as 别名]
def __call__(self, track, slice = None):
fn = os.path.join( DATADIR, "%(track)s.peakshape.tsv.gz.matrix_%(slice)s.gz" % locals() )
if not os.path.exists( fn ):
return
matrix, rownames, colnames = IOTools.readMatrix( IOTools.openFile( fn ))
nrows = len(rownames)
if nrows == 0: return
if nrows > 1000:
take = numpy.array( numpy.floor( numpy.arange( 0, nrows, nrows / 1000 ) ), dtype = int )
rownames = [ rownames[x] for x in take ]
matrix = matrix[ take ]
return odict( (('matrix', matrix),
('rows', rownames),
('columns', colnames)) )
示例3: __call__
# 需要导入模块: import IOTools [as 别名]
# 或者: from IOTools import readMatrix [as 别名]
def __call__(self, track, slice = None):
pattern = self.pattern
fn = os.path.join( DATADIR, "liver_vs_testes/%(track)s%(pattern)s.matrix_%(slice)s.gz" % locals() )
if not os.path.exists( fn ):
return
x = IOTools.openFile( fn )
matrix, rownames, colnames = IOTools.readMatrix( x )
nrows = len(rownames)
if nrows == 0: return
if nrows > self.scale:
take = numpy.array( numpy.floor( numpy.arange( 0, nrows, float(nrows + 1) / self.scale ) ), dtype = int )
rownames = [ rownames[x] for x in take ]
matrix = matrix[ take ]
return odict( (('matrix', matrix),
('rows', rownames),
('columns', colnames)) )