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.
Nonedisables percentile pruning.
- radius
Methods table#
build(coords)Validate
coordsand 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.Return processing steps for the raw adjacency and distances.
Return graph parameters to store in
adata.uns.Methods#
- 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:
- 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.