Skip to content

Commit

Permalink
Update feature description
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmymathews committed Aug 1, 2024
1 parent 57bebd6 commit 0586beb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
spatial autocorrelation For a given cell phenotype (first specifier), i.e. cell set, the p-value associated with the Moran I statistic value for this cell set, with respect to the standard null distribution for this statistic.
neighborhood enrichment For two given cell phenotypes (first and second specifiers), the estimated p-value (CDF of z-score) of the number of occurrences of neighbor relations between two cells of the given respective phenotypes, the z-score computed in reference to a bootstrapped empirical distribution constructed using 1000 random permutations of the cell set with labels fixed.
co-occurrence For two given cell phenotypes (first and second specifiers), and a given radius (third specifier), the ratio of the two probabilities of occurrence of the first phenotype within the given radius around some cell, calculated with and without conditioning on at least one occurrence of the second phenotype in the same radius.
ripley For a given cell phenotype (first specifier), the p-value associated with the Ripley F-statistic for the point set of cell locations, at the radius scale for which this p-value is smallest.
ripley For a given cell phenotype (first specifier), the radius scale which is the expected value with respect to the p-values associated with elevated Ripley F-statistic for the point set of cell locations, that is, a radius scale at which non-trivial clustering is observed in the Ripley F sense.
gnn importance score For a given cohort stratification variable (the specifier), the integer rank of each cell (the subjects of the feature) with respect to the importance scores derived from a GNN trained on this variable.
population fractions For a given cell phenotype, the average number of cells of that phenotype in the given sample relative to the number of cells in the sample.
proximity For a given cell phenotype (first specifier), the average number of cells of a second phenotype (second specifier) within a specified radius (third specifier).
1 change: 1 addition & 0 deletions spatialprofilingtoolbox/ondemand/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def _compute(self, job: Job) -> None:
except Exception as error:
logger.error(error)
print_exception(type(error), error, error.__traceback__)
self._no_value_wrapup(job)
finally:
generic_handler.disalarm()

Expand Down
3 changes: 2 additions & 1 deletion spatialprofilingtoolbox/workflow/common/squidpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def ripley_custom(

pvalues /= n_simulations + 1
# pvalues = np.minimum(pvalues, 1 - pvalues)
pvalues = 1 - pvalues

obs_df = _reshape_res(obs_arr.T, columns=le.classes_, index=bins, var_name=cluster_key)
sims_df = _reshape_res(sims.T, columns=np.arange(n_simulations), index=bins, var_name="simulations")
Expand Down Expand Up @@ -230,7 +231,7 @@ def _summarize_ripley(unstructured_metrics: dict[str, NDArray[Any]]) -> float |
total_p = np_sum(pvalues)
if len(bins) != len(pvalues) or total_p == 0:
return None
return inner(pvalues, bins) / np_sum(pvalues)
return round(inner(pvalues, bins) / total_p, 1)


def _summarize_spatial_autocorrelation(unstructured_metrics: DataFrame) -> float | None:
Expand Down

0 comments on commit 0586beb

Please sign in to comment.