SingleCellExperiment 0.6.1__tar.gz → 0.6.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 (55) hide show
  1. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/.pre-commit-config.yaml +1 -1
  2. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/CHANGELOG.md +4 -1
  3. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/PKG-INFO +3 -2
  4. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/docs/changelog.md +4 -1
  5. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/setup.cfg +2 -1
  6. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/SingleCellExperiment.egg-info/PKG-INFO +3 -2
  7. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/SingleCellExperiment.egg-info/SOURCES.txt +2 -0
  8. singlecellexperiment-0.6.3/src/SingleCellExperiment.egg-info/scm_file_list.json +50 -0
  9. singlecellexperiment-0.6.3/src/SingleCellExperiment.egg-info/scm_version.json +8 -0
  10. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/singlecellexperiment/SingleCellExperiment.py +99 -4
  11. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/test_sce_io.py +10 -0
  12. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/test_sce_methods.py +43 -1
  13. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/.coveragerc +0 -0
  14. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/.github/workflows/publish-pypi.yml +0 -0
  15. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/.github/workflows/run-tests.yml +0 -0
  16. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/.gitignore +0 -0
  17. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/.readthedocs.yml +0 -0
  18. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/AUTHORS.md +0 -0
  19. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/CONTRIBUTING.md +0 -0
  20. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/LICENSE.txt +0 -0
  21. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/README.md +0 -0
  22. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/docs/Makefile +0 -0
  23. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/docs/_static/.gitignore +0 -0
  24. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/docs/authors.md +0 -0
  25. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/docs/conf.py +0 -0
  26. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/docs/contributing.md +0 -0
  27. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/docs/index.md +0 -0
  28. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/docs/license.md +0 -0
  29. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/docs/readme.md +0 -0
  30. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/docs/requirements.txt +0 -0
  31. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/docs/tutorial.md +0 -0
  32. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/pyproject.toml +0 -0
  33. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/setup.py +0 -0
  34. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/SingleCellExperiment.egg-info/dependency_links.txt +0 -0
  35. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/SingleCellExperiment.egg-info/not-zip-safe +0 -0
  36. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/SingleCellExperiment.egg-info/requires.txt +0 -0
  37. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/SingleCellExperiment.egg-info/top_level.txt +0 -0
  38. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/singlecellexperiment/__init__.py +0 -0
  39. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/singlecellexperiment/_combineutils.py +0 -0
  40. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/singlecellexperiment/_ioutils.py +0 -0
  41. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/singlecellexperiment/io/__init__.py +0 -0
  42. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/singlecellexperiment/io/h5ad.py +0 -0
  43. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/src/singlecellexperiment/io/tenx.py +0 -0
  44. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/conftest.py +0 -0
  45. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/data/adata.h5ad +0 -0
  46. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/data/mocks.py +0 -0
  47. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/data/raw_feature_bc_matrix/barcodes.tsv +0 -0
  48. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/data/raw_feature_bc_matrix/features.tsv +0 -0
  49. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/data/raw_feature_bc_matrix/matrix.mtx +0 -0
  50. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/data/tenx.sub.h5 +0 -0
  51. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/test_sce.py +0 -0
  52. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/test_sce_combine_cols.py +0 -0
  53. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/test_sce_combine_rows.py +0 -0
  54. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tests/test_sce_slice.py +0 -0
  55. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.3}/tox.ini +0 -0
@@ -33,7 +33,7 @@ repos:
33
33
 
34
34
  - repo: https://github.com/astral-sh/ruff-pre-commit
35
35
  # Ruff version.
36
- rev: v0.14.5
36
+ rev: v0.15.6
37
37
  hooks:
38
38
  - id: ruff
39
39
  args: [--fix, --exit-non-zero-on-fix]
@@ -1,9 +1,12 @@
1
1
  # Changelog
2
2
 
3
- ## Version 0.6.0
3
+ ## Version 0.6.0 - 0.6.3
4
4
 
5
5
  - Changed related to SummarizedExperiment and implementation of `CompressedGenomicRangesList` in the genomic ranges package.
6
6
  - Update versions of relevant dependency packages.
7
+ - Rename `reduced_dims` to `reduced_dimensions`.
8
+ - Implement coercions to/from RSE/SE.
9
+ - Access data stored in `raw` (if available) as `alternative_experiments`, when initializing `SingleCellExperiment` objects from anndata/h5ad files.
7
10
 
8
11
  ## Version 0.5.8 - 0.5.9
9
12
 
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SingleCellExperiment
3
- Version: 0.6.1
3
+ Version: 0.6.3
4
4
  Summary: Container class for single-cell experiments
5
5
  Home-page: https://github.com/BiocPy/SingleCellExperiment
6
6
  Author: jkanche
7
7
  Author-email: jayaram.kancherla@gmail.com
8
8
  License: MIT
9
- Project-URL: Documentation, https://github.com/BiocPy/SingleCellExperiment
9
+ Project-URL: Documentation, https://biocpy.github.io/SingleCellExperiment/
10
+ Project-URL: Source, https://github.com/BiocPy/SingleCellExperiment
10
11
  Platform: any
11
12
  Classifier: Development Status :: 4 - Beta
12
13
  Classifier: Programming Language :: Python
@@ -1,9 +1,12 @@
1
1
  # Changelog
2
2
 
3
- ## Version 0.6.0
3
+ ## Version 0.6.0 - 0.6.3
4
4
 
5
5
  - Changed related to SummarizedExperiment and implementation of `CompressedGenomicRangesList` in the genomic ranges package.
6
6
  - Update versions of relevant dependency packages.
7
+ - Rename `reduced_dims` to `reduced_dimensions`.
8
+ - Implement coercions to/from RSE/SE.
9
+ - Access data stored in `raw` (if available) as `alternative_experiments`, when initializing `SingleCellExperiment` objects from anndata/h5ad files.
7
10
 
8
11
  ## Version 0.5.8 - 0.5.9
9
12
 
@@ -9,7 +9,8 @@ long_description = file: README.md
9
9
  long_description_content_type = text/markdown; charset=UTF-8; variant=GFM
10
10
  url = https://github.com/BiocPy/SingleCellExperiment
11
11
  project_urls =
12
- Documentation = https://github.com/BiocPy/SingleCellExperiment
12
+ Documentation = https://biocpy.github.io/SingleCellExperiment/
13
+ Source = https://github.com/BiocPy/SingleCellExperiment
13
14
  platforms = any
14
15
  classifiers =
15
16
  Development Status :: 4 - Beta
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SingleCellExperiment
3
- Version: 0.6.1
3
+ Version: 0.6.3
4
4
  Summary: Container class for single-cell experiments
5
5
  Home-page: https://github.com/BiocPy/SingleCellExperiment
6
6
  Author: jkanche
7
7
  Author-email: jayaram.kancherla@gmail.com
8
8
  License: MIT
9
- Project-URL: Documentation, https://github.com/BiocPy/SingleCellExperiment
9
+ Project-URL: Documentation, https://biocpy.github.io/SingleCellExperiment/
10
+ Project-URL: Source, https://github.com/BiocPy/SingleCellExperiment
10
11
  Platform: any
11
12
  Classifier: Development Status :: 4 - Beta
12
13
  Classifier: Programming Language :: Python
@@ -29,6 +29,8 @@ src/SingleCellExperiment.egg-info/SOURCES.txt
29
29
  src/SingleCellExperiment.egg-info/dependency_links.txt
30
30
  src/SingleCellExperiment.egg-info/not-zip-safe
31
31
  src/SingleCellExperiment.egg-info/requires.txt
32
+ src/SingleCellExperiment.egg-info/scm_file_list.json
33
+ src/SingleCellExperiment.egg-info/scm_version.json
32
34
  src/SingleCellExperiment.egg-info/top_level.txt
33
35
  src/singlecellexperiment/SingleCellExperiment.py
34
36
  src/singlecellexperiment/__init__.py
@@ -0,0 +1,50 @@
1
+ {
2
+ "files": [
3
+ ".coveragerc",
4
+ ".pre-commit-config.yaml",
5
+ "README.md",
6
+ "setup.cfg",
7
+ "tox.ini",
8
+ "LICENSE.txt",
9
+ "setup.py",
10
+ "pyproject.toml",
11
+ "CHANGELOG.md",
12
+ "CONTRIBUTING.md",
13
+ "AUTHORS.md",
14
+ ".readthedocs.yml",
15
+ ".gitignore",
16
+ "docs/readme.md",
17
+ "docs/Makefile",
18
+ "docs/authors.md",
19
+ "docs/requirements.txt",
20
+ "docs/tutorial.md",
21
+ "docs/contributing.md",
22
+ "docs/license.md",
23
+ "docs/changelog.md",
24
+ "docs/conf.py",
25
+ "docs/index.md",
26
+ "docs/_static/.gitignore",
27
+ "src/singlecellexperiment/__init__.py",
28
+ "src/singlecellexperiment/SingleCellExperiment.py",
29
+ "src/singlecellexperiment/_combineutils.py",
30
+ "src/singlecellexperiment/_ioutils.py",
31
+ "src/singlecellexperiment/io/tenx.py",
32
+ "src/singlecellexperiment/io/__init__.py",
33
+ "src/singlecellexperiment/io/h5ad.py",
34
+ "tests/test_sce_methods.py",
35
+ "tests/test_sce.py",
36
+ "tests/conftest.py",
37
+ "tests/test_sce_slice.py",
38
+ "tests/test_sce_io.py",
39
+ "tests/test_sce_combine_rows.py",
40
+ "tests/test_sce_combine_cols.py",
41
+ "tests/data/mocks.py",
42
+ "tests/data/adata.h5ad",
43
+ "tests/data/tenx.sub.h5",
44
+ "tests/data/raw_feature_bc_matrix/matrix.mtx",
45
+ "tests/data/raw_feature_bc_matrix/features.tsv",
46
+ "tests/data/raw_feature_bc_matrix/barcodes.tsv",
47
+ ".github/workflows/run-tests.yml",
48
+ ".github/workflows/publish-pypi.yml"
49
+ ]
50
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.6.3",
3
+ "distance": 0,
4
+ "node": "ge5f7e11fcea4daa04c4699ed04d87fdb8e9ed3ec",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-06-24"
8
+ }
@@ -6,6 +6,7 @@ from warnings import warn
6
6
 
7
7
  import biocframe
8
8
  import biocutils as ut
9
+ from summarizedexperiment import SummarizedExperiment
9
10
  from summarizedexperiment._combineutils import (
10
11
  check_assays_are_equal,
11
12
  merge_assays,
@@ -1194,14 +1195,18 @@ class SingleCellExperiment(RangedSummarizedExperiment):
1194
1195
  def from_anndata(cls, input: "anndata.AnnData") -> SingleCellExperiment:
1195
1196
  """Create a ``SingleCellExperiment`` from :py:class:`~anndata.AnnData`.
1196
1197
 
1197
- Args:
1198
+ If the input contains any data in the ``uns`` attribute, the
1199
+ `metadata` slot of the ``SingleCellExperiment`` will contain a key ``uns``.
1200
+
1201
+ If the input contains ``raw`` data, the ``SingleCellExperiment``
1202
+ will contain an alternative experiment called ``raw``.
1203
+
1204
+ Args:
1198
1205
  input:
1199
1206
  Input data.
1200
1207
 
1201
1208
  Returns:
1202
- A ``SingleCellExperiment`` object. If the input contains any data
1203
- in the ``uns`` attribute, the `metadata` slot of the ``SingleCellExperiment``
1204
- will contain a key ``uns``.
1209
+ A ``SingleCellExperiment`` object.
1205
1210
  """
1206
1211
 
1207
1212
  layers = OrderedDict()
@@ -1216,6 +1221,15 @@ class SingleCellExperiment(RangedSummarizedExperiment):
1216
1221
  obsp = _to_normal_dict(input.obsp)
1217
1222
  _metadata = {"uns": input.uns} if input.uns is not None else None
1218
1223
 
1224
+ alt_expts = None
1225
+ if input.raw is not None:
1226
+ raw_se = SummarizedExperiment(
1227
+ assays={"X": input.raw.X.transpose()},
1228
+ row_data=biocframe.BiocFrame.from_pandas(input.raw.var),
1229
+ column_data=biocframe.BiocFrame.from_pandas(input.obs),
1230
+ )
1231
+ alt_expts = {"raw": raw_se}
1232
+
1219
1233
  return cls(
1220
1234
  assays=layers,
1221
1235
  row_data=biocframe.BiocFrame.from_pandas(input.var),
@@ -1224,6 +1238,7 @@ class SingleCellExperiment(RangedSummarizedExperiment):
1224
1238
  reduced_dimensions=obsm,
1225
1239
  row_pairs=varp,
1226
1240
  column_pairs=obsp,
1241
+ alternative_experiments=alt_expts,
1227
1242
  )
1228
1243
 
1229
1244
  ###############################
@@ -1277,6 +1292,86 @@ class SingleCellExperiment(RangedSummarizedExperiment):
1277
1292
  """Wrapper around :py:func:`~combine_columns`."""
1278
1293
  return combine_columns(self, *other)
1279
1294
 
1295
+ #######################
1296
+ ######>> to rse <<#####
1297
+ #######################
1298
+
1299
+ def to_rangedsummarizedexperiment(self) -> RangedSummarizedExperiment:
1300
+ """Coerce to :py:class:`~summarizedexperiment.RangedSummarizedExperiment.RangedSummarizedExperiment`.
1301
+
1302
+ Returns:
1303
+ A ``RangedSummarizedExperiment`` object.
1304
+ """
1305
+ return RangedSummarizedExperiment(
1306
+ assays=self._assays,
1307
+ row_ranges=self._row_ranges,
1308
+ row_data=self._rows,
1309
+ column_data=self._cols,
1310
+ row_names=self._row_names,
1311
+ column_names=self._column_names,
1312
+ metadata=self._metadata,
1313
+ _validate=False,
1314
+ )
1315
+
1316
+ def to_rse(self) -> RangedSummarizedExperiment:
1317
+ """Alias for :py:meth:`~to_rangedsummarizedexperiment`."""
1318
+ return self.to_rangedsummarizedexperiment()
1319
+
1320
+ @classmethod
1321
+ def from_rangedsummarizedexperiment(cls, rse: RangedSummarizedExperiment) -> SingleCellExperiment:
1322
+ """Coerce from :py:class:`~summarizedexperiment.RangedSummarizedExperiment.RangedSummarizedExperiment`.
1323
+
1324
+ Args:
1325
+ rse:
1326
+ A ``RangedSummarizedExperiment`` object.
1327
+
1328
+ Returns:
1329
+ A ``SingleCellExperiment`` object.
1330
+ """
1331
+ return cls(
1332
+ assays=rse.assays,
1333
+ row_ranges=rse.row_ranges,
1334
+ row_data=rse.row_data,
1335
+ column_data=rse.col_data,
1336
+ row_names=rse.row_names,
1337
+ column_names=rse.column_names,
1338
+ metadata=rse.metadata,
1339
+ )
1340
+
1341
+ @classmethod
1342
+ def from_rse(cls, rse: RangedSummarizedExperiment) -> SingleCellExperiment:
1343
+ """Alias for :py:meth:`~from_rangedsummarizedexperiment`."""
1344
+ return cls.from_rangedsummarizedexperiment(rse)
1345
+
1346
+ ########################
1347
+ ######>> from se <<#####
1348
+ ########################
1349
+
1350
+ @classmethod
1351
+ def from_summarizedexperiment(cls, se: SummarizedExperiment) -> SingleCellExperiment:
1352
+ """Coerce from :py:class:`~summarizedexperiment.SummarizedExperiment.SummarizedExperiment`.
1353
+
1354
+ Args:
1355
+ se:
1356
+ A ``SummarizedExperiment`` object.
1357
+
1358
+ Returns:
1359
+ A ``SingleCellExperiment`` object.
1360
+ """
1361
+ return cls(
1362
+ assays=se.assays,
1363
+ row_data=se.row_data,
1364
+ column_data=se.col_data,
1365
+ row_names=se.row_names,
1366
+ column_names=se.column_names,
1367
+ metadata=se.metadata,
1368
+ )
1369
+
1370
+ @classmethod
1371
+ def from_se(cls, se: SummarizedExperiment) -> SingleCellExperiment:
1372
+ """Alias for :py:meth:`~from_summarizedexperiment`."""
1373
+ return cls.from_summarizedexperiment(se)
1374
+
1280
1375
 
1281
1376
  ############################
1282
1377
  ######>> combine ops <<#####
@@ -198,6 +198,16 @@ def test_SCE_randomAnnData():
198
198
  assert tse is not None
199
199
  assert isinstance(tse, SingleCellExperiment)
200
200
 
201
+ # set raw
202
+ adata.raw = adata.copy()
203
+ tse = singlecellexperiment.SingleCellExperiment.from_anndata(adata)
204
+
205
+ assert tse is not None
206
+ assert isinstance(tse, SingleCellExperiment)
207
+ assert tse.alternative_experiments is not None
208
+ assert "raw" in tse.alternative_experiments
209
+ assert isinstance(tse.alternative_experiments["raw"], SummarizedExperiment)
210
+ assert tse.alternative_experiments["raw"].shape == (d, n)
201
211
 
202
212
  def test_SCE_to_mudata():
203
213
  tse = SingleCellExperiment(
@@ -5,7 +5,7 @@ from biocframe import BiocFrame
5
5
  import numpy as np
6
6
  import pandas as pd
7
7
  import pytest
8
- from summarizedexperiment import SummarizedExperiment
8
+ from summarizedexperiment import SummarizedExperiment, RangedSummarizedExperiment
9
9
 
10
10
  from singlecellexperiment import SingleCellExperiment
11
11
  from singlecellexperiment.SingleCellExperiment import SingleCellExperiment as sce
@@ -90,3 +90,45 @@ def test_SCE_props():
90
90
 
91
91
  assert tse.reduced_dim_names is not None
92
92
  assert len(tse.reduced_dim_names) == 1
93
+
94
+ def test_SCE_to_RSE():
95
+ tse = SingleCellExperiment(
96
+ assays={"counts": counts}, row_data=row_data, column_data=col_data, row_ranges=gr
97
+ )
98
+
99
+ rse = tse.to_rangedsummarizedexperiment()
100
+ assert isinstance(rse, RangedSummarizedExperiment)
101
+ assert not isinstance(rse, SingleCellExperiment)
102
+ assert rse.shape == tse.shape
103
+ assert rse.row_ranges is not None
104
+
105
+ def test_RSE_to_SCE():
106
+ rse = RangedSummarizedExperiment(
107
+ assays={"counts": counts}, row_data=row_data, column_data=col_data, row_ranges=gr
108
+ )
109
+
110
+ tse = SingleCellExperiment.from_rangedsummarizedexperiment(rse)
111
+ assert isinstance(tse, SingleCellExperiment)
112
+ assert tse.shape == rse.shape
113
+ assert tse.row_ranges is not None
114
+
115
+ def test_SCE_to_SE():
116
+ tse = SingleCellExperiment(
117
+ assays={"counts": counts}, row_data=row_data, column_data=col_data, row_ranges=gr
118
+ )
119
+
120
+ se = tse.to_summarizedexperiment()
121
+ assert isinstance(se, SummarizedExperiment)
122
+ assert not isinstance(se, SingleCellExperiment)
123
+ assert se.shape == tse.shape
124
+ assert se.row_data is not None
125
+ assert "seqnames" in se.row_data.column_names
126
+
127
+ def test_SE_to_SCE():
128
+ se = SummarizedExperiment(
129
+ assays={"counts": counts}, row_data=row_data, column_data=col_data
130
+ )
131
+
132
+ tse = SingleCellExperiment.from_summarizedexperiment(se)
133
+ assert isinstance(tse, SingleCellExperiment)
134
+ assert tse.shape == se.shape