Nanostring-Biostats / GeomxTools

Tools for NanoString GeoMx Digital Spatial Profiler data for reading DCC and PKC files to NanoStringGeomxSet class, Normalization and QC.
MIT License
34 stars 16 forks source link

Error coercing GeoMx data to Seurat object #191

Open generalshermanw opened 11 months ago

generalshermanw commented 11 months ago

Dear team,

I'm attempting to do a conversion between NanoStringGeoMxSet to a Seurat object using the GeoMxTools::as.Seurat() function. The relevant error is: Error in names(v) <- row.names(x = value) : 'names' attribute [179] must be the same length as the vector [1] Command: seuratData <- as.Seurat(targetData, assay = NULL, normData = 'q_norm', coordinates = NULL, forceRaw = FALSE) I think I've worked through enough that I believe the issue stems from the Seurat::AddMetaData command. However, I've hit a dead end on the debug at this point.

Would greatly appreciate your support. Thanks!

Relevant environment:

R version 4.2.2 (2022-10-31) Platform: x86_64-pc-linux-gnu (64-bit) other attached packages: [1] Seurat_4.9.9.9058 SeuratObject_5.0.0 sp_2.1-1 GeomxTools_3.2.0 NanoStringNCTools_1.6.1 [6] ggplot2_3.4.4 S4Vectors_0.36.2 Biobase_2.58.0 BiocGenerics_0.44.0

maddygriz commented 11 months ago

Hi @generalshermanw,

Our customer support team will be able to help you with this. Please email support@nanostring.com with your issue.

Thanks, Maddy

zchatt commented 10 months ago

Hi all.,

Was there a solution for this? I am having the exact same issue using the same GeoMxSet object that was working ~2 months ago.

`R version 4.3.1 (2023-06-16) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Ventura 13.6.1

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Australia/Sydney tzcode source: internal

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

other attached packages: [1] terra_1.7-55 harmony_1.1.0 Rcpp_1.0.11 ggpubr_0.6.0 SeuratObject_5.0.0
[6] Seurat_4.4.0 preprocessCore_1.62.1 GiottoClass_0.0.0.9005 GiottoUtils_0.0.0.9003 Giotto_3.3.1
[11] devtools_2.4.5 usethis_2.2.2 GeomxTools_3.3.0 NanoStringNCTools_1.8.0 ggplot2_3.4.4
[16] S4Vectors_0.38.2 Biobase_2.60.0 BiocGenerics_0.46.0 `

maddygriz commented 10 months ago

Hi @zchatt,

Our customer support team will be able to help you with this. Please email support@nanostring.com with your issue.

Thanks, Maddy

dksenthil commented 10 months ago

I got into a similar error , which I could reproduce for the demoData I think as.Seurat function n Seurat5 is no longer accepting GeoMx dataset. This could be a Seurat issue.

demoSeurat <- as.Seurat(norm_target_demoData, normData = "q_norm")
Error in validObject(object = object) : 
  invalid class “Seurat” object: 'project' cannot be an empty character 
maddygriz commented 10 months ago

Hi @dksenthil,

GeomxTools does not support Seurat v5 coercion yet. Please revert to Seurat v4.4 to coerce a GeoMxSet object to Seurat. We are working to get Seurat v5 coercion available in our next release.

Thanks, Maddy

dksenthil commented 10 months ago

Thanks, Meanwhile if there is anyone looking for a quick workaround. Not the best way, but it still works!

# create v3 assays
options(Seurat.object.assay.version = "v3")
target_demoData_SPE <- as.SpatialExperiment(target_demoData, normData = "q_norm")
counts <- SummarizedExperiment::assay(target_demoData_SPE)
meta <- SummarizedExperiment::colData(target_demoData_SPE) %>%as.data.frame
target_demoData_seurat <- CreateSeuratObject(counts = counts,project = "SPE_toSeurat",  meta.data = meta, assay = "GeoMx")

~