rapids_singlecell.gr.ligrec#
- rapids_singlecell.gr.ligrec(adata, cluster_key, *, clusters=None, interactions=None, complex_policy='min', threshold=0.01, corr_method=None, corr_axis='clusters', alpha=0.05, use_raw=True, copy=False, key_added=None, gene_symbols=None, n_perms=1000, interactions_params={}, transmitter_params={'categories': 'ligand'}, receiver_params={'categories': 'receptor'})[source]#
Perform the permutation test as described in [Efremova et al., 2020].
- Parameters:
- adata
AnnData
Annotated data object.
- cluster_key
str
Key in
obs
where clustering is stored.- clusters
list
|None
(default:None
) Clusters from
obs
['{cluster_key}']
. Can be specified either as a sequence oftuple
or just a sequence of cluster names, in which case all combinations considered.- interactions
Union
[DataFrame
,Mapping
,Sequence
,None
] (default:None
) - Interaction to test. The type can be one of:
pandas.DataFrame
- must contain at least 2 columns namedsource
andtarget
.dict
- dictionary with at least 2 keys namedsource
andtarget
.typing.Sequence
- Either a sequence of str, in which case all combinations are produced, or a sequence oftuple
of 2str
or atuple
of 2 sequences.
If
None
, the interactions are extracted from omnipath. Protein complexes can be specified by delimiting the components with_
, such asalpha_beta_gamma
.- complex_policy
Literal
['min'
,'all'
] (default:'min'
) - Policy on how to handle complexes. Valid options are:
min
- select gene with the minimum average expression. This is the same as in [Efremova et al., 2020].all
- select all possible combinations betweensource
andtarget
complexes.
- threshold
float
(default:0.01
) Do not perform permutation test if any of the interacting components is being expressed in less than
threshold
percent of cells within a given cluster.- corr_method
str
|None
(default:None
) Correction method for multiple testing. See
statsmodels.stats.multitest.multipletests()
for valid options.- corr_axis
Literal
['interactions'
,'clusters'
] (default:'clusters'
) - Axis over which to perform the FDR correction. Only used when
corr_method != None
. Valid options are: interactions
- correct interactions by performing FDR correction across the clusters.clusters
- correct clusters by performing FDR correction across the interactions.
- Axis over which to perform the FDR correction. Only used when
- alpha
float
(default:0.05
) Significance level for FDR correction. Only used when
corr_method != None
.- use_raw
bool
(default:True
) Whether to access
raw
- copy
bool
(default:False
) If
True
, return the result, otherwise save it to theadata
object.- key_added
str
|None
(default:None
) Key in
uns
where the result is stored if copy = False. If None, ‘{cluster_key}_ligrec’ will be used.- gene_symbols
str
|None
(default:None
) - n_perms
int
(default:1000
) Number of permutations for the permutation test.
- interactions_params
dict
(default:{}
) Keyword arguments for
omnipath.interactions.import_intercell_network()
defining the interactions. These datasets from [Türei et al., 2016] are used by default: omnipath, pathwayextra, kinaseextra and ligrecextra.- transmitter_params
dict
(default:{'categories': 'ligand'}
) Keyword arguments for
omnipath.interactions.import_intercell_network()
defining the transmitter side of intercellular connections.- receiver_params
dict
(default:{'categories': 'receptor'}
) Keyword arguments for
omnipath.interactions.import_intercell_network()
defining the receiver side of intercellular connections.
- adata
- Return type:
- Returns:
- If
copy = True
, returns a dict with following keys: means
-pandas.DataFrame
containing the mean expression.
pvalues
-pandas.DataFrame
containing the possibly corrected p-values.
metadata
-pandas.DataFrame
containing interaction metadata.
- Otherwise, modifies the adata object with the following key:
uns
['{key_added}']
-the above mentioned dict.
NaN p-values mark combinations for which the mean expression of one of the interacting components was 0 or it didn’t pass the threshold percentage of cells being expressed within a given cluster.
- If