rapids_singlecell.gr.neighbors.RadiusBuilder#

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

Connect observations within a radius or an inclusive (min, max) interval.

Parameters:
radius float | tuple[float, float]

Maximum inclusive Euclidean distance, or an inclusive (min, max) interval.

transform str | None (default: None)

Connectivity transform: None, "spectral" (normalization by column degrees), or "cosine" (similarity between connectivity rows). Applied after pruning and adding the requested diagonal; distances are unchanged.

set_diag bool (default: False)

Whether to set connectivity self-loops before transforming the graph. Distance diagonals are zero; cosine can create connectivity self-loops even when this is False.

percentile float | None (default: None)

Prune edges above this distance percentile (0 to 100) independently per library, after radius pruning. Stored zeros, including the diagonal, contribute to the percentile. None disables percentile pruning.

Methods table#

build(coords)

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

build_graph(coords[, codes])

Build raw graphs, independently within each library of codes.

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]

build_graph(coords, codes=None)[source]#

Build raw graphs, independently within each library of codes.

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.

uns_params()[source]#

Return graph parameters to store in adata.uns.

Return type:

dict[str, Any]

Returns:

dict Serializable graph-construction parameters.