spatialproteomics 0.8.4__tar.gz → 0.8.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {spatialproteomics-0.8.4/spatialproteomics.egg-info → spatialproteomics-0.8.5}/PKG-INFO +2 -6
  2. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/README.md +1 -5
  3. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/pyproject.toml +1 -1
  4. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/container.py +0 -3
  5. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/pp/preprocessing.py +3 -3
  6. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/tl/tool.py +22 -2
  7. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5/spatialproteomics.egg-info}/PKG-INFO +2 -6
  8. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/LICENSE +0 -0
  9. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/setup.cfg +0 -0
  10. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/__init__.py +0 -0
  11. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/base_logger.py +0 -0
  12. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/constants.py +0 -0
  13. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/image_container/ImageContainer.py +0 -0
  14. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/image_container/__init__.py +0 -0
  15. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/la/__init__.py +0 -0
  16. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/la/label.py +0 -0
  17. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/la/utils.py +0 -0
  18. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/nh/__init__.py +0 -0
  19. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/nh/neighborhood.py +0 -0
  20. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/nh/utils.py +0 -0
  21. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/pl/__init__.py +0 -0
  22. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/pl/plot.py +0 -0
  23. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/pl/utils.py +0 -0
  24. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/pp/__init__.py +0 -0
  25. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/pp/intensity.py +0 -0
  26. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/pp/utils.py +0 -0
  27. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/sd/__init__.py +0 -0
  28. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/sd/utils.py +0 -0
  29. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/tl/__init__.py +0 -0
  30. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics/tl/utils.py +0 -0
  31. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics.egg-info/SOURCES.txt +0 -0
  32. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics.egg-info/dependency_links.txt +0 -0
  33. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics.egg-info/requires.txt +0 -0
  34. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/spatialproteomics.egg-info/top_level.txt +0 -0
  35. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/tests/test_container.py +0 -0
  36. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/tests/test_integration.py +0 -0
  37. {spatialproteomics-0.8.4 → spatialproteomics-0.8.5}/tests/test_to_zarr.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spatialproteomics
3
- Version: 0.8.4
3
+ Version: 0.8.5
4
4
  Summary: Spatialproteomics is an interoperable toolbox for analyzing highly multiplexed fluorescence image data
5
5
  Author: Matthias Meyer-Bender, Harald Vohringer
6
6
  Requires-Python: >=3.10
@@ -97,8 +97,4 @@ matplotlib
97
97
  ```
98
98
 
99
99
  ## Citation
100
- Spatialproteomics - an interoperable toolbox for analyzing highly multiplexed fluorescence image data
101
-
102
- Matthias Fabian Meyer-Bender, Harald Sager Voehringer, Christina Schniederjohann, Sarah Patricia Koziel, Erin Kim Chung, Ekaterina Popova, Alexander Brobeil, Lisa-Maria Held, Aamir Munir, Scverse Community, Sascha Dietrich, Peter-Martin Bruch, Wolfgang Huber
103
-
104
- bioRxiv 2025.04.29.651202; doi: https://doi.org/10.1101/2025.04.29.651202
100
+ > Meyer-Bender, M., Voehringer, H., Schniederjohann, C., Koziel, S., Chung, E., Popova, E., ... & Huber, W. (2026). Spatialproteomics: an interoperable toolbox for analyzing highly multiplexed fluorescence image data. Nature Methods, 1-10.
@@ -47,8 +47,4 @@ matplotlib
47
47
  ```
48
48
 
49
49
  ## Citation
