Open ScarletAmarantine opened 1 year ago
Can you try running FindSpatiallyVariableFeatures with the selection.method = "moransi"
and let me know if that is successful?
Hi, I have similar error: I run initially with selection.method="markvariogram" and i got the same error:
Stop.features <- head(SpatiallyVariableFeatures(suerat.integrated, selection.method = "markvariogram"), 6)
Error in [.data.frame
(slot(object = x, name = "meta.features"), , i, :
undefined columns selected
I then run with selection.method="moransi"
and trying to visiualize features and got same error again:
head(SpatiallyVariableFeatures(suerat.integrated, selection.method = "moransi"), 6)
Error in [.data.frame
(slot(object = x, name = "meta.features"), , i, :
undefined columns selected
Have the same error "Error in [.data.frame
(slot(object = x, name = "meta.features"), , i, : undefined columns selected", any suggestions?
I have similar issue when running SpatiallyVariableFeatures(wt, selection.method = "moransi")
, Here is my error message:
Any suggestion how to troubleshoot that?
Same issue here. I am running the FindSpatiallyVariableFeatures on a merged and integrated dataset. The command itself works well.
However, when I try:
top.features <- head(SpatiallyVariableFeatures(integrated.brain_new, selection.method = "moransi")
I get the Error Message:
Error in [.data.frame
(slot(object = x, name = "meta.features"), , i, :
undefined columns selected
The same script works perfectly fine on each dataset individually (not merged or integrated).
Any suggestions where the issue lies?
I have similar issue while trying to run : top.features <- head(SpatiallyVariableFeatures(brain, selection.method = "moransi"), 6) I got the follwing error message: Error in xtfrm.data.frame(x) : cannot xtfrm data frames I have tried also without the head function and got the same error. It looks like something related to the input stucture for SpatiallyVariableFeatures function.
Are there any suggestion to deal with it?
Hi! I am having the same problem... Is SpatiallyVariableFeatures() deprecated?
Same issue here. I am running the FindSpatiallyVariableFeatures on a merged and integrated dataset. The command itself works well. However, when I try: top.features <- head(SpatiallyVariableFeatures(integrated.brain_new, selection.method = "moransi") I get the Error Message: Error in
[.data.frame
(slot(object = x, name = "meta.features"), , i, : undefined columns selectedThe same script works perfectly fine on each dataset individually (not merged or integrated).
Any suggestions where the issue lies?
I tried head(variableFeatures) instead of SpatiallyVariableFeatures and it seems to work. SpatiallyVariableFeatures is giving me that error as well.
I don't know whethere markvariogram is still working fine, it seems take quite a long time for this method
yeah i have same problem.and how to solve it please
Hi, I am analyzing the spatial transcriptome data following the vignette. However, when I ran the function "SpatiallyVariableFeatures" at the part of spatial variation detection and "FindSpatiallyVariableFeatures" at the part of deconvolution, I got an error shown:
Error in
[.data.frame
(slot(object = x, name = "meta.features"), , i, : undefined columns selectedError in markcorr(Xj, f = f, r = r, correction = correction, method = method, : Cannot normalise the mark correlation; the denominator is zero
Could you help solve the problem? Many thanks in advance.
Here are the codes I used: library(ggplot2) library(Seurat) library(SeuratData) library(cowplot) library(dplyr) suppressWarnings(suppressMessages(future::plan("multiprocess", workers = 40))) brain1 <- LoadData("stxBrain", type = "anterior1") brain2 <- LoadData("stxBrain", type = "posterior1") brain <- merge(brain1, brain2) brain <- SCTransform(brain, assay = "Spatial", verbose = TRUE, method = "poisson") brain <- RunPCA(brain, assay = "SCT", verbose = F) brain <- FindNeighbors(brain, reduction="pca",dims = 1:30) brain <- FindClusters(brain, verbose =F) brain <- RunUMAP(brain, reduction="pca",dims = 1:30)
integration
st.list = list(anterior1 = brain1, posterior1 = brain2)
run SCT on both datasets
st.list = lapply(st.list, SCTransform, assay = "Spatial", method = "poisson")
need to set maxSize for PrepSCTIntegration to work
options(future.globals.maxSize = 2000 * 1024^2) # set allowed size to 2K MiB st.features = SelectIntegrationFeatures(st.list, nfeatures = 3000, verbose = FALSE) st.list <- PrepSCTIntegration(object.list = st.list, anchor.features = st.features, verbose = FALSE) int.anchors <- FindIntegrationAnchors(object.list = st.list, normalization.method = "SCT", verbose = FALSE, anchor.features = st.features) brain.integrated <- IntegrateData(anchorset = int.anchors, normalization.method = "SCT",verbose = FALSE) brain.integrated <- RunPCA(brain.integrated, verbose = FALSE) brain.integrated <- FindNeighbors(brain.integrated, dims = 1:30) brain.integrated <- FindClusters(brain.integrated, verbose = FALSE) brain.integrated <- RunUMAP(brain.integrated, dims = 1:30) brain.integrated <- FindSpatiallyVariableFeatures(brain.integrated, assay = 'SCT', features =VariableFeatures(brain.integrated)[1:1000], selection.method = 'markvariogram')
To note, FindSpatiallyVariableFeatures work well here
However, the error occurs below:
top.features <- head(SpatiallyVariableFeatures(brain.integrated, selection.method = "markvariogram"),6)
Deconvolution part------
cortex <- subset(brain.integrated, idents = c(1, 2, 3, 5, 6, 7))
now remove additional cells, use SpatialDimPlots to visualize what to remove
SpatialDimPlot(cortex,cells.highlight = WhichCells(cortex, expression = image_imagerow > 400
| image_imagecol < 150))
cortex <- subset(cortex, anterior1_imagerow > 400 | anterior1_imagecol < 150, invert = TRUE) cortex <- subset(cortex, anterior1_imagerow > 275 & anterior1_imagecol > 370, invert = TRUE) cortex <- subset(cortex, anterior1_imagerow > 250 & anterior1_imagecol > 440, invert = TRUE) cortex <- SCTransform(cortex, assay = "Spatial", verbose = FALSE) %>% RunPCA(verbose = FALSE)
allen_reference <- readRDS("./R source code/allen_cortex.rds") Idents(allen_reference) <- allen_reference$subclass allen_reference <- subset(allen_reference, cells = WhichCells(allen_reference, downsample = 200)) allen_reference <- SCTransform(allen_reference, ncells = 3000, verbose = FALSE, method = "poisson") %>% RunPCA(verbose = FALSE) %>% RunUMAP(dims = 1:30)
anchors <- FindTransferAnchors(reference = allen_reference, query = cortex, normalization.method = "SCT") predictions.assay <- TransferData(anchorset = anchors, refdata = allen_reference$subclass, prediction.assay = TRUE, weight.reduction = cortex[["pca"]], dims = 1:30) cortex[["predictions"]] <- predictions.assay DefaultAssay(cortex) <- "predictions"
Here comes the error
cortex <- FindSpatiallyVariableFeatures(cortex, assay = "predictions", selection.method = "markvariogram", features = rownames(cortex), r.metric = 5, slot = "data")
Error in markcorr(Xj, f = f, r = r, correction = correction, method = method, : Cannot normalise the mark correlation; the denominator is zero
Matrix products: default BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so
locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages: [1] stats4 stats graphics grDevices utils datasets methods base
other attached packages: [1] xbioc_0.1.19 AnnotationDbi_1.60.0 IRanges_2.32.0 S4Vectors_0.36.1 Biobase_2.58.0 BiocGenerics_0.44.0
[7] SCDC_0.0.0.9000 patchwork_1.1.2 dplyr_1.0.10 cowplot_1.1.1 stxBrain.SeuratData_0.1.1 pbmc3k.SeuratData_3.1.4
[13] SeuratData_0.2.1 SeuratObject_4.1.3 Seurat_4.3.0 ggplot2_3.4.0 Matrix_1.5-3
loaded via a namespace (and not attached): [1] backports_1.4.1 plyr_1.8.8 igraph_1.3.5 lazyeval_0.2.2 sp_1.5-1 splines_4.2.2 listenv_0.9.0
[8] scattermore_0.8 GenomeInfoDb_1.34.6 usethis_2.1.6 digest_0.6.31 htmltools_0.5.4 fansi_1.0.3 checkmate_2.1.0
[15] magrittr_2.0.3 memoise_2.0.1 tensor_1.5 cluster_2.1.4 ROCR_1.0-11 limma_3.54.0 remotes_2.4.2
[22] Biostrings_2.66.0 globals_0.16.2 matrixStats_0.63.0 spatstat.sparse_3.0-0 prettyunits_1.1.1 colorspace_2.0-3 blob_1.2.3
[29] rappdirs_0.3.3 ggrepel_0.9.2 RCurl_1.98-1.9 callr_3.7.3 crayon_1.5.2 jsonlite_1.8.4 progressr_0.13.0
[36] spatstat.data_3.0-0 ape_5.6-2 survival_3.5-0 zoo_1.8-11 glue_1.6.2 polyclip_1.10-4 registry_0.5-1
[43] gtable_0.3.1 zlibbioc_1.44.0 XVector_0.38.0 nnls_1.4 leiden_0.4.3 pkgbuild_1.4.0 RcppZiggurat_0.1.6
[50] future.apply_1.10.0 abind_1.4-5 scales_1.2.1 pheatmap_1.0.12 DBI_1.1.3 spatstat.random_3.0-1 miniUI_0.1.1.1
[57] Rcpp_1.0.9 viridisLite_0.4.1 xtable_1.8-4 reticulate_1.27 bit_4.0.5 Rfast2_0.1.4 profvis_0.3.7
[64] htmlwidgets_1.6.1 httr_1.4.4 RColorBrewer_1.1-3 ellipsis_0.3.2 ica_1.0-3 urlchecker_1.0.1 pkgconfig_2.0.3
[71] farver_2.1.1 uwot_0.1.14 deldir_1.0-6 utf8_1.2.2 tidyselect_1.2.0 labeling_0.4.2 rlang_1.0.6
[78] reshape2_1.4.4 later_1.3.0 munsell_0.5.0 tools_4.2.2 cachem_1.0.6 cli_3.6.0 RSQLite_2.2.20
[85] generics_0.1.3 devtools_2.4.5 ggridges_0.5.4 stringr_1.5.0 fastmap_1.1.0 goftest_1.2-3 fastmatrix_0.4-1245
[92] bit64_4.0.5 processx_3.8.0 fs_1.5.2 fitdistrplus_1.1-8 purrr_1.0.1 RANN_2.6.1 KEGGREST_1.38.0
[99] pbapply_1.7-0 future_1.30.0 nlme_3.1-161 mime_0.12 ggrastr_1.0.1 compiler_4.2.2 rstudioapi_0.14
[106] beeswarm_0.4.0 plotly_4.10.1 curl_5.0.0 png_0.1-8 spatstat.utils_3.0-1 tibble_3.1.8 stringi_1.7.12
[113] ps_1.7.2 lattice_0.20-45 vctrs_0.5.1 pillar_1.8.1 lifecycle_1.0.3 BiocManager_1.30.19 spatstat.geom_3.0-3
[120] lmtest_0.9-40 RcppAnnoy_0.0.20 bitops_1.0-7 data.table_1.14.7 irlba_2.3.5.1 httpuv_1.6.8 R6_2.5.1
[127] promises_1.2.0.1 KernSmooth_2.23-20 gridExtra_2.3 vipor_0.4.5 parallelly_1.34.0 sessioninfo_1.2.2 codetools_0.2-18
[134] MASS_7.3-58.1 assertthat_0.2.1 pkgload_1.3.2 pkgmaker_0.32.7 withr_2.5.0 sctransform_0.3.5 GenomeInfoDbData_1.2.9 [141] parallel_4.2.2 grid_4.2.2 tidyr_1.2.1 L1pack_0.41-2 Rfast_2.0.6 Rtsne_0.16 spatstat.explore_3.0-5 [148] shiny_1.7.4 ggbeeswarm_0.7.1