liana.mt.get_lric_auc#
- liana.mt.get_lric_auc(adata=None, uns_key='lric', liana_res=None, max_dist=None, transform_fn=<function _log2_floor>, min_bins=3)#
Summarise a
lric/cross_pcfresult into one score per interaction.Each interaction’s
g(r)profile is reduced to the span-normalised area under itslog2 g(r)curve – a mean log2 fold change:> 0co-enriched,< 0depleted,0random.- Parameters:
- adata
AnnData|None(default:None) Annotated data object. Its
.uns[uns_key]holds the result. Mutually exclusive withliana_res.- uns_key
str(default:'lric') Key in
adata.unsthat contains the LIANA results. Default is'liana_res'.- liana_res
DataFrame|None(default:None) liana_resaDataFramein liana’s format.A
lric/cross_pcfresult, used whenadataisNone.- max_dist
float|None(default:None) Integrate only over radii
r < max_dist;Noneuses all radii.- transform_fn
Callable[[NDArray[floating]],NDArray[floating]] (default:<function _log2_floor at 0x7e3fd8445c60>) Applied to
gbefore integrating; defaults to log2 withgfloored at0.05, so empty/depleted bins stay finite and count as strong depletion. Passnumpy.log2for the strict behaviour where non-finite values (e.g.log2(0) = -inf) are dropped from the integral.- min_bins
int(default:3) Drop interactions with fewer than this many finite bins in the window (a support gate for
expr_prop-masked / degenerate interactions).
- adata
- Return type:
- Returns:
A
pandas.DataFramewith the id columns of the input (whichever ofsource,target,ligand_complex,receptor_complex,interactionare present) plusscoreandpeak_radius– the radius at which|transform_fn(g)|is largest, i.e. where the interaction deviates most from the null – sorted most-enriched first. The column names matchliana.pl.dotplot()’s expectations. Empty if nothing clearsmin_bins.
Examples
Rank the interactions of a spatial result by how co-enriched they are across radius – here the cell-type-agnostic LRIC of
liana.mt.lric.__call__():>>> import liana as li >>> adata = li.ds.generate_toy_spatial() >>> li.mt.lric(adata, resource_name="consensus", key_added="lric") >>> scores = li.mt.get_lric_auc(adata, uns_key="lric")