-
Notifications
You must be signed in to change notification settings - Fork 99
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
RunHarmony on the weights branch errors with incompatible matrix dimensions #219
Comments
Hello, I am also having the same issue with Harmony when I try to integrate different Seurat objects through the Seurat v5 IntegrateLayers() function: seurat[["RNA"]] = split(seurat[["RNA"]],f=seurat$slide)
seurat = seurat %>% NormalizeData() %>%
FindVariableFeatures(nfeatures=1000) %>%
ScaleData() %>%
RunPCA(npcs=30)
seurat = IntegrateLayers(seurat,method=HarmonyIntegration,orig.reduction='pca',new.reduction='harmony')
Harmony 1/10
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Error: element-wise pow(): incompatible matrix dimensions: 100x2 and 2x1
sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
...
...
...
...
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] harmony_1.0 Rcpp_1.0.11 dplyr_1.1.3 Seurat_5.0.0
[5] SeuratObject_5.0.0 sp_2.0-0
|
Hi @PietroAndrei, Two things.
|
Hi @pati-ni, I solved the issue by upgrading Harmony from v1.0 to v1.2, thanks! It may have been a compatibility problem with Rcpp, as I tried to use another dataset, and Harmony v.1.0 worked only when run within an environment with Rcpp < 1.0.10. Thanks again for your help, Pietro |
Hi @pati-ni, could you re-open this issue as I am also having the same error on the weights branch when trying to run HarmonyMatrix with weights. I have tried suggestions from other posts with a similar error (but not pertaining to the weights branch) such as downgrading Rcpp, converting the vars_use to factors or characters, and making sure there are no empty factor levels/NAs and am still getting the same error. |
Hi @jjs847, does your code run when you install the normal branch? I did not know about the weights branch |
Hi @pati-ni, Yes, it runs to completion with harmony 1.0 |
Hi @jjs847, I have looked into the issue and I think I have addressed it. However, I can not reproduce the error with the existing weights branch due to the ambiguity of the pow call which won't let me compile. Can you please install it from my branch to see if the issue is fixed?
|
hi @pati-ni does this mean, the weights branch now works on your harmony repo and i can test it out again as well? |
I would like you to help me test it out. I believe i fixed the error it was
complaining about. This branch is not maintained at the moment and it was
affected by a bug that was fixed in the master branch a year ago.
…On Fri, Feb 9, 2024, 05:52 Devika Agarwal ***@***.***> wrote:
hi @pati-ni <https://github.com/pati-ni> does this mean, the weights
branch now works on your harmony repo and i can test it out again as well?
—
Reply to this email directly, view it on GitHub
<#219 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADSFW2GTRLRBR4FVRQOET6LYSX5WBAVCNFSM6AAAAAA7EMAVPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZVG4YDKMZXG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi @pati-ni, sorry for the delayed response -- it seems like its working now, and I am not getting the incompatible matrix error, however, its running extremely slow. So far it's been running for 5 hours and it's only on the second harmony iteration. Previously, when I ran HarmonyMatrix from harmony 1.0 (just to test if I got a matrix error), it took less than 2 minutes to complete. Is the reason its taking so much longer now because of the weights? My data is not that large, around 25k cells. Thanks for working on this. |
That is unreasonable slow. How many batches do you have? So it is confusing the version was bumped to v1 accidentally on that branch. When you say that you run the branch in 2 mins, which branch do you refer to? Our current version is v1.2 and is significantly different than the weights branch (performance-wise). Can you please provide some |
@deevdevil88 yes, please go ahead! Although, keep in mind that @jjs847 is facing slow runtimes, which is puzzling since the code is very similar. Also, it would be good if we had your feedback whether this runs at your system |
Hi @pati-ni, here is the session info for the two versions: Harmony 1.2.0, took less than 1 minute to run
Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): Harmony pat-ni/weights, canceled after running for 12 hours, got to 4th iteration but did not finish
Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): Thanks for your help with this! |
@pati-ni just wondering if there are any updates? |
Hi @jjs847, yes, sorry for the delay. I am trying to put together a dataset to test with the code. Can you suggest some values for the weights? Do you set them within [0,1] range and the same value for the branch? Also, I can see that you use the netlib blas/lapack. While I don't think this explains the slowness, it would be worth trying the OpenBlas version. If you install R from conda, then it comes with openblas. This makes a substantial difference performance-wise with this old version of harmony. However, before spawning R I would set Please let me know the necessary information so I can provide further guidance. |
Hi @pati-ni, no worries, thanks for your continued work on this! I have a dataset with about 25k single-cell + single-nuclear data. My weights argument is a vector with an entry for each barcode of 0.53 for the single-cell data, and 8.56 for the single-nuclear data. Given your suggestion, I tried to re-run with weights between 0 and 1, and still only getting to the 4th iteration after 12 hours. I will see if your second suggestion is possible on my HPC. |
Hi,
I am trying to use the weighted harmony as implemented in this paper DOI: 10.1016/j.medj.2022.05.002 , so i was using the weights branch.
I installed the weights branch successfully and can run the `RunHarmony' function on a seurat object. However, after the first iteration i get the following error
the command im running, after insalling the weights branch is
seu_object <- harmony::RunHarmony(object = seu_object,group.by.vars = c("cart_id","tissue_simple"), reduction = "weighted_pca",dims.use = 1:50,tau = 0,max.iter.harmony = 10, weight.by = "tissue_simple", reduction.save = "weighed_pca_harmony")
on traceback of the error it seems to come from the Harmony function within.
the error persists with multiple parameter changes, includng using normal or wieghted PCA, so i dont think i am using the wrong covariates. Any help on this issue would be much appreciated. I tried to use the code that was on the github repo for the paper here : https://github.com/immunogenomics/FibroblastAtlas2022/blob/Med/Analyses_human/IntegratedClusters.ipynb , but i think the weighted harmony code on here isnt the easiset to implement.
best,
Devika
The text was updated successfully, but these errors were encountered: