liana.method.cellchat.__call__#
- cellchat.__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. Seeli.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 bygroupby) to be considered for downstream analysis.groupby_pairs (
DataFrame|None(default:None)) – A DataFrame with columnssourceandtargetto 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 thelogfcmethod.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 byscanpy.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 theexpr_propthreshold. Ligand-receptor pairs that do not pass theexpr_propthreshold will be assigned to the worst score of the ones that do.Falseby default.key_added (
str(default:'liana_res')) – Key under which the results will be stored inadata.unsifinplaceis 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_groupsis 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 viaresource_nameinteractions (
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 viaresourceandresource_name.spatial_key (
str(default:'spatial')) – Key inadata.obsmthat contains the spatial coordinates. Default is'spatial'.spatial_kwargs (
dict|None(default:None)) – Keyword arguments passed toliana.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 toli.fun.mdata_to_anndataifadatais an instance ofMuData. 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.
- Return type:
DataFrame|None- Returns:
If
inplace = False, returns aDataFramewith ligand-receptor results Otherwise, modifies theadataobject with the following key:anndata.AnnData.uns[`key_added`]with the aforementioned DataFrame