mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-16 05:07:55 +08:00
This PR contains a refactoring to make adding new features easier. The new features include supporting the tiledb format, and the multi dataset application. The refactoring includes Simplifying the directory structure and files. a class structure to handle annotations (currently one type: AnnotationsLocalFile). a class to handle application configuration a class structure to handle matrix data (currently AnndataAdaptor and CxgAdaptor). CxgAdaptor uses tiledb. Algorithms that were previously dependent on the scanpy anndata object are now generalized to work with an abstract interface. The multi dataset option is not fully supported yet, and so the option to use it is hidden. Use "cli launch --dataroot ..." To access this feature. All combinations of app single dataset/ app multi dataset and AnndataAdaptor/CxgAdaptor work with all the features, such as annotations, ontologies, diffexp.
99 lines
3.6 KiB
Python
99 lines
3.6 KiB
Python
# automatically generated by the FlatBuffers compiler, do not modify
|
|
|
|
# namespace: NetEncoding
|
|
|
|
import flatbuffers
|
|
|
|
class Matrix(object):
|
|
__slots__ = ['_tab']
|
|
|
|
@classmethod
|
|
def GetRootAsMatrix(cls, buf, offset):
|
|
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
|
x = Matrix()
|
|
x.Init(buf, n + offset)
|
|
return x
|
|
|
|
# Matrix
|
|
def Init(self, buf, pos):
|
|
self._tab = flatbuffers.table.Table(buf, pos)
|
|
|
|
# Matrix
|
|
def NRows(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
|
if o != 0:
|
|
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
|
|
return 0
|
|
|
|
# Matrix
|
|
def NCols(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
|
if o != 0:
|
|
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
|
|
return 0
|
|
|
|
# Matrix
|
|
def Columns(self, j):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
|
if o != 0:
|
|
x = self._tab.Vector(o)
|
|
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
|
x = self._tab.Indirect(x)
|
|
from .Column import Column
|
|
obj = Column()
|
|
obj.Init(self._tab.Bytes, x)
|
|
return obj
|
|
return None
|
|
|
|
# Matrix
|
|
def ColumnsLength(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
|
if o != 0:
|
|
return self._tab.VectorLen(o)
|
|
return 0
|
|
|
|
# Matrix
|
|
def ColIndexType(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
|
if o != 0:
|
|
return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
|
|
return 0
|
|
|
|
# Matrix
|
|
def ColIndex(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
|
if o != 0:
|
|
from flatbuffers.table import Table
|
|
obj = Table(bytearray(), 0)
|
|
self._tab.Union(obj, o)
|
|
return obj
|
|
return None
|
|
|
|
# Matrix
|
|
def RowIndexType(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
|
if o != 0:
|
|
return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
|
|
return 0
|
|
|
|
# Matrix
|
|
def RowIndex(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
|
if o != 0:
|
|
from flatbuffers.table import Table
|
|
obj = Table(bytearray(), 0)
|
|
self._tab.Union(obj, o)
|
|
return obj
|
|
return None
|
|
|
|
def MatrixStart(builder): builder.StartObject(7)
|
|
def MatrixAddNRows(builder, nRows): builder.PrependUint32Slot(0, nRows, 0)
|
|
def MatrixAddNCols(builder, nCols): builder.PrependUint32Slot(1, nCols, 0)
|
|
def MatrixAddColumns(builder, columns): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(columns), 0)
|
|
def MatrixStartColumnsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
|
def MatrixAddColIndexType(builder, colIndexType): builder.PrependUint8Slot(3, colIndexType, 0)
|
|
def MatrixAddColIndex(builder, colIndex): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(colIndex), 0)
|
|
def MatrixAddRowIndexType(builder, rowIndexType): builder.PrependUint8Slot(5, rowIndexType, 0)
|
|
def MatrixAddRowIndex(builder, rowIndex): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(rowIndex), 0)
|
|
def MatrixEnd(builder): return builder.EndObject()
|