symphony
symphony copied to clipboard
Cannot reproduce Seurat.ipynb vignette; parameters not passed
Hi all,
I am trying to reproduce the Seurat.ipynb vignette to construct a reference object from a seurat object. However, I am encountering errors already from the Harmony step. The error I get after RunHarmony.Seurat is : Error in value[3L] : Invalid number of ncores provided: 0. Maximum available cores: 64 It seems like not all parameters are passed (in the harmonymatrix function, ncores should be present, but it is not in 'utils_seurat.R'. I have tried to input the parameters that should be there (.options is missing and causing problems as well), but then Harmony is not running correctly (cell embedings, feature.loadings are all zero) Do I miss something?
Thanks in advance!
source('utils_seurat.R')
suppressPackageStartupMessages({
library(symphony)
library(Seurat)
suppressWarnings({library(SeuratData)})
library(ggplot2)
library(dplyr)
library(magrittr)
library(Matrix)
library(sctransform)
})
library(harmony)
## Install this example dataset
suppressWarnings({
#SeuratData::InstallData('hcabm40k')
SeuratData::LoadData('hcabm40k')
})
cells_ref <- [email protected] %>% subset(orig.ident %in% paste0('MantonBM', 1:4)) %>% rownames()
cells_query <- [email protected] %>% subset(orig.ident %in% paste0('MantonBM', 5:8)) %>% rownames()
obj <- Seurat::CreateSeuratObject(hcabm40k@assays$RNA@counts[, cells_ref]) %>%
NormalizeData(normalization.method = "LogNormalize", scale.factor = 10000) %>%
FindVariableFeatures(selection.method = "vst", nfeatures = 2000) %>%
ScaleData(verbose = .verbose) %>%
RunPCA(verbose = .verbose) %>%
RunHarmony.Seurat('orig.ident', verbose = .verbose) %>%
FindNeighbors(dims = 1:20, reduction = 'harmony', verbose = .verbose) %>% # previous version of this tutorial was missing reduction argument
FindClusters(resolution = 0.5, verbose = .verbose)
#UMAP
obj[['umap']] <- RunUMAP2(Embeddings(obj, 'harmony')[, 1:20],
assay='RNA', verbose=FALSE, umap.method='uwot', return.model=TRUE)
#Plot UMAP
options(repr.plot.height = 4, repr.plot.width = 6)
DimPlot(obj, reduction = 'umap', group.by = 'seurat_clusters', shuffle = TRUE)
SESSION INFO R version 4.2.2 Patched (2022-11-10 r83330) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.6 LTS
Matrix products: default BLAS/LAPACK: /opt/OpenBLAS/lib/libopenblasp-r0.3.13.so
locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C LC_MONETARY=C LC_MESSAGES=C [7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] Matrix_1.6-4 magrittr_2.0.3 hcabm40k.SeuratData_3.0.0 SeuratData_0.2.2.9001 symphony_0.1.1 [6] patchwork_1.2.0 reshape2_1.4.4 dplyr_1.1.4 sctransform_0.4.1 aws.s3_0.3.21 [11] clustree_0.5.1 ggraph_2.1.0 ggplot2_3.4.4 harmony_1.2.0 Rcpp_1.0.12 [16] SeuratDisk_0.0.0.9021 Seurat_5.0.1 SeuratObject_5.0.1 sp_2.1-2
loaded via a namespace (and not attached): [1] utf8_1.2.4 spatstat.explore_3.2-5 reticulate_1.34.0 tidyselect_1.2.0 htmlwidgets_1.6.4 [6] grid_4.2.2 Rtsne_0.17 devtools_2.4.5 aws.signature_0.6.0 munsell_0.5.0 [11] codetools_0.2-18 ica_1.0-3 future_1.29.0 miniUI_0.1.1.1 withr_2.5.2 [16] spatstat.random_3.2-2 colorspace_2.1-0 progressr_0.14.0 knitr_1.45 rstudioapi_0.14 [21] stats4_4.2.2 ROCR_1.0-11 SparkR_3.3.1 tensor_1.5 listenv_0.9.0 [26] MatrixGenerics_1.10.0 labeling_0.4.3 polyclip_1.10-6 bit64_4.0.5 farver_2.1.1 [31] rprojroot_2.0.4 parallelly_1.36.0 vctrs_0.6.5 generics_0.1.3 xfun_0.41 [36] R6_2.5.1 graphlayouts_1.0.2 hdf5r_1.3.8 spatstat.utils_3.0-4 cachem_1.0.8 [41] promises_1.2.1 scales_1.3.0 gtable_0.3.4 globals_0.16.2 processx_3.8.0 [46] goftest_1.2-3 spam_2.10-0 tidygraph_1.3.0 rlang_1.1.2 splines_4.2.2 [51] lazyeval_0.2.2 spatstat.geom_3.2-7 abind_1.4-5 httpuv_1.6.13 usethis_2.1.6 [56] tools_4.2.2 ellipsis_0.3.2 RColorBrewer_1.1-3 BiocGenerics_0.44.0 sessioninfo_1.2.2 [61] ggridges_0.5.5 plyr_1.8.9 base64enc_0.1-3 purrr_1.0.2 ps_1.7.2 [66] prettyunits_1.2.0 deldir_2.0-2 pbapply_1.7-2 viridis_0.6.4 cowplot_1.1.2 [71] urlchecker_1.0.1 S4Vectors_0.36.2 zoo_1.8-12 ggrepel_0.9.4 cluster_2.1.4 [76] fs_1.6.3 data.table_1.14.10 RSpectra_0.16-1 scattermore_1.2 lmtest_0.9-40 [81] RANN_2.6.1 fitdistrplus_1.1-11 matrixStats_1.2.0 pkgload_1.3.1 hms_1.1.3 [86] mime_0.12 evaluate_0.23 xtable_1.8-4 RhpcBLASctl_0.23-42 fastDummies_1.7.3 [91] IRanges_2.32.0 gridExtra_2.3 compiler_4.2.2 tibble_3.2.1 KernSmooth_2.23-20 [96] crayon_1.5.2 htmltools_0.5.7 later_1.3.2 tzdb_0.4.0 tidyr_1.3.0 [101] tweenr_2.0.2 MASS_7.3-58 rappdirs_0.3.3 readr_2.1.3 cli_3.6.2 [106] parallel_4.2.2 dotCall64_1.1-1 igraph_1.6.0 pkgconfig_2.0.3 plotly_4.10.3 [111] spatstat.sparse_3.0-3 xml2_1.3.6 stringr_1.5.1 callr_3.7.3 digest_0.6.33 [116] RcppAnnoy_0.0.21 spatstat.data_3.0-3 leiden_0.4.3.1 uwot_0.1.16 curl_5.2.0 [121] shiny_1.8.0 lifecycle_1.0.4 nlme_3.1-160 jsonlite_1.8.8 viridisLite_0.4.2 [126] fansi_1.0.6 pillar_1.9.0 lattice_0.20-45 fastmap_1.1.1 httr_1.4.7 [131] pkgbuild_1.3.1 survival_3.4-0 glue_1.6.2 remotes_2.4.2 png_0.1-8 [136] bit_4.0.5 ggforce_0.4.1 class_7.3-20 stringi_1.8.3 profvis_0.3.7 [141] RcppHNSW_0.5.0 memoise_2.0.1 irlba_2.3.5.1 future.apply_1.10.0
Downgrading to harmony v0.1.1 (https://cran.r-project.org/src/contrib/Archive/harmony/harmony_0.1.1.tar.gz) fixed the issue.