Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chain_qc adaptation (isotypically included B cells) #537

Merged
merged 4 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/scirpy/tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down Expand Up @@ -69,6 +70,7 @@ def test_chain_qc():
"BCR",
"BCR",
"BCR",
"BCR",
"TCR",
"ambiguous",
"TCR",
Expand All @@ -91,7 +93,8 @@ def test_chain_qc():
"TRA+TRB",
"IGH+IGK",
"IGH+IGL",
"ambiguous",
"IGH+IGK/L",
"IGH+IGK/L",
"IGH",
"ambiguous",
"ambiguous",
Expand Down
7 changes: 5 additions & 2 deletions src/scirpy/tl/_chain_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand All @@ -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)
Expand Down
Loading