infercnvpy.pl.chromosome_heatmap doesn't pass dendrogram data to scanpy.pl.heatmap
jpintar opened this issue · comments
Report
When infercnvpy.pl.chromosome_heatmap
and infercnvpy.pl.chromosome_heatmap_summary
are called with dendrogram=True
after a dendrogram has been computed with scanpy.tl.dendrogram
, Scanpy issues a dendrogram data not found
warning, and re-runs scanpy.tl.dendrogram
with default settings (which, in turn, results in scanpy.tl.pca
being run).
This is because Scanpy is, by default, looking for adata.uns[f"dendrogram_{groupby}"]
, but this has not been copied to tmp_adata
which infercnvpy.pl.chromosome_heatmap
and infercnvpy.pl.chromosome_heatmap_summary
pass to scanpy.pl.heatmap
.
The problem can be fixed by simply copying adata.uns[f"dendrogram_{groupby}"]
, if it exists, to tmp_adata.uns
, as is already the case with adata.uns[f"{groupby}_colors"]
. I'd be happy to make a pull request if that's helpful.
Version information
anndata 0.9.2
scanpy 1.9.4
infercnvpy 0.4.2
Hi @jpintar,
a PR would be most welcome!
PR submitted. Looking at the code again, I realised you'd already fixed chromosome_heatmap
with PR #72. I just applied the same fix to chromosome_heatmap_summary
and removed a test in both that is rendered moot by the fix.
I also explicitly set the index type of tmp_obs
to str
, which will avoid AnnData issuing ImplicitModificationWarning: Transforming to str index
when tmp_adata
is created.
Thanks for the quick response!
Closed via #110