liana.multi.lrdata_to_mudata

liana.multi.lrdata_to_mudata#

liana.multi.lrdata_to_mudata(lrdata, xy_sep='^', min_cells=5, min_features=10, obs_keys=None, verbose=False)#

Convert an inflow score AnnData object to a MuData object, where each modality corresponds to a unique sender cell type.

Parameters:
  • adata – Annotated data object.

  • xy_sep (str (default: '^')) – Separator between the sender cell-type/view prefix and the ligand-receptor interaction name in lrdata.var_names (e.g. "celltype^ligand^receptor"). Matches the xy_sep convention used by liana.method.inflow(). Defaults to '^'.

  • min_cells (int | None (default: 5)) – Minimum cells (per cell identity if grouped by groupby) to be considered for downstream analysis.

  • min_features (int | None, default 10) – Modalities with fewer than this many features after cell-filtering are dropped entirely. Pass None to keep all modalities.

  • obs_keys (list[str] | None (default: None)) – List of keys in lrdata.obs that should be included in the MuData object.

  • verbose (bool (default: False)) – Verbosity flag.

Return type:

MuData

Returns:

MuData MuData object with one modality per sender cell type.

Raises:
  • TypeError – If lrdata is not an AnnData object.

  • ValueError – If any of the provided keys are not found in lrdata.obs.

Examples

>>> mdata = lrdata_to_mudata(lrdata, min_cells=5, min_features=10)