spatialHeterogeneity.neighborhood.estimators module¶
Summary¶
Functions:
Compute infiltration score. |
|
Compute interaction strength between species. |
|
Compute Ripley’s K as implemented by 1. |
Reference¶
-
interactions(so, spl, attr, mode='classic', prediction_type='observation', *, n_permutations=100, random_seed=None, alpha=0.01, try_load=True, key_added=None, graph_key='knn', inplace=True)[source]¶ Compute interaction strength between species.
- Parameters
so – SpatialOmics instance
spl (
str) – Spl for which to compute the metricattr (
str) – Categorical feature in SpatialOmics.obs to use for the groupingmode (
str) – One of {classic, histoCAT, proportion}, see notesn_permutations (
int) – Number of permutations to compute p-values and the interactions strength score (mode diff)random_seed – Random seed for permutations
alpha (
float) – Threshold for significanceprediction_type (
str) – One of {observation, pvalue, diff}, see Notestry_load (
bool) – load pre-computed permutation results if availablekey_added (
Optional[str]) – Key added to SpatialOmics.uns[spl][metric][key_added]graph_key (
str) – Specifies the graph representation to use in so.G[spl] if local=True.inplace (
bool) – Whether to add the metric to the current SpatialOmics instance or to return a new one.
Returns:
- Return type
None
-
infiltration(so, spl, attr, *, interaction1=('tumor', 'immune'), interaction2=('immune', 'immune'), add_key='infiltration', inplace=True, graph_key='knn', local=False)[source]¶ Compute infiltration score.
- Parameters
so – SpatialOmics instance
spl (
str) – Spl for which to compute the metricattr (
str) – Categorical feature in SpatialOmics.obs to use for the groupinginteraction1 – labels of enumerator interaction
interaction2 – labels of denominator interaction
key_added – Key added to SpatialOmics.uns[spl][metric][key_added]
inplace – Whether to add the metric to the current SpatialOmics instance or to return a new one.
graph_key – Specifies the graph representation to use in so.G[spl] if local=True.
Returns:
- Return type
None
-
ripleysK(so, spl, attr, id, *, mode='K', radii=None, correction='ripley', inplace=True, key_added=None)[source]¶ Compute Ripley’s K as implemented by 1.
- Parameters
so – SpatialOmics instance
spl (
str) – Spl for which to compute the metricattr (
str) – Categorical feature in SpatialOmics.obs to use for the groupingid – The category in the categorical feature attr, for which Ripley’s K should be computed
mode – {K, csr-deviation}. If K, Ripley’s K is estimated, with csr-deviation the deviation from a poission process is computed.
radii – List of radiis for which Ripley’s K is computed
correction – Correction method to use to correct for boarder effects, see [1].
inplace – Whether to add the metric to the current SpatialOmics instance or to return a new one.
key_added – Key added to SpatialOmics.uns[spl][metric][key_added]
- Returns
Ripley’s K estimates
References