liana.method.lric.__call__#
- lric.__call__(resource=None, resource_name=None, interactions=None, groupby=None, spatial_key='spatial', max_radius=200, radius_step=20, annulus_width=20, extend_first_annulus=True, cell_types=None, min_cells=5, min_expressing=0, n_angle_samples=360, complex_sep='_', transform_fn=None, use_raw=True, layer=None, key_added='lric', inplace=True, verbose=False)#
Ligand-Receptor Interaction Correlation (LRIC).
Computes an expression-weighted cross-PCF
g(r): each cell’s contribution at distanceris weighted by its ligand and receptor expression, sog(r) > 1flags ligand- and receptor-expressing cells that are spatially co-enriched beyond cell-type co-localisation alone — candidate ligand-receptor interactions that are both proximal and co-expressed.When
groupbyisNone(default), all cells are treated as potential senders and receivers (self-pairs excluded), providing a global screen for LR pairs with strong spatial co-enrichment signal. Result dict keys:pair_names,radii,lric(shape(n_bins, n_pairs)).When
groupbyis a column name inadata.obs, the LRIC is computed for every directed sender→receiver cell-type pair. Result dict keys:cell_types,pair_names,radii,resultsmapping(sender, receiver)tuples to(n_bins, n_pairs)arrays.- Parameters:
adata (
AnnData) – Annotated data object.resource (
DataFrame|None(default:None)) – A pandas dataframe with [ligand,receptor] columns. If provided will overrule the resource requested viaresource_nameresource_name (
str|None(default:None)) – Name of the resource to be used for ligand-receptor inference. Seeli.rs.show_resources()for available resources.interactions (
list|None(default:None)) – List of tuples with ligand-receptor pairs[(ligand, receptor), ...]to be used for the analysis. If passed, it will overrule the resource requested viaresourceandresource_name.groupby (
str|None(default:None)) – Column inadata.obsused to define cell types.Noneruns the cell-type-agnostic mode across all cells.spatial_key (
str(default:'spatial')) – Key inadata.obsmthat contains the spatial coordinates. Default is'spatial'.max_radius (
float(default:200)) – Inner edge of the last (widest) annulus bin; the outer edge extends tomax_radius + annulus_width.radius_step (
float(default:20)) – Step between successive annulus inner edges.annulus_width (
float(default:20)) – Ring width of each annulus.extend_first_annulus (
bool(default:True)) – IfTrue(default), extend the first annulus inward to start at radius 0 (spanning[0, radius_step + annulus_width)) rather than atradius_step. Cell centroids cannot lie closer than ~one cell diameter, so the innermost band is otherwise a thin, near-empty, high-variance bin; extending it folds genuine cell-cell contact (juxtacrine) pairs into the first bin instead of discarding them.Falsekeeps the first annulus at[radius_step, radius_step + annulus_width).cell_types (
Iterable[str] |None(default:None)) – Subset of cell types to consider (only whengroupbyis set). Defaults to all types inadata.obs[groupby].min_cells (
int(default:5)) – Minimum cells (per cell identity if grouped bygroupby) to be considered for downstream analysis.min_expressing (
int(default:0)) – Minimum number of cells (within the relevant population: each cell∂ type in pairwise mode, all cells in agnostic mode) that must express the ligand or receptor for an LR pair to be kept; pairs below the threshold are set toNaN. Default0keeps all results.n_angle_samples (
int(default:360)) – Angular resolution for bounding-box edge correction (360 ≈ 0.3 % error).complex_sep (
str|None(default:'_')) – Separator used to identify multi-subunit complexes in the resource (e.g."_"splits"ITGAV_ITGB3"into its subunits and adds the minimum-subunit expression as a new column inadata.var). Set toNoneto skip complex handling.transform_fn (
Callable[[ndarray],ndarray] |None(default:None)) – Expression transform applied to ligand and receptor matrices, defaulting to mean→1 normalization (_linear_transform()). It is applied per population: globally in agnostic mode, within each cell type in pairwise mode.use_raw (
bool(default:True)) – Use raw attribute of adata if present.layer (
str|None(default:None)) – Layer in anndata.AnnData.layers to use. If None, use anndata.AnnData.X.key_added (
str(default:'lric')) – Key under which the results will be stored inadata.unsifinplaceis True.inplace (
bool(default:True)) – Whether to store results in place, or else to return them.verbose (
bool(default:False)) – Verbosity flag.
- Return type:
- Returns:
dictifinplace=False, elseNone.