Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,226 changes: 845 additions & 381 deletions docs/notebooks/10x_xenium_focus.ipynb

Large diffs are not rendered by default.

998 changes: 648 additions & 350 deletions docs/notebooks/supervised.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ classifiers = [
license = {text = "MIT"}
dependencies = [
"typer",
"scanpy<=1.11.4", # for compatibility with squidpy
"scanpy<1.12", # for compatibility with squidpy
"spatialdata",
"joblib",
"geopandas",
"igraph",
"rtree",
"rasterio",
"squidpy>=1.6.2,<1.6.6",
"squidpy>=1.6.2",
"tqdm",
"anndata",
]
Expand Down
6 changes: 4 additions & 2 deletions src/segtraq/SegTraQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,8 @@ def morphological_features(self, features_to_compute: list | None = None, n_jobs
return bl.morphological_features(
sdata=self._p.sdata,
tables_cell_id_key=self._p.tables_cell_id_key,
tables_centroid_x_key=self._p.tables_centroid_x_key,
tables_centroid_y_key=self._p.tables_centroid_y_key,
shapes_key=self._p.shapes_key,
shapes_cell_id_key=self._p.shapes_cell_id_key,
features_to_compute=features_to_compute,
Expand Down Expand Up @@ -968,8 +970,8 @@ def neighbor_prediction(
ct1,
ct2,
cell_type_key=cell_type_key,
tables_x_key=self._p.tables_x_key,
tables_y_key=self._p.tables_y_key,
tables_x_key=self._p.tables_centroid_x_key,
tables_y_key=self._p.tables_centroid_y_key,
grid_shape=grid_shape,
n_permutations=n_permutations,
seed=seed,
Expand Down
9 changes: 9 additions & 0 deletions src/segtraq/bl/baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ def transcript_density(
def morphological_features(
sdata: sd.SpatialData,
tables_cell_id_key: str = "cell_id",
tables_centroid_x_key: str = "centroid_x",
tables_centroid_y_key: str = "centroid_y",
shapes_key: str = "cell_boundaries",
shapes_cell_id_key: str = "cell_id",
features_to_compute: list | None = None,
Expand All @@ -440,6 +442,10 @@ def morphological_features(
Spatial data object containing cell shape information. Must have a `.shapes` attribute with geometries.
tables_cell_id_key : str
Column in `sdata.tables[tables_key].obs containing cell IDs to match with `shapes_cell_id_key`.
tables_centroid_x_key : str, optional
Column in `sdata.tables[tables_key].obs` to store the x-coordinate of the centroid (default is "centroid_x").
tables_centroid_y_key : str, optional
Column in `sdata.tables[tables_key].obs` to store the y-coordinate of the centroid (default is "centroid_y").
shapes_key : str, optional
Key in `sdata.shapes` specifying the geometry column (default is "cell_boundaries").
shapes_cell_id_key : str, optional
Expand Down Expand Up @@ -487,6 +493,9 @@ def morphological_features(
"compactness",
"num_polygons",
]
# if we already have centroids in the table, we do not compute them here
if features_to_compute is None and (tables_centroid_x_key is not None and tables_centroid_y_key is not None):
all_features.remove("centroid")

# If no features specified, compute all
if features_to_compute is None:
Expand Down
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.