SingleCellExperiment 0.5.7__tar.gz → 0.5.8__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.5.7 → singlecellexperiment-0.5.8}/.pre-commit-config.yaml +1 -1
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/CHANGELOG.md +9 -4
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/PKG-INFO +1 -1
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/docs/changelog.md +9 -4
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/SingleCellExperiment.egg-info/PKG-INFO +1 -1
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/SingleCellExperiment.py +26 -4
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/test_sce.py +45 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/.coveragerc +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/.github/workflows/publish-pypi.yml +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/.github/workflows/run-tests.yml +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/.gitignore +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/.readthedocs.yml +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/AUTHORS.md +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/CONTRIBUTING.md +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/LICENSE.txt +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/README.md +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/docs/Makefile +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/docs/_static/.gitignore +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/docs/authors.md +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/docs/conf.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/docs/contributing.md +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/docs/index.md +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/docs/license.md +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/docs/readme.md +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/docs/requirements.txt +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/docs/tutorial.md +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/pyproject.toml +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/setup.cfg +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/setup.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/SingleCellExperiment.egg-info/SOURCES.txt +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/SingleCellExperiment.egg-info/dependency_links.txt +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/SingleCellExperiment.egg-info/not-zip-safe +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/SingleCellExperiment.egg-info/requires.txt +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/SingleCellExperiment.egg-info/top_level.txt +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/__init__.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/_combineutils.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/_ioutils.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/io/__init__.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/io/h5ad.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/io/tenx.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/conftest.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/data/adata.h5ad +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/data/mocks.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/data/raw_feature_bc_matrix/barcodes.tsv +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/data/raw_feature_bc_matrix/features.tsv +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/data/raw_feature_bc_matrix/matrix.mtx +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/data/tenx.sub.h5 +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/test_sce_combine_cols.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/test_sce_combine_rows.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/test_sce_io.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/test_sce_methods.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tests/test_sce_slice.py +0 -0
- {singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/tox.ini +0 -0
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Version 0.5.8
|
|
4
|
+
|
|
5
|
+
- Rename `reduced_dims` to `reduced_dimensions`. Constructor accepts both these arguments for backwards compatibility.
|
|
6
|
+
- Additionally, SCE's constructor takes kwargs for future proofing any additional attributes in the upstream classes.
|
|
7
|
+
|
|
3
8
|
## Version 0.5.7
|
|
9
|
+
|
|
4
10
|
- Support reading outputs from CellRanger version 3 and later in `read_tenx_mtx`.
|
|
5
11
|
- Handle both `genes.csv` and `features.csv` for gene annotations.
|
|
6
12
|
|
|
7
13
|
## Version 0.5.6
|
|
8
14
|
|
|
9
|
-
- Check if the column names of the alternative experiments match with the column names of the main experiment. This is the equivalent to the
|
|
15
|
+
- Check if the column names of the alternative experiments match with the column names of the main experiment. This is the equivalent to the `withDimnames` parameter in the R implementation.
|
|
10
16
|
- On **getters** of alternative experiments, if `with_dim_names` is True, column names of the alternative experiment are **replaced** with the
|
|
11
|
-
|
|
17
|
+
column names of the main experiment.
|
|
12
18
|
- On **setters** of alternative experiments, if `with_dim_names` is True, column names of the alternative experiment are **checked** with the
|
|
13
|
-
|
|
19
|
+
column names of the main experiment and an Exception is raised if they do not match.
|
|
14
20
|
|
|
15
21
|
## Version 0.5.1 - 0.5.5
|
|
16
22
|
|
|
@@ -19,7 +25,6 @@
|
|
|
19
25
|
- Add getters and setters to replace a specific alternative experiment or reduced dimension.
|
|
20
26
|
- Fixed an issue with numpy arrays as slice arguments. Code now uses Biocutils's subset functions to perform these operations.
|
|
21
27
|
|
|
22
|
-
|
|
23
28
|
## Version 0.5.0
|
|
24
29
|
|
|
25
30
|
- chore: Remove Python 3.8 (EOL)
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Version 0.5.8
|
|
4
|
+
|
|
5
|
+
- Rename `reduced_dims` to `reduced_dimensions`. Constructor accepts both these arguments for backwards compatibility.
|
|
6
|
+
- Additionally, SCE's constructor takes kwargs for future proofing any additional attributes in the upstream classes.
|
|
7
|
+
|
|
3
8
|
## Version 0.5.7
|
|
9
|
+
|
|
4
10
|
- Support reading outputs from CellRanger version 3 and later in `read_tenx_mtx`.
|
|
5
11
|
- Handle both `genes.csv` and `features.csv` for gene annotations.
|
|
6
12
|
|
|
7
13
|
## Version 0.5.6
|
|
8
14
|
|
|
9
|
-
- Check if the column names of the alternative experiments match with the column names of the main experiment. This is the equivalent to the
|
|
15
|
+
- Check if the column names of the alternative experiments match with the column names of the main experiment. This is the equivalent to the `withDimnames` parameter in the R implementation.
|
|
10
16
|
- On **getters** of alternative experiments, if `with_dim_names` is True, column names of the alternative experiment are **replaced** with the
|
|
11
|
-
|
|
17
|
+
column names of the main experiment.
|
|
12
18
|
- On **setters** of alternative experiments, if `with_dim_names` is True, column names of the alternative experiment are **checked** with the
|
|
13
|
-
|
|
19
|
+
column names of the main experiment and an Exception is raised if they do not match.
|
|
14
20
|
|
|
15
21
|
## Version 0.5.1 - 0.5.5
|
|
16
22
|
|
|
@@ -19,7 +25,6 @@
|
|
|
19
25
|
- Add getters and setters to replace a specific alternative experiment or reduced dimension.
|
|
20
26
|
- Fixed an issue with numpy arrays as slice arguments. Code now uses Biocutils's subset functions to perform these operations.
|
|
21
27
|
|
|
22
|
-
|
|
23
28
|
## Version 0.5.0
|
|
24
29
|
|
|
25
30
|
- chore: Remove Python 3.8 (EOL)
|
|
@@ -94,7 +94,7 @@ class SingleCellExperiment(RangedSummarizedExperiment):
|
|
|
94
94
|
parent experiment. Otherwise, these cells do not share the same sample or annotations
|
|
95
95
|
and cannot be set in alternative experiments!
|
|
96
96
|
|
|
97
|
-
Note: Validation checks do not apply to ``row_pairs`` or ``
|
|
97
|
+
Note: Validation checks do not apply to ``row_pairs`` or ``column_pairs``.
|
|
98
98
|
"""
|
|
99
99
|
|
|
100
100
|
def __init__(
|
|
@@ -106,13 +106,15 @@ class SingleCellExperiment(RangedSummarizedExperiment):
|
|
|
106
106
|
row_names: Optional[List[str]] = None,
|
|
107
107
|
column_names: Optional[List[str]] = None,
|
|
108
108
|
metadata: Optional[dict] = None,
|
|
109
|
-
|
|
109
|
+
reduced_dimensions: Optional[Dict[str, Any]] = None,
|
|
110
|
+
reduced_dims: Optional[Dict[str, Any]] = None, # deprecated name
|
|
110
111
|
main_experiment_name: Optional[str] = None,
|
|
111
112
|
alternative_experiments: Optional[Dict[str, Any]] = None,
|
|
112
113
|
row_pairs: Optional[Any] = None,
|
|
113
114
|
column_pairs: Optional[Any] = None,
|
|
114
115
|
alternative_experiment_check_dim_names: bool = True,
|
|
115
116
|
validate: bool = True,
|
|
117
|
+
**kwargs,
|
|
116
118
|
) -> None:
|
|
117
119
|
"""Initialize a single-cell experiment.
|
|
118
120
|
|
|
@@ -157,7 +159,7 @@ class SingleCellExperiment(RangedSummarizedExperiment):
|
|
|
157
159
|
Additional experimental metadata describing the methods.
|
|
158
160
|
Defaults to None.
|
|
159
161
|
|
|
160
|
-
|
|
162
|
+
reduced_dimensions:
|
|
161
163
|
Slot for low-dimensionality embeddings.
|
|
162
164
|
|
|
163
165
|
Usually a dictionary with the embedding method as keys (e.g., t-SNE, UMAP)
|
|
@@ -165,6 +167,9 @@ class SingleCellExperiment(RangedSummarizedExperiment):
|
|
|
165
167
|
|
|
166
168
|
Embeddings may be represented as a matrix or a data frame, must contain a shape.
|
|
167
169
|
|
|
170
|
+
reduced_dims:
|
|
171
|
+
Will be deprecated in the future versions. Use py:attr:`~reduced_dimensions` instead.
|
|
172
|
+
|
|
168
173
|
main_experiment_name:
|
|
169
174
|
A string, specifying the main experiment name.
|
|
170
175
|
|
|
@@ -195,6 +200,9 @@ class SingleCellExperiment(RangedSummarizedExperiment):
|
|
|
195
200
|
|
|
196
201
|
validate:
|
|
197
202
|
Internal use only.
|
|
203
|
+
|
|
204
|
+
kwargs:
|
|
205
|
+
Additional arguments.
|
|
198
206
|
"""
|
|
199
207
|
|
|
200
208
|
super().__init__(
|
|
@@ -206,10 +214,20 @@ class SingleCellExperiment(RangedSummarizedExperiment):
|
|
|
206
214
|
column_names=column_names,
|
|
207
215
|
metadata=metadata,
|
|
208
216
|
validate=validate,
|
|
217
|
+
**kwargs,
|
|
209
218
|
)
|
|
210
219
|
self._main_experiment_name = main_experiment_name
|
|
211
220
|
|
|
212
|
-
|
|
221
|
+
_dims = None
|
|
222
|
+
if reduced_dimensions is not None and reduced_dims is not None:
|
|
223
|
+
raise ValueError("Either 'reduced_dims' or 'reduced_dimensions' should be provided, but not both.")
|
|
224
|
+
elif reduced_dims is not None:
|
|
225
|
+
warn("'reduced_dims' is deprecated, use 'reduced_dimensions' instead.", DeprecationWarning)
|
|
226
|
+
_dims = reduced_dims
|
|
227
|
+
elif reduced_dimensions is not None:
|
|
228
|
+
_dims = reduced_dimensions
|
|
229
|
+
|
|
230
|
+
self._reduced_dims = _dims if _dims is not None else {}
|
|
213
231
|
|
|
214
232
|
self._alternative_experiments = alternative_experiments if alternative_experiments is not None else {}
|
|
215
233
|
|
|
@@ -551,6 +569,10 @@ class SingleCellExperiment(RangedSummarizedExperiment):
|
|
|
551
569
|
"""Alias for :py:meth:`~get_reduced_dimension`, for back-compatibility."""
|
|
552
570
|
return self.get_reduced_dimension(name=name)
|
|
553
571
|
|
|
572
|
+
def reduced_dimension(self, name: Union[str, int]) -> Any:
|
|
573
|
+
"""Alias for :py:meth:`~get_reduced_dimension`, for back-compatibility."""
|
|
574
|
+
return self.get_reduced_dimension(name=name)
|
|
575
|
+
|
|
554
576
|
def set_reduced_dimension(self, name: str, embedding: Any, in_place: bool = False) -> "SingleCellExperiment":
|
|
555
577
|
"""Add or replace :py:attr:`~singlecellexperiment.SingleCellExperiment.reduced_dimension`'s.
|
|
556
578
|
|
|
@@ -172,3 +172,48 @@ def test_SCE_different_alt_names():
|
|
|
172
172
|
column_data=pd.DataFrame(index = ["ChIP", "Input", "Input"] * 2),
|
|
173
173
|
alternative_experiments={"alt": rse},
|
|
174
174
|
)
|
|
175
|
+
|
|
176
|
+
def test_SCE_dims():
|
|
177
|
+
embeds = np.random.rand(counts.shape[1], 4)
|
|
178
|
+
tse = SingleCellExperiment(
|
|
179
|
+
assays={"counts": counts},
|
|
180
|
+
row_data=row_data,
|
|
181
|
+
column_data=col_data,
|
|
182
|
+
reduced_dimensions={
|
|
183
|
+
"something": embeds
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
assert tse is not None
|
|
188
|
+
assert isinstance(tse, sce)
|
|
189
|
+
assert tse.get_reduced_dimension_names() == ["something"]
|
|
190
|
+
|
|
191
|
+
tse2 = SingleCellExperiment(
|
|
192
|
+
assays={"counts": counts},
|
|
193
|
+
row_data=row_data,
|
|
194
|
+
column_data=col_data,
|
|
195
|
+
reduced_dims={
|
|
196
|
+
"something": embeds
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
assert tse2 is not None
|
|
201
|
+
assert isinstance(tse2, sce)
|
|
202
|
+
assert tse2.get_reduced_dimension_names() == ["something"]
|
|
203
|
+
|
|
204
|
+
print(tse.get_reduced_dimension("something"), tse2.get_reduced_dimension("something"))
|
|
205
|
+
|
|
206
|
+
assert np.allclose(tse.get_reduced_dimension("something"), tse2.get_reduced_dimension("something"))
|
|
207
|
+
|
|
208
|
+
with pytest.raises(Exception, match="Either 'reduced_dims' or 'reduced_dimensions' should be provided, but not both."):
|
|
209
|
+
SingleCellExperiment(
|
|
210
|
+
assays={"counts": counts},
|
|
211
|
+
row_data=row_data,
|
|
212
|
+
column_data=col_data,
|
|
213
|
+
reduced_dims={
|
|
214
|
+
"something": embeds
|
|
215
|
+
},
|
|
216
|
+
reduced_dimensions={
|
|
217
|
+
"something": embeds
|
|
218
|
+
}
|
|
219
|
+
)
|
|
File without changes
|
{singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/.github/workflows/publish-pypi.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.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/__init__.py
RENAMED
|
File without changes
|
{singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/_combineutils.py
RENAMED
|
File without changes
|
{singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/_ioutils.py
RENAMED
|
File without changes
|
{singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/io/__init__.py
RENAMED
|
File without changes
|
{singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/io/h5ad.py
RENAMED
|
File without changes
|
{singlecellexperiment-0.5.7 → singlecellexperiment-0.5.8}/src/singlecellexperiment/io/tenx.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|