liana.multi.adata_to_views¶
- liana.multi.adata_to_views(adata: AnnData, groupby: str, sample_key: str, obs_keys: list | None = None, view_sep: str = ':', min_count: int = 10, min_total_count: int = 15, large_n: int = 10, min_prop: float = 0.1, keep_stats: bool = False, verbose: bool = False, **kwargs)¶
Converts an AnnData object to a MuData object with views that represent an aggregate for each entity in adata.obs[groupby].
- Parameters:
- adata
Annotated data object.
- groupby
Key to be used for grouping.
- sample_key
key in adata.obs to use for grouping by sample or context.
- obs_keys:
Column names in adata.obs to merge with the MuData object
- view_sep:
Separator to use when assigning adata.var_names to views
- min_count:
Minimum number of counts per gene per sample to be included in the pseudobulk.
- min_total_count:
Minimum number of counts per sample to be included in the pseudobulk.
- large_n:
Number of samples per group that is considered to be “large”.
- min_prop:
Minimum proportion of samples that must have a count for a gene to be included in the pseudobulk.
- keep_stats:
If True, keep the pseudobulk statistics in mdata.uns[‘psbulk_stats’]. Default is False.
- verbose
Verbosity flag.
- **kwargs
Keyword arguments used to aggregate the values per cell into views. See dc.filter_by_expr for more details.
- Returns:
- Returns a MuData object with views that represent an aggregate for each entity in adata.obs[groupby].