spatialtis_core.geo_analysis
Contents
spatialtis_core.geo_analysis
#
Module Contents#
- spatialtis_core.geo_analysis.getis_ord(points: spatialtis_core.types.Points, bbox: spatialtis_core.types.BoundingBox, search_level: int = 3, quad: Optional[Tuple[int, int]] = None, rect_side: Optional[Tuple[float, float]] = None, pval: float = 0.05, min_cells: int = 10) List[bool] #
Getis-ord analysis to find hot cells
- Parameters
points – A list of points
bbox – The bounding box
search_level – The level of outer-ring to search for
quad – eg.(X, Y) Use X * Y grid to perform analysis
rect_side – eg.(X, Y) Use X * Y rectangle to perform analysis
pval – The threshold for p-value
min_cells – The minimum number of cells to perform analysis
- Returns
A list of bool
- spatialtis_core.geo_analysis.spatial_autocorr(x: numpy.ndarray, neighbors: spatialtis_core.types.Neighbors, labels: spatialtis_core.types.Labels, two_tailed: bool = True, pval: float = 0.05, method: str = 'moran_i') List[Tuple[float, float]] #
Compute spatial auto-correlation value for a 2D array in parallel
The p-value is under the assumption of normal distribution Return is tuples of (spatial_autocorr value, p value)
- Parameters
x – Gene expression matrix, each row is the expression of a gene
neighbors – A list of neighbors
labels – A list of labels
two_tailed – Determine the p value
pval – The p-value threshold
method – “moran_i” or “geary_c”
- Returns
A list of (value, p_value)
- spatialtis_core.geo_analysis.spatial_distribution_pattern(points_collections: List[spatialtis_core.types.Points], bbox: spatialtis_core.types.BoundingBox, method: str = 'id', r: Optional[float] = None, resample: int = 1000, quad: Optional[Tuple[int, int]] = None, rect_side: Optional[Tuple[float, float]] = None, pval: float = 0.05, min_cells: int = 10, dims: int = 2) List[Tuple[float, float, int]] #
Compute the distribution index and determine the pattern for different cells in a ROI in parallel
If data is 3D, only method=”id” is supported
- Parameters
points_collections – A list of list of points
bbox – The bounding box
method – “id” for index of dispersion, “morisita” for morisita index, “clark_evans” for clark evans’ index
r – If method == “id”; The sample windows’ radius
resample – If method == “id”; The number of sampling times
quad – If method == “morisita”; eg.(X, Y) Use X * Y grid to perform analysis
rect_side – If method == “morisita”; eg.(X, Y) Use X * Y rectangle to perform analysis
pval – The threshold for p-value
min_cells – The minimum number of cells to perform analysis
dims – The dimension of data
- Returns
A list of (index_value, p_value, pattern)
- spatialtis_core.geo_analysis.spatial_entropy(points_collections: List[spatialtis_core.types.Points], types_collections: List[List[str]], method: str = 'leibovici', d: Optional[float] = None, cut: int = 3, dims: int = 2) List[float] #
Compute spatial entropy value of multiple ROIs in parallel
- Parameters
points_collections – A list of list of points
types_collections – A list of list of types
bbox – The bounding box
method – “leibovici” or “altieri”
d – If method == “leibovici”; The distance threshold to determine co-occurrence
cut – If method == “altieri”; The distance interval to determine co-occurrence
dims – The dimension of data
- Returns
A list of spatial entropy