liana.pl.lric_divergence#
- liana.pl.lric_divergence(adata=None, uns_key='lric', liana_res=None, feature_a=None, feature_b=None, max_dist=None, transform_fn=<function _log2_floor>, min_bins=3, figure_size=(6, 4), return_fig=True)#
Plot two
transform_fn(g(r))curves and the area between them.The visual companion of
liana.mt.get_lric_divergence(): both curves are drawn over radius, the grey ribbon spans their separation, the dashed line at0marks the null, and the dotted vertical line marksr_star– the radius where the curves diverge most. The title carries the span-normalised divergence andr_star.- Parameters:
- adata
AnnData|None(default:None) Annotated data object. Its
.uns[uns_key]holds the result, read whenliana_resisNone.- 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. Where anadatais accepted too, a frame passed here takes precedence overadata.uns[uns_key], which is only read when this isNone.A
lric/cross_pcfresult.- feature_a
dict[str,object] |None(default:None) Selection of the first curve as
{column: value}over any columns of the result, e.g.dict(interaction="Dcn^Egfr"). It must resolve to a single interaction; seeliana.mt.get_lric_divergence().- feature_b
dict[str,object] |None(default:None) Selection of the second curve; same rules as
feature_a.- max_dist
float|None(default:None) Compare and draw only radii
r < max_dist;Noneuses all radii.- transform_fn
Callable[[NDArray[floating]],NDArray[floating]] (default:<function _log2_floor at 0x75709457a0c0>) Applied to
gbefore comparing; defaults to log2 withgfloored at0.05. Passnumpy.log2to drop non-finite bins instead.- min_bins
int(default:3) Minimum shared finite radius bins required; fewer raises a
ValueError.- figure_size
tuple[float,float] (default:(6, 4)) Figure x,y size
- return_fig
bool(default:True) boolwhether to return the fig object.
- adata
- Return type:
- Returns:
A
plotnine.ggplotifreturn_figelseNone(draws the plot).
Examples
>>> import liana as li >>> adata = li.ds.generate_toy_spatial() >>> li.mt.cross_pcf(adata, groupby="bulk_labels", key_added="cross_pcf") >>> p = li.pl.lric_divergence( ... adata, ... "cross_pcf", ... feature_a=dict(source="CD14+ Monocyte", target="CD34+"), ... feature_b=dict(source="CD14+ Monocyte", target="CD19+ B"), ... )