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

seurat::key in RunHarmony results in an error #159

Closed
DivyaRavichandar opened this issue Aug 5, 2022 · 7 comments
Closed

seurat::key in RunHarmony results in an error #159

DivyaRavichandar opened this issue Aug 5, 2022 · 7 comments

Comments

@DivyaRavichandar
Copy link

Running the RunHarmony(seuratobject) with seurat 4.0.3 results in the following error

  no applicable method for 'Key' applied to an object of class "character"```

The issue seems to stem from this one line of code in RunHarmony.R that was recently added
`reduction.key <- Seurat::Key(reduction.save, quiet = TRUE)`

Is this edit backward compatible with older Seurat versions?
@HenriettaHolze
Copy link

I get the same error

Error in UseMethod(generic = "Key", object = object) : 
  no applicable method for 'Key' applied to an object of class "character"

I use Seurat 4.1.0 and Harmony 0.1.1., R v4.1.0

@ecdabe-BISC
Copy link

Ditto with R version 4.0.4 Harmony 0.1.1

@hghaoo
Copy link

hghaoo commented Nov 21, 2022

i met the same problem, and get resolved by Harmony 0.1.0.

@longerping1992
Copy link

I met the same problem.

InstallData("pbmcsca")
data("pbmcsca")
pbmcsca <- NormalizeData(pbmcsca) %>% FindVariableFeatures() %>% ScaleData() %>% RunPCA(verbose = FALSE)
pbmcsca <- RunHarmony(pbmcsca, group.by.vars = "Method")
Harmony 9/10
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Harmony converged after 9 iterations
Error in UseMethod(generic = "Key", object = object) :
no applicable method for 'Key' applied to an object of class "character"

sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/local/intel/compilers_and_libraries_2020.2.254/linux/mkl/lib/intel64_lin/libmkl_rt.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] pbmcsca.SeuratData_3.0.0 harmony_0.1.1 Rcpp_1.0.8
[4] SeuratData_0.2.2 SeuratObject_4.0.4 Seurat_4.1.0

loaded via a namespace (and not attached):
[1] Rtsne_0.15 colorspace_2.0-2 deldir_0.2-10
[4] ellipsis_0.3.2 ggridges_0.5.3 rprojroot_2.0.2
[7] fs_1.5.2 spatstat.data_2.1-0 leiden_0.3.8
[10] listenv_0.8.0 remotes_2.4.2 ggrepel_0.9.1
[13] fansi_1.0.3 codetools_0.2-18 splines_4.0.5
[16] cachem_1.0.6 polyclip_1.10-0 pkgload_1.3.2
[19] jsonlite_1.7.3 ica_1.0-2 cluster_2.1.2
[22] png_0.1-7 uwot_0.1.10 shiny_1.6.0
[25] sctransform_0.3.3 spatstat.sparse_2.0-0 compiler_4.0.5
[28] httr_1.4.2 assertthat_0.2.1 Matrix_1.3-4
[31] fastmap_1.1.0 lazyeval_0.2.2 cli_3.1.1
[34] later_1.2.0 htmltools_0.5.2 prettyunits_1.1.1
[37] tools_4.0.5 igraph_1.3.2 gtable_0.3.0
[40] glue_1.6.2 RANN_2.6.1 reshape2_1.4.4
[43] dplyr_1.0.9 rappdirs_0.3.3 scattermore_0.7
[46] vctrs_0.4.1 nlme_3.1-152 lmtest_0.9-38
[49] stringr_1.4.0 globals_0.14.0 ps_1.6.0
[52] mime_0.11 miniUI_0.1.1.1 lifecycle_1.0.1
[55] irlba_2.3.5 devtools_2.4.3 goftest_1.2-2
[58] future_1.21.0 MASS_7.3-54 zoo_1.8-9
[61] scales_1.1.1 spatstat.core_2.2-0 promises_1.2.0.1
[64] spatstat.utils_2.2-0 parallel_4.0.5 RColorBrewer_1.1-2
[67] curl_4.3.2 memoise_2.0.1 reticulate_1.24
[70] pbapply_1.4-3 gridExtra_2.3 ggplot2_3.3.5
[73] rpart_4.1-15 stringi_1.7.6 pkgbuild_1.3.1
[76] rlang_1.0.4 pkgconfig_2.0.3 matrixStats_0.62.0
[79] lattice_0.20-44 ROCR_1.0-11 purrr_0.3.4
[82] tensor_1.5 patchwork_1.1.1 htmlwidgets_1.5.4
[85] cowplot_1.1.1 tidyselect_1.1.2 processx_3.5.2
[88] parallelly_1.26.1 RcppAnnoy_0.0.18 plyr_1.8.6
[91] magrittr_2.0.2 R6_2.5.1 generics_0.1.2
[94] DBI_1.1.1 withr_2.5.0 pillar_1.7.0
[97] mgcv_1.8-36 fitdistrplus_1.1-5 survival_3.2-11
[100] abind_1.4-5 tibble_3.1.7 future.apply_1.7.0
[103] crayon_1.5.2 KernSmooth_2.23-20 utf8_1.2.2
[106] spatstat.geom_2.2-0 plotly_4.9.4.1 usethis_2.1.6
[109] grid_4.0.5 data.table_1.14.2 callr_3.7.0
[112] digest_0.6.29 xtable_1.8-4 tidyr_1.1.3
[115] httpuv_1.6.1 munsell_0.5.0 viridisLite_0.4.0
[118] sessioninfo_1.2.2

@longerping1992
Copy link

Hi all, I addressed it by following this #170.
Specifically, I downloaded the harmony-master.zip from https://github.com/immunogenomics/harmony.
Unzip it. In "RunHarmony.R", remove "reduction.key <- Seurat::Key(reduction.save, quite = TRUE", add "reduction.key = reduction.save".
Then install using "devtools::install_local('/gpfs/gsfs12/users/longe2/Software/harmony-master/')". If you do not have devtool, install devtool first.
Restart the R, and it works.

@pati-ni
Copy link
Collaborator

pati-ni commented Oct 6, 2023

I think there was some bug in Seurat::Key that resulted in this error. Latest Seurat 4.4.0 and Seurat v5 do not fail with this. Closing for now, feel free to re-open if there are any issues

@pati-ni pati-ni closed this as completed Oct 6, 2023
@pati-ni
Copy link
Collaborator

pati-ni commented Oct 6, 2023

Linking this reference this:
satijalab/seurat#6533 (comment)

Despite not dealing with the error offended line is not failing with latest Seurat versions

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

6 participants