MemoryLoomLayer (class)

A MemoryLoomLayer represents a layer of data residing in RAM only, and provides a numpy ndarray-like interface. They are typically obtained by creating a LoomView on the LoomConnection.

with loompy.connect("mydataset.loom") as ds:
    for (ix, selection, view) in ds.scan(axis=1):
        # Here, the matrix returned resides only in RAM and
        # each iteration gives a slab out of the full matrix
        print(view.layers["spliced"][0, :])
class loompy.MemoryLoomLayer(name: str, matrix: numpy.ndarray)[source]

A layer residing in memory (without a corresponding layer on disk), typically as part of a loompy.LoomView. MemoryLoomLayer supports a subset of the operations suported for regular layers.

__init__(name: str, matrix: numpy.ndarray) → None[source]

Initialize self. See help(type(self)) for accurate signature.

name = None

Name of the layer

shape = None

Shape of the layer

sparse(rows: numpy.ndarray, cols: numpy.ndarray) → scipy.sparse.coo.coo_matrix[source]

Return the layer as scipy.sparse.coo_matrix

permute(ordering: numpy.ndarray, *, axis: int) → None[source]

Permute the layer along an axis

Parameters
  • axis – The axis to permute (0, permute the rows; 1, permute the columns)

  • ordering – The permutation vector