athena.neighborhood.base_estimators module¶
Summary¶
Classes:
Estimator to quantify interaction strength between different species in the sample. |
|
Reference¶
-
class
Interactions
(so, spl, attr='meta_id', mode='classic', n_permutations=500, random_seed=None, alpha=0.01, graph_key='knn')[source]¶ Bases:
object
Estimator to quantify interaction strength between different species in the sample.
-
VALID_MODES
= ['classic', 'histoCAT', 'proportion']¶
-
VALID_PREDICTION_TYPES
= ['pvalue', 'observation', 'diff']¶
-
__init__
(so, spl, attr='meta_id', mode='classic', n_permutations=500, random_seed=None, alpha=0.01, graph_key='knn')[source]¶ Estimator to quantify interaction strength between different species in the sample.
- Parameters
so – SpatialOmics
spl (
str
) – Sample for which to compute the interaction strengthattr (
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 significancegraph_key (
str
) – Specifies the graph representation to use in so.G[spl] if local=True.
Notes
classic and histoCAT are python implementations of the corresponding methods pubished by the Bodenmiller lab at UZH. The proportion method is similar to the classic method but normalises the score by the number of edges and is thus bound [0,1].
-
fit
(prediction_type='observation', try_load=True)[source]¶ Compute the interactions scores for the sample.
- Parameters
prediction_type (
str
) – One of {observation, pvalue, diff}, see Notestry_load (
bool
) – load pre-computed permutation results if available
Returns:
Notes
observation: computes the observed interaction strength in the sample
pvalue: computes the P-value of a two-sided t-test for the interactions strength based on the random permutations
diff: computes the difference between observed and average interaction strength (across permutations)
- Return type
None
-
-
class
RipleysK
(so, spl, id, attr)[source]¶ Bases:
object
-
__init__
(so, spl, id, attr)[source]¶ Compute Ripley’s K for a given sample and group.
- Parameters
so – SpatialOmics
spl (
str
) – Sample for which to compute the interaction strengthid – The category in the categorical feature attr, for which Ripley’s K should be computed
attr (
str
) – Categorical feature in SpatialOmics.obs to use for the groupinggraph_key – Specifies the graph representation to use in so.G[spl] if local=True.
-
predict
(radii, correction='ripley', mode='K')[source]¶ Estimate Ripley’s K
- Parameters
radii (
list
) – List of radiis for which Ripley’s K is computedcorrection (
str
) – Correction method to use to correct for boarder effects, see [1].mode (
str
) – {K, csr-deviation}. If K, Ripley’s K is estimated, with csr-deviation the deviation from a poission process is computed.
- Returns
Ripley’s K estimates
Notes
-