welch-lab / liger

R package for integrating and analyzing multiple single-cell datasets
GNU General Public License v3.0
389 stars 78 forks source link

Error in h(simpleError(msg, call)) in scaleNotCenter #201

Closed Evi050 closed 3 years ago

Evi050 commented 3 years ago

Hello, I would like to correct for batch effect in my two single- cell datasets consisting of 2 common and 1 unique cell types each. I use the raw count matrix from the SingleCellExperiment object and follow the default settings.

raw matrix looks like: head(plate1) 536116_1 536120_1 536122_1 536124_1 536126_1 536128_1 536130_1 536132_1 DPM1 15 4 0 0 10 0 25 38 SCYL3 0 0 15 7 0 5 0 0

I run:

liger_obj <- createLiger(list(plate1 = plate1, plate2 =plate2)) liger_obj <- liger::normalize(liger_obj) liger_obj <- liger::selectGenes(liger_obj, keep.unique = T, var.thresh = 0.1, alpha.thresh = 0.05, combine = "union", do.plot = T ) liger_obj <- liger::scaleNotCenter(liger_obj) And get the following error when running the scaleNotCenter:

Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 't': invalid character indexing

sessionInfo() R version 4.0.2 (2020-06-22) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Mojave 10.14.6

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] parallel stats4 stats graphics grDevices utils datasets methods
[9] base

other attached packages: [1] MUDAN_0.1.0 liger_1.1.2
[3] patchwork_1.1.1 Matrix_1.2-18
[5] cowplot_1.1.0 SingleCellExperiment_1.12.0 [7] SummarizedExperiment_1.20.0 Biobase_2.50.0
[9] GenomicRanges_1.42.0 GenomeInfoDb_1.26.2
[11] IRanges_2.24.1 S4Vectors_0.28.1
[13] BiocGenerics_0.36.0 MatrixGenerics_1.2.0
[15] matrixStats_0.57.0 harmony_1.0
[17] Rcpp_1.0.5 remotes_2.2.0
[19] devtools_2.3.2 usethis_2.0.0

loaded via a namespace (and not attached): [1] nlme_3.1-151 bitops_1.0-6 fs_1.5.0
[4] bit64_4.0.5 httr_1.4.2 rprojroot_2.0.2
[7] tools_4.0.2 R6_2.5.0 irlba_2.3.3
[10] DBI_1.1.0 mgcv_1.8-33 colorspace_2.0-0
[13] withr_2.3.0 tidyselect_1.1.0 gridExtra_2.3
[16] prettyunits_1.1.1 processx_3.4.5 bit_4.0.4
[19] compiler_4.0.2 cli_2.2.0 desc_1.2.0
[22] DelayedArray_0.16.0 scales_1.1.1 genefilter_1.72.0
[25] callr_3.5.1 digest_0.6.27 rmarkdown_2.6
[28] XVector_0.30.0 pkgconfig_2.0.3 htmltools_0.5.0
[31] sessioninfo_1.1.1 limma_3.46.0 rlang_0.4.9
[34] rstudioapi_0.13 RSQLite_2.2.1 FNN_1.1.3
[37] generics_0.1.0 riverplot_0.6 BiocParallel_1.24.1
[40] ica_1.0-2 mclust_5.4.7 dplyr_1.0.2
[43] RCurl_1.98-1.2 magrittr_2.0.1 GenomeInfoDbData_1.2.4 [46] munsell_0.5.0 fansi_0.4.1 lifecycle_0.2.0
[49] edgeR_3.32.0 yaml_2.2.1 zlibbioc_1.36.0
[52] pkgbuild_1.2.0 Rtsne_0.15 plyr_1.8.6
[55] grid_4.0.2 blob_1.2.1 ggrepel_0.9.0
[58] crayon_1.3.4 doSNOW_1.0.19 lattice_0.20-41
[61] splines_4.0.2 annotate_1.68.0 locfit_1.5-9.4
[64] knitr_1.30 ps_1.5.0 pillar_1.4.7
[67] codetools_0.2-18 pkgload_1.1.0 XML_3.99-0.5
[70] glue_1.4.2 evaluate_0.14 BiocManager_1.30.10
[73] vctrs_0.3.6 foreach_1.5.1 testthat_3.0.1
[76] gtable_0.3.0 purrr_0.3.4 assertthat_0.2.1
[79] ggplot2_3.3.2 xfun_0.19 xtable_1.8-4
[82] survival_3.2-7 tibble_3.0.4 snow_0.4-3
[85] iterators_1.0.13 AnnotationDbi_1.52.0 memoise_1.1.0
[88] sva_3.38.0 ellipsis_0.3.1

