From 54aca6fab5f394aded984c4419cefa8621888ba3 Mon Sep 17 00:00:00 2001 From: Mario Kanetscheider Date: Fri, 9 Aug 2024 16:59:21 +0200 Subject: [PATCH 1/3] Enable labeling of isotypically included B cells as receptor_subtype --- src/scirpy/tl/_chain_qc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/scirpy/tl/_chain_qc.py b/src/scirpy/tl/_chain_qc.py index 438cb441d..1c093c712 100644 --- a/src/scirpy/tl/_chain_qc.py +++ b/src/scirpy/tl/_chain_qc.py @@ -42,9 +42,10 @@ def chain_qc( * `IGH` (all cells that have only IGH chains, but no IGL or IGK) * `IGH+IGL` (all cells that have only IGH and IGL chains) * `IGH+IGK` (all cells that have only IGH and IGK chains) + * `IGH+IGK/L` (isotypically included B cell i.e. IGH+IGK as the primary and + IGH+IGL as the secondary receptor or vice versa) * `multichain` (all cells with more than two VJ or more than two VDJ chains) - * `ambiguous` (all cells that are none of the above, e.g. TRA+TRD, TRA+IGH or, - IGH+IGK as the primary and IGH+IGL as the secondary receptor) + * `ambiguous` (all cells that are none of the above, e.g. TRA+TRD, TRA+IGH) * `no IR` (all cells without any detected immune receptor) `chain_pairing` can be one of the following @@ -109,6 +110,7 @@ def chain_qc( subtype_is_tgd = (has_trg | has_trd) & ~(has_tra | has_trb | has_ig) subtype_is_ighk = (has_igk) & ~(has_tr | has_igl) subtype_is_ighl = (has_igl) & ~(has_tr | has_igk) + subtype_is_ighkl = (has_igl) & (has_igk) & ~(has_tr) & (has_igh) # orphan IGH subtype_is_igh = (has_igh) & ~(has_igk | has_igl | has_tr) @@ -127,6 +129,7 @@ def chain_qc( res_receptor_subtype[subtype_is_igh] = "IGH" res_receptor_subtype[subtype_is_ighl] = "IGH+IGL" res_receptor_subtype[subtype_is_ighk] = "IGH+IGK" + res_receptor_subtype[subtype_is_ighkl] = "IGH+IGK/L" res_receptor_subtype[mask_multichain] = "multichain" res_chain_pairing = _chain_pairing(params, res_receptor_subtype == "ambiguous", mask_has_ir, mask_multichain) From b733c53d56a3486f9347d1c975e283659f438662 Mon Sep 17 00:00:00 2001 From: Mario Kanetscheider Date: Tue, 13 Aug 2024 09:52:06 +0200 Subject: [PATCH 2/3] Adapted one altered test-case and inluded an additional one for isotypically included B cells --- src/scirpy/tests/test_tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/scirpy/tests/test_tools.py b/src/scirpy/tests/test_tools.py index 3d5f8ea43..8ce02bb7a 100644 --- a/src/scirpy/tests/test_tools.py +++ b/src/scirpy/tests/test_tools.py @@ -30,6 +30,7 @@ def test_chain_qc(): [False, "IGK", "IGH", "nan", "nan"], [False, "IGL", "IGH", "IGL", "IGH"], [False, "IGL", "IGH", "IGK", "IGH"], + [False, "IGK", "IGH", "IGL", "IGH"], [False, "nan", "IGH", "nan", "IGH"], [False, "TRA", "TRB", "TRG", "TRB"], [False, "IGK", "TRB", "nan", "nan"], @@ -69,6 +70,7 @@ def test_chain_qc(): "BCR", "BCR", "BCR", + "BCR", "TCR", "ambiguous", "TCR", @@ -91,7 +93,8 @@ def test_chain_qc(): "TRA+TRB", "IGH+IGK", "IGH+IGL", - "ambiguous", + "IGH+IGK/L", + "IGH+IGK/L", "IGH", "ambiguous", "ambiguous", From 07471b69b1d67fd760017a17700e8237f245e0d1 Mon Sep 17 00:00:00 2001 From: Gregor Sturm Date: Tue, 13 Aug 2024 10:42:49 +0200 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04911ccd3..5c0cfa40f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning][]. [keep a changelog]: https://keepachangelog.com/en/1.0.0/ [semantic versioning]: https://semver.org/spec/v2.0.0.html +## [Unreleased] + +### Addition + +- Isotypically included B cells are now labelled as `receptor_subtype="IGH+IGK/L"` instead of `ambiguous` in `tl.chain_qc`. ([#537](https://github.com/scverse/scirpy/pull/537)) + ## v0.17.2 ### Fixes