50
- Spatialproteomics - an interoperable toolbox for analyzing highly multiplexed fluorescence image data
51
-
52
- Matthias Fabian Meyer-Bender, Harald Sager Voehringer, Christina Schniederjohann, Sarah Patricia Koziel, Erin Kim Chung, Ekaterina Popova, Alexander Brobeil, Lisa-Maria Held, Aamir Munir, Scverse Community, Sascha Dietrich, Peter-Martin Bruch, Wolfgang Huber
53
-
54
- bioRxiv 2025.04.29.651202; doi: https://doi.org/10.1101/2025.04.29.651202
50
+ > Meyer-Bender, M., Voehringer, H., Schniederjohann, C., Koziel, S., Chung, E., Popova, E., ... & Huber, W. (2026). Spatialproteomics: an interoperable toolbox for analyzing highly multiplexed fluorescence image data. Nature Methods, 1-10.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "spatialproteomics"
3
- version = "0.8.4"
3
+ version = "0.8.5"
4
4
  description = "Spatialproteomics is an interoperable toolbox for analyzing highly multiplexed fluorescence image data"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -106,9 +106,6 @@ def load_image_data(
106
106
  if neighborhood is not None:
107
107
  dataset = dataset.nh.add_neighborhoods_from_dataframe(neighborhood, neighborhood_col=neighborhood_col)
108
108
 
109
- else:
110
- dataset = xr.Dataset(data_vars={Layers.IMAGE: im})
111
-
112
109
  return dataset
113
110
 
114
111
 
@@ -866,7 +866,7 @@ class PreprocessingAccessor:
866
866
  from_layer = segmentation
867
867
  segmentation = self._obj[segmentation].values.squeeze()
868
868
 
869
- assert segmentation.ndim == 2, "A segmentation mask must 2 dimensional."
869
+ assert segmentation.ndim == 2, "A segmentation mask must be 2-dimensional."
870
870
  assert ~np.any(segmentation < 0), "A segmentation mask may not contain negative numbers."
871
871
 
872
872
  y_dim, x_dim = segmentation.shape
@@ -939,14 +939,14 @@ class PreprocessingAccessor:
939
939
  """
940
940
  # checking that the layer does not exist yet
941
941
  assert key_added not in self._obj, f"Layer {key_added} already exists."
942
- assert array.ndim in [2, 3], "The array to add mask must 2 or 3-dimensional."
942
+ assert array.ndim in [2, 3], "The array to add mask must be 2- or 3-dimensional."
943
943
 
944
944
  if array.ndim == 2:
945
945
  # in the case of a 2D array
946
946
  y_dim, x_dim = array.shape
947
947
  assert (x_dim == self._obj.sizes[Dims.X]) & (
948
948
  y_dim == self._obj.sizes[Dims.Y]
949
- ), f"The shape of array does not match that of the image. Image has shape ({self._obj.sizes[Dims.Y]}, {self._obj.sizes[Dims.X]}), array has shape {array.shape}."
949
+ ), f"The shape of the array does not match that of the image. Image has shape ({self._obj.sizes[Dims.Y]}, {self._obj.sizes[Dims.X]}), array has shape {array.shape}."
950
950
 
951
951
  # create a data array with the new layer
952
952
  da = xr.DataArray(
@@ -588,6 +588,7 @@ class ToolAccessor:
588
588
  expression_matrix_key: str = Layers.INTENSITY,
589
589
  obs_key: str = Layers.OBS,
590
590
  additional_layers: Optional[dict] = None,
591
+ additional_obsm: Optional[dict] = None,
591
592
  additional_uns: Optional[dict] = None,
592
593
  ):
593
594
  """
@@ -601,6 +602,8 @@ class ToolAccessor:
601
602
  The key of the observation data in the spatialproteomics object. Default is '_obs'.
602
603
  additional_layers : dict, optional
603
604
  Additional layers to include in the anndata.AnnData object. The keys are the names of the layers and the values are the corresponding keys in the spatialproteomics object.
605
+ additional_obsm : dict, optional
606
+ Additional obsm data to include in the anndata.AnnData object. The keys are the names of the obsm data and the values are the corresponding keys in the spatialproteomics object.
604
607
  additional_uns : dict, optional
605
608
  Additional uns data to include in the anndata.AnnData object. The keys are the names of the uns data and the values are the corresponding keys in the spatialproteomics object.
606
609
 
@@ -612,7 +615,7 @@ class ToolAccessor:
612
615
  Raises
613
616
  ------
614
617
  AssertionError
615
- If the expression matrix key or additional layers are not found in the spatialproteomics object.
618
+ If additional layers, obsm entries, or uns entries are not found in the spatialproteomics object, or if additional layers or obsm entries have incompatible shapes.
616
619
 
617
620
  Notes
618
621
  -----
@@ -633,6 +636,11 @@ class ToolAccessor:
633
636
  for key, layer in additional_layers.items():
634
637
  # checking that the additional layer is present in the object
635
638
  assert layer in self._obj, f"Layer {layer} not found in the object."
639
+ # checking that layer has the same shape as the expression matrix
640
+ assert self._obj[layer].shape == expression_matrix.shape, (
641
+ f"Layer {layer} has shape {self._obj[layer].shape}, but AnnData layers must match "
642
+ f"the shape of the expression matrix {expression_matrix.shape}."
643
+ )
636
644
  adata.layers[key] = self._obj[layer].values
637
645
  adata.var_names = self._obj.coords[Dims.CHANNELS].values
638
646
 
@@ -661,9 +669,21 @@ class ToolAccessor:
661
669
  adata.obs[Features.Y] = adata.obs[Features.Y].astype(float)
662
670
  adata.obsm["spatial"] = np.array(adata.obs[[Features.X, Features.Y]])
663
671
 
672
+ if additional_obsm:
673
+ for key, layer in additional_obsm.items():
674
+ # checking that the additional obsm source layer is present in the object
675
+ assert layer in self._obj, f"Layer {layer} not found in the object."
676
+ # checking that the additional obsm layer has the same number of observations as the expression matrix
677
+ assert self._obj[layer].shape[0] == expression_matrix.shape[0], (
678
+ f"Layer {layer} has {self._obj[layer].shape[0]} observations, but the expression "
679
+ f"matrix has {expression_matrix.shape[0]} observations. AnnData obsm entries must match "
680
+ "the number of observations in the expression matrix."
681
+ )
682
+ adata.obsm[key] = self._obj[layer].values
683
+
664
684
  if additional_uns:
665
685
  for key, layer in additional_uns.items():
666
- # checking that the additional layer is present in the object
686
+ # checking that the additional uns source layer is present in the object
667
687
  assert layer in self._obj, f"Layer {layer} not found in the object."
668
688
  adata.uns[key] = self._obj.pp.get_layer_as_df(layer)
669
689
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spatialproteomics
3
- Version: 0.8.4
3
+ Version: 0.8.5
4
4
  Summary: Spatialproteomics is an interoperable toolbox for analyzing highly multiplexed fluorescence image data
5
5
  Author: Matthias Meyer-Bender, Harald Vohringer
6
6
  Requires-Python: >=3.10
@@ -97,8 +97,4 @@ matplotlib
97
97
  ```
98
98
 
99
99
  ## Citation
100
- Spatialproteomics - an interoperable toolbox for analyzing highly multiplexed fluorescence image data
101
-
102
- Matthias Fabian Meyer-Bender, Harald Sager Voehringer, Christina Schniederjohann, Sarah Patricia Koziel, Erin Kim Chung, Ekaterina Popova, Alexander Brobeil, Lisa-Maria Held, Aamir Munir, Scverse Community, Sascha Dietrich, Peter-Martin Bruch, Wolfgang Huber
103
-
104
- bioRxiv 2025.04.29.651202; doi: https://doi.org/10.1101/2025.04.29.651202
100
+ > Meyer-Bender, M., Voehringer, H., Schniederjohann, C., Koziel, S., Chung, E., Popova, E., ... & Huber, W. (2026). Spatialproteomics: an interoperable toolbox for analyzing highly multiplexed fluorescence image data. Nature Methods, 1-10.