Could you please help me out to figure out how to continue?

skpalan commented 3 years ago

Hi, from the attached packages you showed, it seems you are using another unrelated package also called "liger" instead of our package. Please try reinstalling our package again using command: devtools::install_github("welch-lab/liger").

Evi050 commented 3 years ago

Hello, thank you for the recomendation. I did that and now it looks like another problem pops up when applying the selectGenes.

liger_obj <- selectGenes(liger_obj, keep.unique = T, var.thresh = 0.1, alpha.thresh = 0.05, combine = "union", do.plot = T ) Error in .Call("_liger_rowMeansFast", PACKAGE = "liger", x) : "_liger_rowMeansFast" not available for .Call() for package "liger"

Commands are all the same, and new sessionInfo:

sessionInfo() R version 4.0.2 (2020-06-22) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Mojave 10.14.6

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] parallel stats4 stats graphics grDevices utils datasets methods
[9] base

other attached packages: [1] SingleCellExperiment_1.12.0 SummarizedExperiment_1.20.0 [3] Biobase_2.50.0 GenomicRanges_1.42.0
[5] GenomeInfoDb_1.26.2 IRanges_2.24.1
[7] S4Vectors_0.28.1 BiocGenerics_0.36.0
[9] MatrixGenerics_1.2.0 matrixStats_0.57.0
[11] liger_0.5.0 patchwork_1.1.1
[13] Matrix_1.2-18 cowplot_1.1.0
[15] devtools_2.3.2 usethis_2.0.0

loaded via a namespace (and not attached): [1] pkgload_1.1.0 bit64_4.0.5 hdf5r_1.3.2
[4] foreach_1.5.1 assertthat_0.2.1 GenomeInfoDbData_1.2.4 [7] yaml_2.2.1 remotes_2.2.0 ggrepel_0.9.0
[10] riverplot_0.6 sessioninfo_1.1.1 pillar_1.4.7
[13] lattice_0.20-41 glue_1.4.2 doSNOW_1.0.19
[16] digest_0.6.27 XVector_0.30.0 colorspace_2.0-0
[19] htmltools_0.5.0 plyr_1.8.6 pkgconfig_2.0.3
[22] zlibbioc_1.36.0 purrr_0.3.4 scales_1.1.1
[25] snow_0.4-3 processx_3.4.5 Rtsne_0.15
[28] tibble_3.0.4 generics_0.1.0 ggplot2_3.3.2
[31] ellipsis_0.3.1 withr_2.3.0 cli_2.2.0
[34] magrittr_2.0.1 crayon_1.3.4 mclust_5.4.7
[37] memoise_1.1.0 evaluate_0.14 ps_1.5.0
[40] fs_1.5.0 fansi_0.4.1 pkgbuild_1.2.0
[43] FNN_1.1.3 ica_1.0-2 tools_4.0.2
[46] prettyunits_1.1.1 lifecycle_0.2.0 munsell_0.5.0
[49] DelayedArray_0.16.0 irlba_2.3.3 callr_3.5.1
[52] compiler_4.0.2 rlang_0.4.9 grid_4.0.2
[55] RCurl_1.98-1.2 iterators_1.0.13 rstudioapi_0.13
[58] bitops_1.0-6 rmarkdown_2.6 testthat_3.0.1
[61] gtable_0.3.0 codetools_0.2-18 curl_4.3
[64] R6_2.5.0 knitr_1.30 dplyr_1.0.2
[67] bit_4.0.4 rprojroot_2.0.2 desc_1.2.0
[70] Rcpp_1.0.5 vctrs_0.3.6 tidyselect_1.1.0
[73] xfun_0.19

Many thanks!!

skpalan commented 3 years ago

