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

plotDiffHeatmap: avoid failure when only one cluster remains #382

Closed
SamGG opened this issue Jan 5, 2024 · 4 comments
Closed

plotDiffHeatmap: avoid failure when only one cluster remains #382

SamGG opened this issue Jan 5, 2024 · 4 comments

Comments

@SamGG
Copy link

SamGG commented Jan 5, 2024

IIUC, when there is only one cluster left, as.matrix() results in a one column matrix instead of one row matrix.

da = {
ns <- table(x$cluster_id, x$sample_id)
fq <- prop.table(ns, 2)
fq <- fq[top$cluster_id, ]
y <- as.matrix(unclass(fq))
if (normalize) y <- .z_normalize(asin(sqrt(y)))
Heatmap(
matrix = y,

I propose to transpose y in such a case.
if (nrow(top) == 1) y <- t(y)
In my hands, it works and permits to display a single significant cluster.

@SamGG
Copy link
Author

SamGG commented Jan 5, 2024

In fact, the following is even simpler:
fq <- fq[top$cluster_id, , drop = FALSE]

@HelenaLC
Copy link
Owner

HelenaLC commented Jan 8, 2024

Sounds good. Thanks again for catching this. Edgy cases aren't my strong suit to think of ;) - will do along with issue #381.

@SamGG
Copy link
Author

SamGG commented Jan 8, 2024

Thanks. Edgy cases are very difficult to anticipate.
This question is independent from #381.

@HelenaLC
Copy link
Owner

HelenaLC commented Jan 8, 2024

Yes, absolutely, I only meant that I will try and resolve both with one update/version bump.

HelenaLC pushed a commit that referenced this issue Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants