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

calcPerClusterMappingMetric fails with singleton query_cluster_labels #39

Closed
amcdavid opened this issue Dec 5, 2022 · 0 comments
Closed

Comments

@amcdavid
Copy link
Contributor

amcdavid commented Dec 5, 2022

library(symphony)
# For the sake of an easy to get a `query` object
rmarkdown::render('vignettes/quickstart_tutorial.Rmd')
labels = sample(1:5, size = nrow(query$meta_data), replace = TRUE)
calcPerClusterMappingMetric(reference, query, query_cluster_labels = labels)

Calculating mapping confidence for 5 query clusters
query_cluster distance_score
1 5 12.908458
2 3 2.888485
3 2 3.209513
4 1 36.630791
5 4 7.808481

calcPerClusterMappingMetric works with typical data.

labels_singleton = labels
labels_singleton[1] = 6
calcPerClusterMappingMetric(reference, query, query_cluster_labels = labels_singleton)

Calculating mapping confidence for 6 query clusters
Error in base::rowMeans(x, na.rm = na.rm, dims = dims, ...) :
'x' must be an array of at least two dimensions

The PCA matrix is subset with an arbitrary index, and if the index has length one, R "helpfully" coerces it to a vector. Issue arises regardless of the value of u.

cluster_Zq_pca = query$Zq_pca[, cluster_idx]

amcdavid added a commit to amcdavid/symphony that referenced this issue Dec 5, 2022
@amcdavid amcdavid changed the title Need drop=FALSE for singleton query_cluster_labels calcPerClusterMappingMetric fails with singleton query_cluster_labels Dec 5, 2022
joycekang added a commit that referenced this issue Jan 16, 2023
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