rapids_singlecell.gr.neighbors.GraphBuilderCSR#

class rapids_singlecell.gr.neighbors.GraphBuilderCSR(transform=None, set_diag=False, percentile=None, postprocessors=())[source]#

CuPy CSR strategy that builds from finite float32 coordinates.

Parameters:
transform str | None (default: None)

Transform setting stored on the builder: None, "spectral", or "cosine". Subclasses or postprocessors implement its effect.

set_diag bool (default: False)

Diagonal setting stored on the builder for use by subclasses.

percentile float | None (default: None)

Distance percentile setting stored on the builder for use by subclasses or postprocessors. None disables percentile pruning.

postprocessors Sequence[Callable[[csr_matrix, csr_matrix], tuple[csr_matrix, csr_matrix]]] (default: ())

Ordered callables taking connectivity and distance matrices and returning the processed pair. Custom builders control which steps are applied.

Methods table#

build(coords)

Validate coords and build the (adjacency, distances) graphs.

build_graph(coords)

Construct raw adjacency and distance matrices.

combine(mats, ixs)

Stack per-library graphs block-diagonally, in the original observation order ixs.

postprocessors()

Return processing steps for the raw adjacency and distances.

uns_params()

Return graph parameters to store in adata.uns.

Methods#

build(coords)[source]#

Validate coords and build the (adjacency, distances) graphs.

Return type:

tuple[csr_matrix, csr_matrix]

abstractmethod build_graph(coords)[source]#

Construct raw adjacency and distance matrices.

Parameters:
coords ndarray

Coordinates in the format supported by this builder.

Return type:

tuple[csr_matrix, csr_matrix]

Returns:

connectivities, distances Raw graph matrices before postprocessing.

combine(mats, ixs)[source]#

Stack per-library graphs block-diagonally, in the original observation order ixs.

Return type:

tuple[csr_matrix, csr_matrix]

postprocessors()[source]#

Return processing steps for the raw adjacency and distances.

Return type:

Sequence[Callable[[csr_matrix, csr_matrix], tuple[csr_matrix, csr_matrix]]]

Returns:

Sequence of callables Steps applied in order to the connectivity and distance matrices.

abstractmethod uns_params()[source]#

Return graph parameters to store in adata.uns.

Return type:

dict[str, Any]

Returns:

dict Serializable graph-construction parameters.