moscot 0.4.1__tar.gz → 0.4.2__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 (81) hide show
  1. {moscot-0.4.1 → moscot-0.4.2}/.pre-commit-config.yaml +4 -4
  2. {moscot-0.4.1 → moscot-0.4.2}/PKG-INFO +3 -2
  3. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/base/solver.py +1 -1
  4. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/plotting/_utils.py +1 -1
  5. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/space/_mixins.py +18 -5
  6. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/utils/subset_policy.py +1 -1
  7. {moscot-0.4.1 → moscot-0.4.2}/src/moscot.egg-info/PKG-INFO +3 -2
  8. {moscot-0.4.1 → moscot-0.4.2}/.gitignore +0 -0
  9. {moscot-0.4.1 → moscot-0.4.2}/.gitmodules +0 -0
  10. {moscot-0.4.1 → moscot-0.4.2}/.readthedocs.yml +0 -0
  11. {moscot-0.4.1 → moscot-0.4.2}/.run_notebooks.sh +0 -0
  12. {moscot-0.4.1 → moscot-0.4.2}/LICENSE +0 -0
  13. {moscot-0.4.1 → moscot-0.4.2}/MANIFEST.in +0 -0
  14. {moscot-0.4.1 → moscot-0.4.2}/README.rst +0 -0
  15. {moscot-0.4.1 → moscot-0.4.2}/codecov.yml +0 -0
  16. {moscot-0.4.1 → moscot-0.4.2}/pyproject.toml +0 -0
  17. {moscot-0.4.1 → moscot-0.4.2}/setup.cfg +0 -0
  18. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/__init__.py +0 -0
  19. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/_constants.py +0 -0
  20. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/_logging.py +0 -0
  21. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/_registry.py +0 -0
  22. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/_types.py +0 -0
  23. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/backends/__init__.py +0 -0
  24. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/backends/ott/__init__.py +0 -0
  25. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/backends/ott/_utils.py +0 -0
  26. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/backends/ott/output.py +0 -0
  27. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/backends/ott/solver.py +0 -0
  28. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/backends/utils.py +0 -0
  29. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/base/__init__.py +0 -0
  30. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/base/cost.py +0 -0
  31. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/base/output.py +0 -0
  32. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/base/problems/__init__.py +0 -0
  33. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/base/problems/_mixins.py +0 -0
  34. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/base/problems/_utils.py +0 -0
  35. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/base/problems/birth_death.py +0 -0
  36. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/base/problems/compound_problem.py +0 -0
  37. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/base/problems/manager.py +0 -0
  38. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/base/problems/problem.py +0 -0
  39. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/costs/__init__.py +0 -0
  40. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/costs/_costs.py +0 -0
  41. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/costs/_utils.py +0 -0
  42. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/datasets.py +0 -0
  43. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/neural/base/__init__.py +0 -0
  44. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/neural/base/problems/__init__.py +0 -0
  45. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/neural/base/problems/problem.py +0 -0
  46. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/neural/problems/__init__.py +0 -0
  47. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/neural/problems/generic/__init__.py +0 -0
  48. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/neural/problems/generic/_generic.py +0 -0
  49. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/plotting/__init__.py +0 -0
  50. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/plotting/_plotting.py +0 -0
  51. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/__init__.py +0 -0
  52. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/_utils.py +0 -0
  53. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/cross_modality/__init__.py +0 -0
  54. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/cross_modality/_mixins.py +0 -0
  55. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/cross_modality/_translation.py +0 -0
  56. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/generic/__init__.py +0 -0
  57. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/generic/_generic.py +0 -0
  58. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/generic/_mixins.py +0 -0
  59. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/space/__init__.py +0 -0
  60. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/space/_alignment.py +0 -0
  61. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/space/_mapping.py +0 -0
  62. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/spatiotemporal/__init__.py +0 -0
  63. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/spatiotemporal/_spatio_temporal.py +0 -0
  64. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/time/__init__.py +0 -0
  65. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/time/_lineage.py +0 -0
  66. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/problems/time/_mixins.py +0 -0
  67. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/py.typed +0 -0
  68. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/utils/__init__.py +0 -0
  69. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/utils/_data/allTFs_dmel.txt +0 -0
  70. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/utils/_data/allTFs_hg38.txt +0 -0
  71. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/utils/_data/allTFs_mm.txt +0 -0
  72. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/utils/_data/human_apoptosis.txt +0 -0
  73. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/utils/_data/human_proliferation.txt +0 -0
  74. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/utils/_data/mouse_apoptosis.txt +0 -0
  75. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/utils/_data/mouse_proliferation.txt +0 -0
  76. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/utils/data.py +0 -0
  77. {moscot-0.4.1 → moscot-0.4.2}/src/moscot/utils/tagged_array.py +0 -0
  78. {moscot-0.4.1 → moscot-0.4.2}/src/moscot.egg-info/SOURCES.txt +0 -0
  79. {moscot-0.4.1 → moscot-0.4.2}/src/moscot.egg-info/dependency_links.txt +0 -0
  80. {moscot-0.4.1 → moscot-0.4.2}/src/moscot.egg-info/requires.txt +0 -0
  81. {moscot-0.4.1 → moscot-0.4.2}/src/moscot.egg-info/top_level.txt +0 -0
