Skip to content

Commit

Permalink
Fix 435 (#438)
Browse files Browse the repository at this point in the history
* Add regression test for #435

* Fix #435

* Update CHANGELOG
  • Loading branch information
grst authored Jul 31, 2023
1 parent a078287 commit c11d9ef
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning][].

- Fix that clonotype_modularity could not run with AnnData object ([#421](https://github.com/scverse/scirpy/pull/421)).
- Fix usage of wrong column in 3k tutorial ([#423](https://github.com/scverse/scirpy/pull/423))
- Change igraph dependency from `python-igraph` to `igraph` ([#436](https://github.com/scverse/scirpy/pull/436))
- Fix that `group_abundance` didn't work when AIRR data was stored in a different MuData slot than `airr` ([#438](https://github.com/scverse/scirpy/pull/438))

(v0.13)=

Expand Down
2 changes: 1 addition & 1 deletion src/scirpy/pl/_group_abundance.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def group_abundance(
# TODO workaround for temporarily added has_ir column. Don't get colors in that case
if target_col != "has_ir":
if "color" not in kwargs:
colors = _get_colors(DataHandler.default(adata), target_col)
colors = _get_colors(DataHandler(adata), target_col)
if colors is not None:
kwargs["color"] = [colors[cat] for cat in abundance.columns]

Expand Down
14 changes: 14 additions & 0 deletions src/scirpy/tests/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,22 @@ def test_alpha_diversity(adata_diversity):
assert isinstance(p, plt.Axes)


@pytest.mark.parametrize("adata_clonotype", [True], indirect=["adata_clonotype"], ids=["MuData"])
def test_group_abundance_default(adata_clonotype):
"""Regression test for #435"""
# Change to 'tcr' as airr_mod instead of the default 'airr'.
adata_clonotype = MuData({"tcr": adata_clonotype["airr"]})
p = pl.group_abundance(
adata_clonotype,
groupby="tcr:clone_id",
target_col="tcr:group",
)
assert isinstance(p, plt.Axes)


def test_group_abundance(adata_clonotype):
mdata_modifier = "airr:" if isinstance(adata_clonotype, MuData) else ""

p = pl.group_abundance(
adata_clonotype,
groupby=f"{mdata_modifier}clone_id",
Expand Down

0 comments on commit c11d9ef

Please sign in to comment.