From b7f7a3cd150c54b1e4f5f87bcd20948706616a45 Mon Sep 17 00:00:00 2001 From: Gregor Sturm Date: Sun, 20 Oct 2024 13:39:56 +0200 Subject: [PATCH 1/4] Fix _has_ir AwkwardArrayView edgecase (#564) --- src/scirpy/get/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scirpy/get/__init__.py b/src/scirpy/get/__init__.py index acf8a367f..6235ce176 100644 --- a/src/scirpy/get/__init__.py +++ b/src/scirpy/get/__init__.py @@ -203,6 +203,7 @@ def airr_context( def _has_ir(params: DataHandler): """Return a mask of all cells that have a valid IR configuration""" - return ak.to_numpy( - (ak.count(params.chain_indices["VJ"], axis=1) + ak.count(params.chain_indices["VDJ"], axis=1)) > 0 - ) + return ( + ak.to_numpy(ak.count(params.chain_indices["VJ"], axis=1)) + + ak.to_numpy(ak.count(params.chain_indices["VDJ"], axis=1)) + ) > 0 From 7c5726b9690dd3855b51b00b0387f7a68fafb636 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:58:58 +0200 Subject: [PATCH 2/4] [pre-commit.ci] pre-commit autoupdate (#566) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.9 → v0.7.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.9...v0.7.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e818b5979..37bf6b5f7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: - id: prettier exclude: '^\.conda' - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.9 + rev: v0.7.0 hooks: - id: ruff types_or: [python, pyi, jupyter] From e02a82b7f4d8729fbf9bc76ead03973729eeb32b Mon Sep 17 00:00:00 2001 From: Gregor Sturm Date: Tue, 22 Oct 2024 14:39:21 +0200 Subject: [PATCH 3/4] Add Stephenson datasets (#565) * Add Stephenson datasets * Add changelog * Added preprocessing description regarding stephenson_5k dataset * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Mario Kanetscheider Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- CHANGELOG.md | 1 + docs/api.rst | 1 + src/scirpy/datasets/__init__.py | 26 +++++++++++++++++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 948438ac5..95d523534 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning][]. ### Additions - Add a `mask_obs` argument to `tl.clonotype_network` that allows to compute the clonotype networks on a subset of the cells ([#557](https://github.com/scverse/scirpy/pull/557)). +- Add `datasets.stephenson2021_5k`, an example dataset for the upcoming BCR tutorial ([#565](https://github.com/scverse/scirpy/pull/565)) ### Fixes diff --git a/docs/api.rst b/docs/api.rst index 1c4a41282..ed6363442 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -246,6 +246,7 @@ Example datasets datasets.wu2020 datasets.wu2020_3k datasets.maynard2020 + datasets.stephenson2021_5k Reference databases ^^^^^^^^^^^^^^^^^^^ diff --git a/src/scirpy/datasets/__init__.py b/src/scirpy/datasets/__init__.py index d262e9ed3..d5ee521f8 100644 --- a/src/scirpy/datasets/__init__.py +++ b/src/scirpy/datasets/__init__.py @@ -28,7 +28,7 @@ _FIGSHARE = pooch.create( path=pooch.os_cache("scirpy"), - base_url="doi:10.6084/m9.figshare.22249894.v1", + base_url="doi:10.6084/m9.figshare.22249894.v2", version=version("scirpy"), version_dev="main", env="SCIRPY_DATA_DIR", @@ -36,6 +36,7 @@ "wu2020.h5mu": "md5:ed30d9c1c44cae544f4c080a2451118b", "wu2020_3k.h5mu": "md5:12c57c790f8a403751304c9de5a18cbf", "maynard2020.h5mu": "md5:da64ac62e3e92c80eaf0e8eef6537ac7", + "stephenson2021_5k.h5mu": "md5:6ea26f9d95525371ff9028f8e99ed474", }, ) _POOCH_INFO = dedent( @@ -124,6 +125,29 @@ def maynard2020() -> MuData: return mudata.read_h5mu(fname) +@_doc_params( + processing_code=indent(_read_to_str(HERE / "_processing_scripts/maynard2020.py"), " " * 8), + pooch_info=_POOCH_INFO, +) +def stephenson2021_5k() -> MuData: + """\ + Return the dataset from :cite:`Stephenson2021` as MuData object, downsampled + to 5000 BCR-containing cells. + + The original study sequenced 1,141,860 cells from 143 PBMC samples collected from patients with different severity of COVID-19 and control groups. + Gene expression, TCR-enriched and BCR-enriched libraries were prepared for each sample according to 10x Genomics protocol and NovaSeq 6000 was used for sequencing. + + A preprocessed dataset for the transciptome library was obtained from `Array Express `__ + A preprocessed dataset for the BCR-enriched library was obtained from `clatworthylab's GitHub `__ + Both dataset have already passed quality control and all cells that didn't express BCR were discarded. + + To speed up computation time, we solely included 5 samples from each of the COVID-19-positive groups and randomly subsampled down to a total of 5k cells. + + """ + fname = cast(PathLike, _FIGSHARE.fetch("stephenson2021_5k.h5mu", progressbar=True)) + return mudata.read_h5mu(fname) + + def vdjdb(cached: bool = True, *, cache_path="data/vdjdb.h5ad") -> AnnData: """\ Download VDJdb and process it into an AnnData object. From d8effface7f1e64069de6a7cb9c91d117016d087 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:00:31 +0100 Subject: [PATCH 4/4] [pre-commit.ci] pre-commit autoupdate (#568) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.7.0 → v0.7.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.7.0...v0.7.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37bf6b5f7..e7299b6c6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: - id: prettier exclude: '^\.conda' - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.0 + rev: v0.7.1 hooks: - id: ruff types_or: [python, pyi, jupyter]