Skip to content

Commit 6602689

Browse files
authored
Fix code snippet to merge anndata objects (#620)
* Fix code snippet to merge anndata objects * Update changelog
1 parent 7b76933 commit 6602689

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ and this project adheres to [Semantic Versioning][].
2222

2323
- Update template to v0.5.0 ([#608](https://github.com/scverse/scirpy/pull/608/), [#606](https://github.com/scverse/scirpy/pull/606/))
2424

25+
### Documentation
26+
27+
- Fix code snippet for merging AIRR data into unimodal AnnData in "data structure" section ([#620](https://github.com/scverse/scirpy/pull/620/))
28+
2529
## v0.22.0
2630

2731
### Fixes

docs/data-structure.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ Here is one way how the AIRR data can be merged into an AnnData object that alre
177177
# Map each cell barcode to its respective numeric index (assumes obs_names are unique)
178178
barcode2idx = {barcode: i for i, barcode in enumerate(adata_airr.obs_names)}
179179
# Generate a slice for the awkward array that retrieves the corresponding row
180-
# from `adata_airr` for each barcode in `adata_gex`. `-1` will generate all
181-
# "None"s for barcodes that are not in `adata_airr`
182-
idx = [barcode2idx.get(barcode, -1) for barcode in adata_gex.obs_names]
180+
# from `adata_airr` for each barcode in `adata_gex`.
181+
# "None" will be used for barcodes that are not in `adata_airr`
182+
idx = [barcode2idx.get(barcode, None) for barcode in adata_gex.obs_names]
183183
adata_gex.obsm["airr"] = adata_airr.obsm["airr"][idx]
184184
185185

0 commit comments

Comments
 (0)