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 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", 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)