SingleCellExperiment 0.4.4__tar.gz → 0.4.6__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.
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/.pre-commit-config.yaml +3 -3
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/PKG-INFO +3 -1
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/setup.cfg +2 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/SingleCellExperiment.egg-info/PKG-INFO +3 -1
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/SingleCellExperiment.egg-info/requires.txt +2 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/SingleCellExperiment.py +5 -2
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/io/tenx.py +15 -10
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/tests/test_sce_io.py +16 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/.coveragerc +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/.github/workflows/pypi-publish.yml +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/.github/workflows/pypi-test.yml +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/.gitignore +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/.readthedocs.yml +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/AUTHORS.md +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/CHANGELOG.md +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/CONTRIBUTING.md +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/LICENSE.txt +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/README.md +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/docs/Makefile +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/docs/_static/.gitignore +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/docs/authors.md +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/docs/changelog.md +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/docs/conf.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/docs/contributing.md +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/docs/index.md +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/docs/license.md +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/docs/readme.md +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/docs/requirements.txt +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/docs/tutorial.md +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/pyproject.toml +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/setup.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/SingleCellExperiment.egg-info/SOURCES.txt +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/SingleCellExperiment.egg-info/dependency_links.txt +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/SingleCellExperiment.egg-info/not-zip-safe +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/SingleCellExperiment.egg-info/top_level.txt +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/__init__.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/_combineutils.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/_ioutils.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/io/__init__.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/io/h5ad.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/tests/conftest.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/tests/data/adata.h5ad +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/tests/data/mocks.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/tests/data/tenx.sub.h5 +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/tests/test_sce.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/tests/test_sce_combine_cols.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/tests/test_sce_combine_rows.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/tests/test_sce_methods.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/tests/test_sce_slice.py +0 -0
- {SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/tox.ini +0 -0
|
@@ -2,7 +2,7 @@ exclude: '^docs/conf.py'
|
|
|
2
2
|
|
|
3
3
|
repos:
|
|
4
4
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
-
rev: v4.
|
|
5
|
+
rev: v4.6.0
|
|
6
6
|
hooks:
|
|
7
7
|
- id: trailing-whitespace
|
|
8
8
|
- id: check-added-large-files
|
|
@@ -26,14 +26,14 @@ repos:
|
|
|
26
26
|
# --config, ./pyproject.toml
|
|
27
27
|
|
|
28
28
|
- repo: https://github.com/psf/black
|
|
29
|
-
rev: 24.
|
|
29
|
+
rev: 24.4.0
|
|
30
30
|
hooks:
|
|
31
31
|
- id: black
|
|
32
32
|
language_version: python3
|
|
33
33
|
|
|
34
34
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
35
35
|
# Ruff version.
|
|
36
|
-
rev: v0.
|
|
36
|
+
rev: v0.3.7
|
|
37
37
|
hooks:
|
|
38
38
|
- id: ruff
|
|
39
39
|
args: [--fix, --exit-non-zero-on-fix]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: SingleCellExperiment
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.6
|
|
4
4
|
Summary: Container class for single-cell experiments
|
|
5
5
|
Home-page: https://github.com/BiocPy/SingleCellExperiment
|
|
6
6
|
Author: jkanche
|
|
@@ -20,6 +20,7 @@ Requires-Dist: anndata; extra == "optional"
|
|
|
20
20
|
Requires-Dist: h5py; extra == "optional"
|
|
21
21
|
Requires-Dist: mudata; extra == "optional"
|
|
22
22
|
Requires-Dist: delayedarray; extra == "optional"
|
|
23
|
+
Requires-Dist: hdf5array; extra == "optional"
|
|
23
24
|
Provides-Extra: testing
|
|
24
25
|
Requires-Dist: setuptools; extra == "testing"
|
|
25
26
|
Requires-Dist: pytest; extra == "testing"
|
|
@@ -28,6 +29,7 @@ Requires-Dist: anndata; extra == "testing"
|
|
|
28
29
|
Requires-Dist: h5py; extra == "testing"
|
|
29
30
|
Requires-Dist: mudata; extra == "testing"
|
|
30
31
|
Requires-Dist: delayedarray; extra == "testing"
|
|
32
|
+
Requires-Dist: hdf5array; extra == "testing"
|
|
31
33
|
|
|
32
34
|
[](https://pyscaffold.org/)
|
|
33
35
|
[](https://pypi.org/project/SingleCellExperiment/)
|
{SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/SingleCellExperiment.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: SingleCellExperiment
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.6
|
|
4
4
|
Summary: Container class for single-cell experiments
|
|
5
5
|
Home-page: https://github.com/BiocPy/SingleCellExperiment
|
|
6
6
|
Author: jkanche
|
|
@@ -20,6 +20,7 @@ Requires-Dist: anndata; extra == "optional"
|
|
|
20
20
|
Requires-Dist: h5py; extra == "optional"
|
|
21
21
|
Requires-Dist: mudata; extra == "optional"
|
|
22
22
|
Requires-Dist: delayedarray; extra == "optional"
|
|
23
|
+
Requires-Dist: hdf5array; extra == "optional"
|
|
23
24
|
Provides-Extra: testing
|
|
24
25
|
Requires-Dist: setuptools; extra == "testing"
|
|
25
26
|
Requires-Dist: pytest; extra == "testing"
|
|
@@ -28,6 +29,7 @@ Requires-Dist: anndata; extra == "testing"
|
|
|
28
29
|
Requires-Dist: h5py; extra == "testing"
|
|
29
30
|
Requires-Dist: mudata; extra == "testing"
|
|
30
31
|
Requires-Dist: delayedarray; extra == "testing"
|
|
32
|
+
Requires-Dist: hdf5array; extra == "testing"
|
|
31
33
|
|
|
32
34
|
[](https://pyscaffold.org/)
|
|
33
35
|
[](https://pypi.org/project/SingleCellExperiment/)
|
|
@@ -1015,7 +1015,9 @@ class SingleCellExperiment(RangedSummarizedExperiment):
|
|
|
1015
1015
|
Input data.
|
|
1016
1016
|
|
|
1017
1017
|
Returns:
|
|
1018
|
-
A ``SingleCellExperiment`` object.
|
|
1018
|
+
A ``SingleCellExperiment`` object. If the input contains any data
|
|
1019
|
+
in the ``uns`` attribute, the `metadata` slot of the ``SingleCellExperiment``
|
|
1020
|
+
will contain a key ``uns``.
|
|
1019
1021
|
"""
|
|
1020
1022
|
|
|
1021
1023
|
layers = OrderedDict()
|
|
@@ -1028,12 +1030,13 @@ class SingleCellExperiment(RangedSummarizedExperiment):
|
|
|
1028
1030
|
obsm = _to_normal_dict(input.obsm)
|
|
1029
1031
|
varp = _to_normal_dict(input.varp)
|
|
1030
1032
|
obsp = _to_normal_dict(input.obsp)
|
|
1033
|
+
_metadata = {"uns": input.uns} if input.uns is not None else None
|
|
1031
1034
|
|
|
1032
1035
|
return cls(
|
|
1033
1036
|
assays=layers,
|
|
1034
1037
|
row_data=biocframe.BiocFrame.from_pandas(input.var),
|
|
1035
1038
|
column_data=biocframe.BiocFrame.from_pandas(input.obs),
|
|
1036
|
-
metadata=
|
|
1039
|
+
metadata=_metadata,
|
|
1037
1040
|
reduced_dims=obsm,
|
|
1038
1041
|
row_pairs=varp,
|
|
1039
1042
|
column_pairs=obsp,
|
{SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/io/tenx.py
RENAMED
|
@@ -44,7 +44,7 @@ def read_tenx_mtx(path: str) -> SingleCellExperiment:
|
|
|
44
44
|
)
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
def read_tenx_h5(path: str) -> SingleCellExperiment:
|
|
47
|
+
def read_tenx_h5(path: str, realize_assays: bool = False) -> SingleCellExperiment:
|
|
48
48
|
"""Read 10X H5 file as :py:class:`~singlecellexperiment.SingleCellExperiment.SingleCellExperiment`.
|
|
49
49
|
|
|
50
50
|
Note: Currently only supports version 3 of the 10X H5 format.
|
|
@@ -53,12 +53,17 @@ def read_tenx_h5(path: str) -> SingleCellExperiment:
|
|
|
53
53
|
path:
|
|
54
54
|
Path to 10x H5 file.
|
|
55
55
|
|
|
56
|
+
realize_assays:
|
|
57
|
+
Whether to realize assays into memory.
|
|
58
|
+
Defaults to False.
|
|
59
|
+
|
|
56
60
|
Returns:
|
|
57
61
|
A single-cell experiment object.
|
|
58
62
|
"""
|
|
59
63
|
|
|
64
|
+
import delayedarray as da
|
|
60
65
|
import h5py
|
|
61
|
-
from
|
|
66
|
+
from hdf5array import Hdf5CompressedSparseMatrix
|
|
62
67
|
|
|
63
68
|
h5 = h5py.File(path, mode="r")
|
|
64
69
|
|
|
@@ -68,16 +73,14 @@ def read_tenx_h5(path: str) -> SingleCellExperiment:
|
|
|
68
73
|
groups = h5["matrix"].keys()
|
|
69
74
|
|
|
70
75
|
# read the matrix
|
|
71
|
-
data = h5["matrix"]["data"][:]
|
|
72
|
-
indices = h5["matrix"]["indices"][:]
|
|
73
|
-
indptr = h5["matrix"]["indptr"][:]
|
|
74
76
|
shape = tuple(h5["matrix"]["shape"][:])
|
|
75
77
|
|
|
76
|
-
counts =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
counts = Hdf5CompressedSparseMatrix(
|
|
79
|
+
path=path, group_name="matrix", by_column=True, shape=shape
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
if realize_assays is True:
|
|
83
|
+
counts = da.to_scipy_sparse_matrix(counts, "csr")
|
|
81
84
|
|
|
82
85
|
# read features
|
|
83
86
|
features = None
|
|
@@ -106,6 +109,8 @@ def read_tenx_h5(path: str) -> SingleCellExperiment:
|
|
|
106
109
|
barcodes["barcodes"] = [x.decode("ascii") for x in h5["matrix"]["barcodes"]]
|
|
107
110
|
barcodes = BiocFrame(barcodes, number_of_rows=counts.shape[1])
|
|
108
111
|
|
|
112
|
+
h5.close()
|
|
113
|
+
|
|
109
114
|
return SingleCellExperiment(
|
|
110
115
|
assays={"counts": counts}, row_data=features, column_data=barcodes
|
|
111
116
|
)
|
|
@@ -6,9 +6,11 @@ from biocframe import BiocFrame
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
import pandas as pd
|
|
8
8
|
from mudata import MuData
|
|
9
|
+
from scipy import sparse
|
|
9
10
|
|
|
10
11
|
import singlecellexperiment
|
|
11
12
|
from singlecellexperiment.SingleCellExperiment import SingleCellExperiment
|
|
13
|
+
from hdf5array import Hdf5CompressedSparseMatrix
|
|
12
14
|
|
|
13
15
|
__author__ = "jkanche"
|
|
14
16
|
__copyright__ = "jkanche"
|
|
@@ -95,6 +97,7 @@ def test_SCE_from10xH5():
|
|
|
95
97
|
assert isinstance(tse, SingleCellExperiment)
|
|
96
98
|
|
|
97
99
|
assert tse.assays is not None
|
|
100
|
+
assert isinstance(tse.assay(0), Hdf5CompressedSparseMatrix)
|
|
98
101
|
assert tse.row_data is not None
|
|
99
102
|
assert tse.col_data is not None
|
|
100
103
|
|
|
@@ -110,6 +113,11 @@ def test_SCE_from10xH5():
|
|
|
110
113
|
|
|
111
114
|
assert sliced.shape == (10, 4)
|
|
112
115
|
|
|
116
|
+
tse = singlecellexperiment.read_tenx_h5(
|
|
117
|
+
"tests/data/tenx.sub.h5", realize_assays=True
|
|
118
|
+
)
|
|
119
|
+
assert isinstance(tse.assay(0), sparse.spmatrix)
|
|
120
|
+
|
|
113
121
|
|
|
114
122
|
def test_SCE_randomAnnData():
|
|
115
123
|
np.random.seed(1)
|
|
@@ -129,6 +137,14 @@ def test_SCE_randomAnnData():
|
|
|
129
137
|
assert tse is not None
|
|
130
138
|
assert isinstance(tse, SingleCellExperiment)
|
|
131
139
|
|
|
140
|
+
# to avoid unknown mapping types;
|
|
141
|
+
# ran into an issue with anndata.compat._overloaded_dict.OverloadedDict when loading a h5ad
|
|
142
|
+
adata.uns = {".internal": [f"obs_{i+1}" for i in range(n)]}
|
|
143
|
+
tse = singlecellexperiment.SingleCellExperiment.from_anndata(adata)
|
|
144
|
+
|
|
145
|
+
assert tse is not None
|
|
146
|
+
assert isinstance(tse, SingleCellExperiment)
|
|
147
|
+
|
|
132
148
|
|
|
133
149
|
def test_SCE_to_mudata():
|
|
134
150
|
tse = SingleCellExperiment(
|
|
File without changes
|
{SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/.github/workflows/pypi-publish.yml
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/__init__.py
RENAMED
|
File without changes
|
{SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/_combineutils.py
RENAMED
|
File without changes
|
{SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/_ioutils.py
RENAMED
|
File without changes
|
{SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/io/__init__.py
RENAMED
|
File without changes
|
{SingleCellExperiment-0.4.4 → singlecellexperiment-0.4.6}/src/singlecellexperiment/io/h5ad.py
RENAMED
|
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
|