SingleCellExperiment 0.5.2__tar.gz → 0.5.3__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 (50) hide show
  1. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/CHANGELOG.md +3 -1
  2. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/PKG-INFO +2 -2
  3. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/docs/changelog.md +3 -1
  4. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/setup.cfg +1 -1
  5. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/SingleCellExperiment.egg-info/PKG-INFO +2 -2
  6. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/SingleCellExperiment.egg-info/requires.txt +1 -1
  7. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/singlecellexperiment/SingleCellExperiment.py +8 -9
  8. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/tests/test_sce_slice.py +26 -1
  9. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/.coveragerc +0 -0
  10. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/.github/workflows/publish-pypi.yml +0 -0
  11. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/.github/workflows/run-tests.yml +0 -0
  12. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/.gitignore +0 -0
  13. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/.pre-commit-config.yaml +0 -0
  14. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/.readthedocs.yml +0 -0
  15. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/AUTHORS.md +0 -0
  16. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/CONTRIBUTING.md +0 -0
  17. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/LICENSE.txt +0 -0
  18. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/README.md +0 -0
  19. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/docs/Makefile +0 -0
  20. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/docs/_static/.gitignore +0 -0
  21. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/docs/authors.md +0 -0
  22. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/docs/conf.py +0 -0
  23. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/docs/contributing.md +0 -0
  24. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/docs/index.md +0 -0
  25. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/docs/license.md +0 -0
  26. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/docs/readme.md +0 -0
  27. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/docs/requirements.txt +0 -0
  28. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/docs/tutorial.md +0 -0
  29. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/pyproject.toml +0 -0
  30. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/setup.py +0 -0
  31. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/SingleCellExperiment.egg-info/SOURCES.txt +0 -0
  32. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/SingleCellExperiment.egg-info/dependency_links.txt +0 -0
  33. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/SingleCellExperiment.egg-info/not-zip-safe +0 -0
  34. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/SingleCellExperiment.egg-info/top_level.txt +0 -0
  35. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/singlecellexperiment/__init__.py +0 -0
  36. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/singlecellexperiment/_combineutils.py +0 -0
  37. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/singlecellexperiment/_ioutils.py +0 -0
  38. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/singlecellexperiment/io/__init__.py +0 -0
  39. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/singlecellexperiment/io/h5ad.py +0 -0
  40. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/src/singlecellexperiment/io/tenx.py +0 -0
  41. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/tests/conftest.py +0 -0
  42. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/tests/data/adata.h5ad +0 -0
  43. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/tests/data/mocks.py +0 -0
  44. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/tests/data/tenx.sub.h5 +0 -0
  45. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/tests/test_sce.py +0 -0
  46. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/tests/test_sce_combine_cols.py +0 -0
  47. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/tests/test_sce_combine_rows.py +0 -0
  48. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/tests/test_sce_io.py +0 -0
  49. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/tests/test_sce_methods.py +0 -0
  50. {singlecellexperiment-0.5.2 → singlecellexperiment-0.5.3}/tox.ini +0 -0
@@ -1,10 +1,12 @@
1
1
  # Changelog
2
2
 
3
- ## Version 0.5.1 - 0.5.2
3
+ ## Version 0.5.1 - 0.5.3
4
4
 
5
5
  - Add wrapper class methods to combine experiments by rows or columns.
6
6
  - Expand function names for readability, still backwards compatible with the older function and method names.
7
7
  - Add getters and setters to replace a specific alternative experiment or reduced dimension.
8
+ - Fixed an issue with numpy arrays as slice arguments. Code now uses Biocutils's subset functions to perform these operations.
9
+
8
10
 
9
11
  ## Version 0.5.0
10
12
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: SingleCellExperiment
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: Container class for single-cell experiments
5
5
  Home-page: https://github.com/BiocPy/SingleCellExperiment
6
6
  Author: jkanche
@@ -14,7 +14,7 @@ Requires-Python: >=3.9
14
14
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
15
15
  License-File: LICENSE.txt
16
16
  Requires-Dist: importlib-metadata; python_version < "3.8"
17
- Requires-Dist: summarizedexperiment>=0.5.1
17
+ Requires-Dist: summarizedexperiment>=0.5.3
18
18
  Provides-Extra: optional
19
19
  Requires-Dist: anndata==0.9.2; python_version <= "3.9" and extra == "optional"
20
20
  Requires-Dist: anndata>0.9.2; python_version > "3.9" and extra == "optional"
@@ -1,10 +1,12 @@
1
1
  # Changelog
2
2
 
3
- ## Version 0.5.1 - 0.5.2
3
+ ## Version 0.5.1 - 0.5.3
4
4
 
5
5
  - Add wrapper class methods to combine experiments by rows or columns.
6
6
  - Expand function names for readability, still backwards compatible with the older function and method names.
7
7
  - Add getters and setters to replace a specific alternative experiment or reduced dimension.
8
+ - Fixed an issue with numpy arrays as slice arguments. Code now uses Biocutils's subset functions to perform these operations.
9
+
8
10
 
9
11
  ## Version 0.5.0
10
12
 
@@ -24,7 +24,7 @@ package_dir =
24
24
  python_requires = >=3.9
25
25
  install_requires =
26
26
  importlib-metadata; python_version<"3.8"
27
- summarizedexperiment>=0.5.1
27
+ summarizedexperiment>=0.5.3
28
28
 
29
29
  [options.packages.find]
30
30
  where = src
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: SingleCellExperiment
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: Container class for single-cell experiments
5
5
  Home-page: https://github.com/BiocPy/SingleCellExperiment
6
6
  Author: jkanche
@@ -14,7 +14,7 @@ Requires-Python: >=3.9
14
14
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
15
15
  License-File: LICENSE.txt
16
16
  Requires-Dist: importlib-metadata; python_version < "3.8"
17
- Requires-Dist: summarizedexperiment>=0.5.1
17
+ Requires-Dist: summarizedexperiment>=0.5.3
18
18
  Provides-Extra: optional
19
19
  Requires-Dist: anndata==0.9.2; python_version <= "3.9" and extra == "optional"
20
20
  Requires-Dist: anndata>0.9.2; python_version > "3.9" and extra == "optional"
@@ -1,4 +1,4 @@
1
- summarizedexperiment>=0.5.1
1
+ summarizedexperiment>=0.5.3
2
2
 
3
3
  [:python_version < "3.8"]
4
4
  importlib-metadata
@@ -980,41 +980,40 @@ class SingleCellExperiment(RangedSummarizedExperiment):
980
980
  rows: Optional[Union[str, int, bool, Sequence]],
981
981
  columns: Optional[Union[str, int, bool, Sequence]],
982
982
  ) -> "SingleCellExperiment":
983
- """Alias for :py:attr:`~__getitem__`, for back-compatibility."""
983
+ """Alias for :py:attr:`~__getitem__`."""
984
984
 
985
985
  slicer = self._generic_slice(rows=rows, columns=columns)
986
+ do_slice_rows = not (isinstance(slicer.row_indices, slice) and slicer.row_indices == slice(None))
987
+ do_slice_cols = not (isinstance(slicer.col_indices, slice) and slicer.col_indices == slice(None))
986
988
 
987
989
  new_row_ranges = None
988
- if slicer.row_indices != slice(None):
990
+ if do_slice_rows:
989
991
  new_row_ranges = self._row_ranges[slicer.row_indices]
990
992
 
991
993
  new_reduced_dims = {}
992
994
  for rdim, rmat in self._reduced_dims.items():
993
- if slicer.col_indices != slice(None):
995
+ if do_slice_cols:
994
996
  rmat = rmat[slicer.col_indices, :]
995
997
 
996
998
  new_reduced_dims[rdim] = rmat
997
999
 
998
1000
  new_alt_expts = {}
999
1001
  for altname, altexpt in self._alternative_experiments.items():
1000
- if slicer.row_indices != slice(None):
1001
- altexpt = altexpt[slicer.row_indices, :]
1002
-
1003
- if slicer.col_indices != slice(None):
1002
+ if do_slice_cols:
1004
1003
  altexpt = altexpt[:, slicer.col_indices]
1005
1004
 
1006
1005
  new_alt_expts[altname] = altexpt
1007
1006
 
1008
1007
  new_row_pairs = {}
1009
1008
  for rname, rpair in self._row_pairs.items():
1010
- if slicer.row_indices != slice(None):
1009
+ if do_slice_rows:
1011
1010
  rpair = rpair[slicer.row_indices, :]
1012
1011
 
1013
1012
  new_row_pairs[rname] = rpair
1014
1013
 
1015
1014
  new_col_pairs = {}
1016
1015
  for cname, cpair in self._column_pairs.items():
1017
- if slicer.col_indices != slice(None):
1016
+ if do_slice_cols:
1018
1017
  cpair = cpair[:, slicer.col_indices]
1019
1018
 
1020
1019
  new_col_pairs[cname] = cpair
@@ -66,6 +66,31 @@ def test_SCE_slice():
66
66
 
67
67
  assert tse_slice.assay("counts").shape == (10, 3)
68
68
 
69
+ def test_SCE_slice_with_numpy():
70
+ tse = SingleCellExperiment(
71
+ assays={"counts": counts},
72
+ row_data=row_data,
73
+ column_data=col_data,
74
+ reduced_dims={"random_embeds": np.random.rand(ncols, 5)},
75
+ )
76
+
77
+ tse_slice = tse[np.arange(10), 0:3]
78
+ assert tse_slice is not None
79
+ assert isinstance(tse_slice, sce)
80
+
81
+ assert len(tse_slice.row_data) == 10
82
+ assert len(tse_slice.col_data) == 3
83
+
84
+ assert tse_slice.assay("counts").shape == (10, 3)
85
+
86
+ tse_slice = tse[np.arange(10), np.arange(3)]
87
+ assert tse_slice is not None
88
+ assert isinstance(tse_slice, sce)
89
+
90
+ assert len(tse_slice.row_data) == 10
91
+ assert len(tse_slice.col_data) == 3
92
+
93
+ assert tse_slice.assay("counts").shape == (10, 3)
69
94
 
70
95
  def test_SCE_creation_with_alts_slice():
71
96
  trse = SummarizedExperiment(
@@ -91,4 +116,4 @@ def test_SCE_creation_with_alts_slice():
91
116
 
92
117
  assert tsce_slice.assay("counts").shape == (10, 3)
93
118
  alt_exp = tsce_slice.alternative_experiments["alt"]
94
- assert alt_exp.shape == (10, 3)
119
+ assert alt_exp.shape == (200, 3)