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

error in createGiottoCosMxObject() at Joining FOV gobjects #1024

Open
drosop opened this issue Sep 13, 2024 · 3 comments
Open

error in createGiottoCosMxObject() at Joining FOV gobjects #1024

drosop opened this issue Sep 13, 2024 · 3 comments

Comments

@drosop
Copy link

drosop commented Sep 13, 2024

Hi,

Im trying to test Nanonstring CosMx Lung tutorial (https://giottosuite.readthedocs.io/en/latest/subsections/datasets/Nanostring_Lung12.html#cosmx-project-loading-function).
However, Im stuck at createGiottoCosMxObject() step.

Error:
Error in setSpatialLocations(gobject = gobject, x = x, ...) :
Add expression or spatial (polygon) information first

I'm following exactly the same steps as in tutorial. Test creating giotto object for individual fovs and then joining them (steps 2-4). But encountering same problem at joinGiottoObjects().

Can you please help?

Thank you,

sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Red Hat Enterprise Linux 8.7 (Ootpa)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblas-r0.3.15.so; LAPACK version 3.9.0

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

time zone: America/Chicago
tzcode source: system (glibc)

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

other attached packages:
[1] Giotto_4.1.0 GiottoClass_0.3.5

loaded via a namespace (and not attached):
[1] rappdirs_0.3.3 tidyr_1.3.1 plotly_4.10.4
[4] utf8_1.2.4 generics_0.1.3 gtools_3.9.5
[7] stringi_1.8.4 lattice_0.22-6 digest_0.6.37
[10] magrittr_2.0.3 grid_4.4.1 RColorBrewer_1.1-3
[13] fastmap_1.2.0 plyr_1.8.9 R.oo_1.26.0
[16] jsonlite_1.8.8 Matrix_1.7-0 R.utils_2.12.3
[19] ggrepel_0.9.6 backports_1.5.0 scattermore_1.2
[22] httr_1.4.7 purrr_1.0.2 fansi_1.0.6
[25] viridisLite_0.4.2 scales_1.3.0 lazyeval_0.2.2
[28] codetools_0.2-20 cli_3.6.3 rlang_1.1.4
[31] R.methodsS3_1.8.2 pak_0.8.0 cowplot_1.1.3
[34] munsell_0.5.1 withr_3.0.1 remotes_2.5.0
[37] colorRamp2_0.1.0 parallel_4.4.1 tools_4.4.1
[40] reshape2_1.4.4 deldir_2.0-4 GiottoUtils_0.1.11
[43] checkmate_2.3.2 dplyr_1.1.4 colorspace_2.1-1
[46] ggplot2_3.5.1 curl_5.2.2 reticulate_1.39.0
[49] vctrs_0.6.5 R6_2.5.1 png_0.1-8
[52] matrixStats_1.4.1 lifecycle_1.0.4 magick_2.8.4
[55] stringr_1.5.1 htmlwidgets_1.6.4 GiottoVisuals_0.2.4
[58] dbscan_1.2-0 pkgconfig_2.0.3 terra_1.7-78
[61] pillar_1.9.0 gtable_0.3.5 data.table_1.16.0
[64] glue_1.7.0 Rcpp_1.0.13 tibble_3.2.1
[67] tidyselect_1.2.1 htmltools_0.5.8.1 igraph_2.0.3
[70] compiler_4.4.1 sp_2.1-4

@jiajic
Copy link
Member

jiajic commented Sep 16, 2024

Hi @drosop,

Sorry for the issue. The load part of that tutorial is due an update. Can you try the following?

library(Giotto)
cosmx <- importCosMx("directory path to cosmx outputs")
g <- cosmx$create_gobject()

Further information on our updates to cosmx loading with Giotto can be found here

@drosop
Copy link
Author

drosop commented Sep 16, 2024

Thank you so much for quick response.

It is working now. However, I encounter few issues:

  1. importCosMx() isnt automatically detecting fov position file and metadata file. So I wrote this:
data_path = '~/Lung12-Flat_files_and_images/'

cosmx <- importCosMx(cosmx_dir = data_path,
                     fovs = c(2,3,4))

fov_shifts <- data.table::fread(paste0(data_path,"/Lung12_fov_positions_file.csv"))
if (!"X_mm" %in% colnames(fov_shifts)) {
  data.table::setnames(fov_shifts, new = c("fov", "x", "y"))
  pos <- fov_shifts
}
cosmx$offsets <- pos

Can you please see if this is the right way?

  1. When creating image using spatInSituPlotPoints(), the y dims look weird. Polygons and expression data is plotted separately. See attached. Can you please suggest why is this happening? Im following steps on : https://gist.github.com/jiajic/bc8abf18fd362ca36790b8c074847bb9#file-cosmx_importer-md
cosmx$create_gobject()

Warning messages:
1: In data.table::fread(input = path, nThread = cores, drop = dropcols) :
  Column name 'cell' (drop[4]) not found

test2.pdf

Thank you,

@rbutleriii
Copy link

rbutleriii commented Feb 27, 2025

FYI, came across while looking for something else, but https://giottosuite.readthedocs.io/ is the old website (even though it is the top search engine hit), you want drieslab.github.io. The issue is you need to run createGiottoCosMxObject() with the version = 'legacy' setting.

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

3 participants