@@ -7,13 +7,13 @@ default_stages:
7
7
  minimum_pre_commit_version: 3.0.0
8
8
  repos:
9
9
  - repo: https://github.com/pre-commit/mirrors-mypy
10
- rev: v1.14.1
10
+ rev: v1.15.0
11
11
  hooks:
12
12
  - id: mypy
13
13
  additional_dependencies: [numpy>=1.25.0]
14
14
  files: ^src
15
15
  - repo: https://github.com/psf/black
16
- rev: 24.10.0
16
+ rev: 25.1.0
17
17
  hooks:
18
18
  - id: black
19
19
  additional_dependencies: [toml]
@@ -23,7 +23,7 @@ repos:
23
23
  - id: prettier
24
24
  language_version: system
25
25
  - repo: https://github.com/PyCQA/isort
26
- rev: 5.13.2
26
+ rev: 6.0.1
27
27
  hooks:
28
28
  - id: isort
29
29
  additional_dependencies: [toml]
@@ -63,7 +63,7 @@ repos:
63
63
  - id: doc8
64
64
  - repo: https://github.com/astral-sh/ruff-pre-commit
65
65
  # Ruff version.
66
- rev: v0.9.3
66
+ rev: v0.9.10
67
67
  hooks:
68
68
  - id: ruff
69
69
  args: [--fix, --exit-non-zero-on-fix]
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: moscot
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Multi-omic single-cell optimal transport tools
5
5
  Author: Dominik Klein, Giovanni Palla, Michal Klein, Zoe Piran, Marius Lange
6
6
  Maintainer-email: Dominik Klein <dominik.klein@helmholtz-muenchen.de>, Giovanni Palla <giovanni.palla@helmholtz-muenchen.de>, Michal Klein <michal.klein@helmholtz-muenchen.de>
@@ -98,6 +98,7 @@ Requires-Dist: sphinx-tippy>=0.4.1; extra == "docs"
98
98
  Requires-Dist: myst-nb>=0.17.1; extra == "docs"
99
99
  Requires-Dist: ipython>=7.20.0; extra == "docs"
100
100
  Requires-Dist: sphinx_design>=0.3.0; extra == "docs"
101
+ Dynamic: license-file
101
102
 
102
103
  |PyPI| |Downloads| |CI| |Pre-commit| |Codecov| |Docs|
103
104
 
@@ -41,7 +41,7 @@ class TagConverter: # noqa: D101
41
41
  **kwargs: Any,
42
42
  ) -> TaggedArrayData:
43
43
  def to_tuple(
44
- data: Optional[Union[ArrayLike, Tuple[ArrayLike, ArrayLike]]]
44
+ data: Optional[Union[ArrayLike, Tuple[ArrayLike, ArrayLike]]],
45
45
  ) -> Tuple[Optional[ArrayLike], Optional[ArrayLike]]:
46
46
  if not isinstance(data, tuple):
47
47
  return data, None
@@ -358,7 +358,7 @@ def _contrasting_color(r: int, g: int, b: int) -> str:
358
358
 
359
359
 
360
360
  def _input_to_adatas(
361
- inp: Union[AnnData, Tuple[AnnData, AnnData], "CompoundProblem"] # type: ignore[type-arg]
361
+ inp: Union[AnnData, Tuple[AnnData, AnnData], "CompoundProblem"], # type: ignore[type-arg]
362
362
  ) -> Tuple[AnnData, AnnData]:
363
363
  from moscot.base.problems import CompoundProblem
364
364
 
@@ -138,15 +138,29 @@ class SpatialAlignmentMixin(AnalysisMixin[K, B]):
138
138
  aligned_maps, aligned_metadata = self._interpolate_scheme(
139
139
  reference=reference, mode=mode, spatial_key=spatial_key # type: ignore[arg-type]
140
140
  )
141
- aligned_basis = np.vstack([aligned_maps[k] for k in self._policy._cat])
141
+
142
+ batch_categories = self.adata.obs[self._policy.key].cat.categories
143
+ batch_indices = {}
144
+ result = np.zeros((self.adata.n_obs, aligned_maps[list(aligned_maps.keys())[0]].shape[1]))
145
+
146
+ # Create batch to index mapping
147
+ for cat in batch_categories:
148
+ batch_indices[cat] = np.where(self.adata.obs[self._policy.key] == cat)[0]
149
+
150
+ # Assign aligned coordinates to the correct positions in result array
151
+ for cat, indices in batch_indices.items():
152
+ if cat in aligned_maps:
153
+ result[indices] = aligned_maps[cat]
142
154
 
143
155
  if key_added is None:
144
- return aligned_basis, aligned_metadata
156
+ return result, aligned_metadata
145
157
 
146
- self.adata.obsm[key_added] = aligned_basis
158
+ self.adata.obsm[key_added] = result
147
159
  if mode == "affine": # noqa: RET503
148
160
  self.adata.uns.setdefault(key_added, {})
149
- self.adata.uns[key_added]["alignment_metadata"] = aligned_metadata # noqa: RET503
161
+ self.adata.uns[key_added]["alignment_metadata"] = aligned_metadata
162
+
163
+ return None
150
164
 
151
165
  def cell_transition(
152
166
  self,
@@ -399,7 +413,6 @@ class SpatialMappingMixin(AnalysisMixin[K, B], AbstractSpSc):
399
413
 
400
414
  corrs: Union[Dict[Tuple[K, K], Dict[Any, pd.Series]], Dict[Tuple[K, K], pd.Series]] = {}
401
415
  for key, val in self.solutions.items():
402
-
403
416
  # create mask corresponding to the current batch of spatial data
404
417
  index_obs = (
405
418
  (self.adata_sp.obs[self._policy.key] == key[0])
@@ -314,7 +314,7 @@ class SimplePlanPolicy(SubsetPolicy[K], abc.ABC):
314
314
  return list(self._graph)
315
315
 
316
316
 
317
- class StarPolicy(SimplePlanPolicy[K]):
317
+ class StarPolicy(OrderedPolicy[K]):
318
318
  r"""Policy with a star topology.
319
319
 
320
320
  Parameters
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: moscot
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Multi-omic single-cell optimal transport tools
5
5
  Author: Dominik Klein, Giovanni Palla, Michal Klein, Zoe Piran, Marius Lange
6
6
  Maintainer-email: Dominik Klein <dominik.klein@helmholtz-muenchen.de>, Giovanni Palla <giovanni.palla@helmholtz-muenchen.de>, Michal Klein <michal.klein@helmholtz-muenchen.de>
@@ -98,6 +98,7 @@ Requires-Dist: sphinx-tippy>=0.4.1; extra == "docs"
98
98
  Requires-Dist: myst-nb>=0.17.1; extra == "docs"
99
99
  Requires-Dist: ipython>=7.20.0; extra == "docs"
100
100
  Requires-Dist: sphinx_design>=0.3.0; extra == "docs"
101
+ Dynamic: license-file
101
102
 
102
103
  |PyPI| |Downloads| |CI| |Pre-commit| |Codecov| |Docs|
103
104
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes