liana.method.logfc.__call__

Contents

liana.method.logfc.__call__#

logfc.__call__(groupby, resource_name='consensus', expr_prop=0.1, min_cells=5, groupby_pairs=None, base=np.float64(2.718281828459045), supp_columns=None, return_all_lrs=False, key_added='liana_res', use_raw=True, layer=None, de_method='t-test', n_perms=1000, seed=1337, n_jobs=1, resource=None, interactions=None, spatial_key='spatial', spatial_kwargs=None, mdata_kwargs=None, inplace=True, verbose=False)#

Run a ligand-receptor method.

Parameters:
  • adata (AnnData | MuData) – Annotated data object.

  • groupby (str) – Key to be used for grouping.

  • resource_name (str (default: 'consensus')) – Name of the resource to be used for ligand-receptor inference. See li.rs.show_resources() for available resources.

  • expr_prop (float (default: 0.1)) – Minimum expression proportion for the ligands and receptors (+ their subunits) in the corresponding cell identities. Set to 0 to return unfiltered results.

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

  • groupby_pairs (DataFrame | None (default: None)) – A DataFrame with columns source and target to be used to subset the possible combinations of interacting cell types. If None, all possible combinations are used.

  • base (float (default: np.float64(2.718281828459045))) – Exponent base used to reverse the log-transformation of the matrix. Relevant only for the logfc method.

  • supp_columns (list | None (default: None)) – Additional columns to be added from any of the methods implemented in liana, or any of the columns returned by scanpy.tl.rank_genes_groups, each starting with ligand_* or receptor_*. For example, ['ligand_pvals', 'receptor_pvals']. None by default.

  • return_all_lrs (bool (default: False)) – Bool whether to return all ligand-receptor pairs, or only those that surpass the expr_prop threshold. Ligand-receptor pairs that do not pass the expr_prop threshold will be assigned to the worst score of the ones that do. False by default.

  • key_added (str (default: 'liana_res')) – Key under which the results will be stored in adata.uns if inplace is True.

  • use_raw (bool | None (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.

  • de_method (str (default: 't-test')) – Differential expression method. scanpy.tl.rank_genes_groups is used to rank genes according to 1vsRest. The default method is ‘t-test’.

  • n_perms (int (default: 1000)) – Number of permutations for the permutation test. If None, no p-values are computed.

  • seed (int (default: 1337)) – Random seed for reproducibility.

  • n_jobs (int (default: 1)) – Number of jobs to run in parallel.

  • resource (DataFrame | None (default: None)) – A pandas dataframe with [ligand, receptor] columns. If provided will overrule the resource requested via resource_name

  • 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 via resource and resource_name.

  • spatial_key (str (default: 'spatial')) – Key in adata.obsm that contains the spatial coordinates. Default is 'spatial'.

  • spatial_kwargs (dict | None (default: None)) – Keyword arguments passed to liana.utils.spatial_pair_proximity() for computing spatial proximity weights. Default is None, which uses default values (bandwidth=250, kernel=’gaussian’, trim_fraction=0.1).

  • mdata_kwargs (dict | None (default: None)) – Keyword arguments to be passed to li.fun.mdata_to_anndata if adata is an instance of MuData. If an AnnData object is passed, these arguments are ignored.

  • inplace (bool (default: True)) – Whether to store results in place, or else to return them.

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

Return type:

DataFrame | None

Returns:

If inplace = False, returns a DataFrame with ligand-receptor results Otherwise, modifies the adata object with the following key: