SingleCellExperiment 0.6.1__tar.gz → 0.6.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 (53) hide show
  1. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/CHANGELOG.md +3 -1
  2. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/PKG-INFO +1 -1
  3. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/docs/changelog.md +3 -1
  4. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/SingleCellExperiment.egg-info/PKG-INFO +1 -1
  5. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/singlecellexperiment/SingleCellExperiment.py +81 -0
  6. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/test_sce_methods.py +43 -1
  7. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/.coveragerc +0 -0
  8. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/.github/workflows/publish-pypi.yml +0 -0
  9. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/.github/workflows/run-tests.yml +0 -0
  10. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/.gitignore +0 -0
  11. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/.pre-commit-config.yaml +0 -0
  12. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/.readthedocs.yml +0 -0
  13. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/AUTHORS.md +0 -0
  14. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/CONTRIBUTING.md +0 -0
  15. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/LICENSE.txt +0 -0
  16. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/README.md +0 -0
  17. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/docs/Makefile +0 -0
  18. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/docs/_static/.gitignore +0 -0
  19. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/docs/authors.md +0 -0
  20. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/docs/conf.py +0 -0
  21. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/docs/contributing.md +0 -0
  22. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/docs/index.md +0 -0
  23. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/docs/license.md +0 -0
  24. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/docs/readme.md +0 -0
  25. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/docs/requirements.txt +0 -0
  26. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/docs/tutorial.md +0 -0
  27. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/pyproject.toml +0 -0
  28. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/setup.cfg +0 -0
  29. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/setup.py +0 -0
  30. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/SingleCellExperiment.egg-info/SOURCES.txt +0 -0
  31. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/SingleCellExperiment.egg-info/dependency_links.txt +0 -0
  32. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/SingleCellExperiment.egg-info/not-zip-safe +0 -0
  33. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/SingleCellExperiment.egg-info/requires.txt +0 -0
  34. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/SingleCellExperiment.egg-info/top_level.txt +0 -0
  35. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/singlecellexperiment/__init__.py +0 -0
  36. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/singlecellexperiment/_combineutils.py +0 -0
  37. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/singlecellexperiment/_ioutils.py +0 -0
  38. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/singlecellexperiment/io/__init__.py +0 -0
  39. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/singlecellexperiment/io/h5ad.py +0 -0
  40. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/src/singlecellexperiment/io/tenx.py +0 -0
  41. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/conftest.py +0 -0
  42. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/data/adata.h5ad +0 -0
  43. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/data/mocks.py +0 -0
  44. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/data/raw_feature_bc_matrix/barcodes.tsv +0 -0
  45. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/data/raw_feature_bc_matrix/features.tsv +0 -0
  46. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/data/raw_feature_bc_matrix/matrix.mtx +0 -0
  47. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/data/tenx.sub.h5 +0 -0
  48. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/test_sce.py +0 -0
  49. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/test_sce_combine_cols.py +0 -0
  50. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/test_sce_combine_rows.py +0 -0
  51. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/test_sce_io.py +0 -0
  52. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tests/test_sce_slice.py +0 -0
  53. {singlecellexperiment-0.6.1 → singlecellexperiment-0.6.2}/tox.ini +0 -0
@@ -1,9 +1,11 @@
1
1
  # Changelog
2
2
 
3
- ## Version 0.6.0
3
+ ## Version 0.6.0 - 0.6.2
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.
7
9
 
8
10
  ## Version 0.5.8 - 0.5.9
9
11
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SingleCellExperiment
3
- Version: 0.6.1
3
+ Version: 0.6.2
4
4
  Summary: Container class for single-cell experiments
5
5
  Home-page: https://github.com/BiocPy/SingleCellExperiment
6
6
  Author: jkanche
@@ -1,9 +1,11 @@
1
1
  # Changelog
2
2
 
3
- ## Version 0.6.0
3
+ ## Version 0.6.0 - 0.6.2
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.
7
9
 
8
10
  ## Version 0.5.8 - 0.5.9
9
11
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SingleCellExperiment
3
- Version: 0.6.1
3
+ Version: 0.6.2
4
4
  Summary: Container class for single-cell experiments
5
5
  Home-page: https://github.com/BiocPy/SingleCellExperiment
6
6
  Author: jkanche
@@ -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,
@@ -1277,6 +1278,86 @@ class SingleCellExperiment(RangedSummarizedExperiment):
1277
1278
  """Wrapper around :py:func:`~combine_columns`."""
1278
1279
  return combine_columns(self, *other)
1279
1280
 
1281
+ #######################
1282
+ ######>> to rse <<#####
1283
+ #######################
1284
+
1285
+ def to_rangedsummarizedexperiment(self) -> RangedSummarizedExperiment:
1286
+ """Coerce to :py:class:`~summarizedexperiment.RangedSummarizedExperiment.RangedSummarizedExperiment`.
1287
+
1288
+ Returns:
1289
+ A ``RangedSummarizedExperiment`` object.
1290
+ """
1291
+ return RangedSummarizedExperiment(
1292
+ assays=self._assays,
1293
+ row_ranges=self._row_ranges,
1294
+ row_data=self._rows,
1295
+ column_data=self._cols,
1296
+ row_names=self._row_names,
1297
+ column_names=self._column_names,
1298
+ metadata=self._metadata,
1299
+ _validate=False,
1300
+ )
1301
+
1302
+ def to_rse(self) -> RangedSummarizedExperiment:
1303
+ """Alias for :py:meth:`~to_rangedsummarizedexperiment`."""
1304
+ return self.to_rangedsummarizedexperiment()
1305
+
1306
+ @classmethod
1307
+ def from_rangedsummarizedexperiment(cls, rse: RangedSummarizedExperiment) -> SingleCellExperiment:
1308
+ """Coerce from :py:class:`~summarizedexperiment.RangedSummarizedExperiment.RangedSummarizedExperiment`.
1309
+
1310
+ Args:
1311
+ rse:
1312
+ A ``RangedSummarizedExperiment`` object.
1313
+
1314
+ Returns:
1315
+ A ``SingleCellExperiment`` object.
1316
+ """
1317
+ return cls(
1318
+ assays=rse.assays,
1319
+ row_ranges=rse.row_ranges,
1320
+ row_data=rse.row_data,
1321
+ column_data=rse.col_data,
1322
+ row_names=rse.row_names,
1323
+ column_names=rse.column_names,
1324
+ metadata=rse.metadata,
1325
+ )
1326
+
1327
+ @classmethod
1328
+ def from_rse(cls, rse: RangedSummarizedExperiment) -> SingleCellExperiment:
1329
+ """Alias for :py:meth:`~from_rangedsummarizedexperiment`."""
1330
+ return cls.from_rangedsummarizedexperiment(rse)
1331
+
1332
+ ########################
1333
+ ######>> from se <<#####
1334
+ ########################
1335
+
1336
+ @classmethod
1337
+ def from_summarizedexperiment(cls, se: SummarizedExperiment) -> SingleCellExperiment:
1338
+ """Coerce from :py:class:`~summarizedexperiment.SummarizedExperiment.SummarizedExperiment`.
1339
+
1340
+ Args:
1341
+ se:
1342
+ A ``SummarizedExperiment`` object.
1343
+
1344
+ Returns:
1345
+ A ``SingleCellExperiment`` object.
1346
+ """
1347
+ return cls(
1348
+ assays=se.assays,
1349
+ row_data=se.row_data,
1350
+ column_data=se.col_data,
1351
+ row_names=se.row_names,
1352
+ column_names=se.column_names,
1353
+ metadata=se.metadata,
1354
+ )
1355
+
1356
+ @classmethod
1357
+ def from_se(cls, se: SummarizedExperiment) -> SingleCellExperiment:
1358
+ """Alias for :py:meth:`~from_summarizedexperiment`."""
1359
+ return cls.from_summarizedexperiment(se)
1360
+
1280
1361
 
1281
1362
  ############################
1282
1363
  ######>> combine ops <<#####
@@ -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