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

'Crop' Function Failed on Vizgen Data #7635

Closed
tangboyun opened this issue Aug 3, 2023 · 2 comments
Closed

'Crop' Function Failed on Vizgen Data #7635

tangboyun opened this issue Aug 3, 2023 · 2 comments

Comments

@tangboyun
Copy link

I am following the tutorial on Vizgen data analysis.

vizgen.obj <- LoadVizgen(data.dir = '/path/to/input_dir', fov = 'fov',verbose=TRUE)
vizgen.obj <- SCTransform(vizgen.obj, assay = 'Vizgen', clip.range = c(-10, 10), )
vizgen.obj <- RunPCA(vizgen.obj, npcs = 30, features = rownames(vizgen.obj))
vizgen.obj <- RunUMAP(vizgen.obj, dims = 1:30)
vizgen.obj <- FindNeighbors(vizgen.obj, reduction = 'pca', dims = 1:30)
vizgen.obj <- FindClusters(vizgen.obj, resolution = 0.3)

When I tried to create a Crop, I got the following error:

vizgen.crop <- Crop(vizgen.obj[['fov']],x=c(1250,3750),y=c(8000,9000),coords='plot')
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'y' in selecting a method for function 'Overlay': cannot derive coordinates from non-numeric matrix
Calls: Crop ... stopifnot -> Polygon -> coordinates -> coordinates -> .local

My ImageDimPlot looks like this:
imagedimplot

I've tried to swap the x and y coordinates, and tried other ranges like x=c(8000,9000),y=c(8000,9000) or x=c(1000,2000),y=c(1000,2000). But I still got the same error.

I've installed the latest patch in #7190 and my sessionInfo() is:

R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

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

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

other attached packages:
 [1] spatstat_3.0-6          spatstat.linnet_3.1-1   spatstat.model_3.2-4   
 [4] rpart_4.1.16            spatstat.explore_3.2-1  nlme_3.1-155           
 [7] spatstat.random_3.1-5   spatstat.geom_3.2-4     spatstat.data_3.0-1    
[10] progressr_0.13.0        BiocParallel_1.34.2     magrittr_2.0.3         
[13] dplyr_1.1.2             SeuratObject_4.9.9.9091 Seurat_4.3.0.9002      

loaded via a namespace (and not attached):
 [1] spatstat.sparse_3.0-2 matrixStats_1.0.0     RcppAnnoy_0.0.21     
 [4] RColorBrewer_1.1-3    httr_1.4.6            sctransform_0.3.5    
 [7] tools_4.1.2           utf8_1.2.3            R6_2.5.1             
[10] irlba_2.3.5.1         KernSmooth_2.23-20    mgcv_1.8-39          
[13] uwot_0.1.16           lazyeval_0.2.2        colorspace_2.1-0     
[16] sp_2.0-0              tidyselect_1.2.0      gridExtra_2.3        
[19] compiler_4.1.2        cli_3.6.1             plotly_4.10.2        
[22] scales_1.2.1          lmtest_0.9-40         ggridges_0.5.4       
[25] pbapply_1.7-2         goftest_1.2-3         stringr_1.5.0        
[28] digest_0.6.33         spatstat.utils_3.0-3  pkgconfig_2.0.3      
[31] htmltools_0.5.5       parallelly_1.36.0     fastmap_1.1.1        
[34] htmlwidgets_1.6.2     rlang_1.1.1           shiny_1.7.4.1        
[37] generics_0.1.3        zoo_1.8-12            jsonlite_1.8.7       
[40] ica_1.0-3             dotCall64_1.0-2       patchwork_1.1.2      
[43] Matrix_1.6-0          Rcpp_1.0.11           munsell_0.5.0        
[46] fansi_1.0.4           abind_1.4-5           reticulate_1.30      
[49] lifecycle_1.0.3       stringi_1.7.12        MASS_7.3-55          
[52] Rtsne_0.16            plyr_1.8.8            grid_4.1.2           
[55] parallel_4.1.2        listenv_0.9.0         promises_1.2.0.1     
[58] ggrepel_0.9.3         deldir_1.0-9          miniUI_0.1.1.1       
[61] lattice_0.20-45       cowplot_1.1.1         splines_4.1.2        
[64] tensor_1.5            pillar_1.9.0          igraph_1.5.0.1       
[67] future.apply_1.11.0   reshape2_1.4.4        codetools_0.2-18     
[70] leiden_0.4.3          glue_1.6.2            data.table_1.14.8    
[73] png_0.1-8             vctrs_0.6.3           spam_2.9-1           
[76] httpuv_1.6.11         polyclip_1.10-4       gtable_0.3.3         
[79] RANN_2.6.1            purrr_1.0.1           tidyr_1.3.0          
[82] scattermore_1.2       future_1.33.0         ggplot2_3.4.2        
[85] mime_0.12             xtable_1.8-4          later_1.3.1          
[88] survival_3.2-13       viridisLite_0.4.2     tibble_3.2.1         
[91] cluster_2.1.2         globals_0.16.2        fitdistrplus_1.1-11  
[94] ellipsis_0.3.2        ROCR_1.0-11
@alikhuseynov
Copy link

were those red star shapes added on purpose?
Note that Crop function is from SeuratObject package.
Does it work if you use coords = "tissue" with x=c(8000, 9000), y=c(8000, 9000) ?

@tangboyun
Copy link
Author

My fault...
I forgot to set the options options(Seurat.object.assay.version = "v5"). Setting the options will cause another error: GetAssay(vizgen.obj,assay='Vizgen') will not work. I'll close this issue and open a new issue.

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

2 participants