Hi, please make sure all the installation process of liger are successful before running actual codes. What happened here is that the C++ codes included in liger were not linked correctly to your R environment. This problem is specific to masOS since Apple changed their toolchain for compiling. As the solution we provided in our installation tutorial, you can follow the instructions in this post and try installing liger again.

Evi050 commented 3 years ago

Thank you very much, I will try that and get back if I get any problem related to the tool.

On Tue, Dec 22, 2020, 8:43 AM Jialin Liu notifications@github.com wrote:

Hi, please make sure all the installation process of liger are successful before running actual codes. What happened here is that the C++ codes included in liger were not linked correctly to your R environment. This problem is specific to masOS since Apple changed their toolchain for compiling. As the solution we provided in our installation tutorial, you can follow the instructions in this post https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/ and try installing liger again.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/welch-lab/liger/issues/201#issuecomment-749375605, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR5RPAY5T6FOHNBJQWKC3FDSWA5XVANCNFSM4VEVDMLA .

Evi050 commented 3 years ago

Hello again, I followed the post you recommended, I got no errors, so I guess that's fine. I reinstalled liger and I follow the exact same commands, and I am getting again the first error when applying liger_obj <- scaleNotCenter(liger_obj)

Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 't': invalid character indexing

sessionInfo() R version 4.0.2 (2020-06-22) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Mojave 10.14.6

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] parallel stats4 stats graphics grDevices utils datasets methods
[9] base

other attached packages: [1] Rcpp_1.0.5 RcppArmadillo_0.10.1.2.0
[3] SingleCellExperiment_1.12.0 SummarizedExperiment_1.20.0 [5] Biobase_2.50.0 GenomicRanges_1.42.0
[7] GenomeInfoDb_1.26.2 IRanges_2.24.1
[9] S4Vectors_0.28.1 BiocGenerics_0.36.0
[11] MatrixGenerics_1.2.0 matrixStats_0.57.0
[13] liger_0.5.0 patchwork_1.1.1
[15] Matrix_1.2-18 cowplot_1.1.0

loaded via a namespace (and not attached): [1] tidyselect_1.1.0 xfun_0.19 purrr_0.3.4
[4] ica_1.0-2 lattice_0.20-41 colorspace_2.0-0
[7] vctrs_0.3.6 generics_0.1.0 doSNOW_1.0.19
[10] snow_0.4-3 rlang_0.4.9 pillar_1.4.7
[13] glue_1.4.2 bit64_4.0.5 GenomeInfoDbData_1.2.4 [16] foreach_1.5.1 lifecycle_0.2.0 plyr_1.8.6
[19] zlibbioc_1.36.0 munsell_0.5.0 gtable_0.3.0
[22] codetools_0.2-18 hdf5r_1.3.2 knitr_1.30
[25] riverplot_0.6 irlba_2.3.3 scales_1.1.1
[28] DelayedArray_0.16.0 XVector_0.30.0 FNN_1.1.3
[31] bit_4.0.4 ggplot2_3.3.2 Rtsne_0.15
[34] dplyr_1.0.2 ggrepel_0.9.0 grid_4.0.2
[37] tools_4.0.2 bitops_1.0-6 magrittr_2.0.1
[40] RCurl_1.98-1.2 tibble_3.0.4 crayon_1.3.4
[43] pkgconfig_2.0.3 ellipsis_0.3.1 rstudioapi_0.13
[46] iterators_1.0.13 R6_2.5.0 mclust_5.4.7
[49] compiler_4.0.2

I really don't understand what's going on ... liger installation looks fine. Is there any way you could take a look?

Thank you

Evi050 commented 3 years ago

Hello, a small update. After trying diferrent combinations for the selectGenes function I found that scaleNotCenter pops up this error when keep.unique = T. I am not sure why, but it's good to mention that without this both function run.

liger_obj <- liger::selectGenes(liger_obj, keep.unique = T, var.thresh = 0.1, alpha.thresh = 0.05, combine = "union", do.plot = T ) liger_obj <- liger::scaleNotCenter(liger_obj)

Thanks!

cgao90 commented 3 years ago

Hi, thanks for bringing this up. We will remove this keep.unique parameter shortly in our next update. Please proceed with you analysis with keep.unique = F (default).