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

Errors with SeuratObject, and Matrix #8164

Closed
MeganRMonaghan opened this issue Dec 11, 2023 · 14 comments
Closed

Errors with SeuratObject, and Matrix #8164

MeganRMonaghan opened this issue Dec 11, 2023 · 14 comments
Labels
bug Something isn't working

Comments

@MeganRMonaghan
Copy link

Hi! I seem to be caught in a catch 22. I am currently analysing some single cell RNA seq data and despite the code running smoothly I now have a cycle of two errors. After updating Seurat to version 5.01, I receive the following error when I attempt to produce my SeuratObject

cns.sce <- CreateSeuratObject(counts(rna_sce)[, which(colnames(rna_sce) %in% common.cells)])

Warning: Data is of class dgTMatrix. Coercing to dgCMatrix. Error in validObject(.Object) : invalid class "LogMap" object: Duplicate rownames not allowed

I have seen in other posts here this was an issue with Matrix, so I used the following code, and am met with this error continuously, to the extent where I cannot see what I am typing in the console as the error repeats hundreds of times over.

devtools::install_version("Matrix",version = "1.6-1.1")
library(Matrix)

Loading required package: SeuratObject
Error: package or namespace load failed for 'SeuratObject' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 namespace 'Matrix' 1.6-1.1 is already loaded, but >= 1.6.3 is required

To stop this error, I have to uninstall Matrix 1.6-1.1 and restart the session, which returns me to the original error once I update Matrix.

Warning: Data is of class dgTMatrix. Coercing to dgCMatrix. Error in validObject(.Object) : invalid class "LogMap" object: Duplicate rownames not allowed

Any help here would be greatly appreciated as I cannot work on my data at present due to this.

sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

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

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

time zone: Australia/Adelaide
tzcode source: system (glibc)

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

other attached packages:
[1] Matrix_1.6-4 Seurat_5.0.1 ensembldb_2.24.1 AnnotationFilter_1.24.0 GenomicFeatures_1.52.2
[6] AnnotationDbi_1.62.2 Biobase_2.62.0 GenomicRanges_1.54.1 GenomeInfoDb_1.38.0 IRanges_2.36.0
[11] S4Vectors_0.40.1 SeuratObject_5.0.1 sp_2.1-2 AnnotationHub_3.8.0 BiocFileCache_2.8.0
[16] dbplyr_2.4.0 BiocGenerics_0.48.1

loaded via a namespace (and not attached):
[1] fs_1.6.3 ProtGenerics_1.32.0 matrixStats_1.1.0 spatstat.sparse_3.0-3
[5] bitops_1.0-7 devtools_2.4.5 httr_1.4.7 RColorBrewer_1.1-3
[9] profvis_0.3.8 tools_4.3.2 sctransform_0.4.1 utf8_1.2.4
[13] R6_2.5.1 lazyeval_0.2.2 uwot_0.1.16 urlchecker_1.0.1
[17] prettyunits_1.2.0 gridExtra_2.3 progressr_0.14.0 cli_3.6.1
[21] spatstat.explore_3.2-5 fastDummies_1.7.3 spatstat.data_3.0-3 ggridges_0.5.4
[25] pbapply_1.7-2 Rsamtools_2.16.0 parallelly_1.36.0 sessioninfo_1.2.2
[29] limma_3.58.1 rstudioapi_0.15.0 RSQLite_2.3.4 generics_0.1.3
[33] BiocIO_1.10.0 ica_1.0-3 spatstat.random_3.2-2 dplyr_1.1.4
[37] fansi_1.0.6 abind_1.4-5 lifecycle_1.0.4 yaml_2.3.7
[41] edgeR_3.42.4 SummarizedExperiment_1.32.0 SparseArray_1.2.0 Rtsne_0.17
[45] grid_4.3.2 blob_1.2.4 promises_1.2.1 dqrng_0.3.2
[49] crayon_1.5.2 miniUI_0.1.1.1 lattice_0.22-5 beachmat_2.18.0
[53] cowplot_1.1.1 KEGGREST_1.40.1 pillar_1.9.0 metapod_1.8.0
[57] rjson_0.2.21 future.apply_1.11.0 codetools_0.2-19 leiden_0.4.3.1
[61] glue_1.6.2 data.table_1.14.10 remotes_2.4.2.1 vctrs_0.6.5
[65] png_0.1-8 spam_2.10-0 gtable_0.3.4 cachem_1.0.8
[69] S4Arrays_1.2.0 mime_0.12 survival_3.5-7 SingleCellExperiment_1.24.0
[73] statmod_1.5.0 bluster_1.10.0 interactiveDisplayBase_1.38.0 ellipsis_0.3.2
[77] fitdistrplus_1.1-11 ROCR_1.0-11 nlme_3.1-163 usethis_2.2.2
[81] bit64_4.0.5 progress_1.2.3 filelock_1.0.2 RcppAnnoy_0.0.21
[85] rprojroot_2.0.4 irlba_2.3.5.1 KernSmooth_2.23-22 colorspace_2.1-0
[89] DBI_1.1.3 tidyselect_1.2.0 bit_4.0.5 compiler_4.3.2
[93] curl_5.2.0 BiocNeighbors_1.20.0 xml2_1.3.6 DelayedArray_0.28.0
[97] plotly_4.10.3 rtracklayer_1.60.1 scales_1.3.0 lmtest_0.9-40
[101] rappdirs_0.3.3 stringr_1.5.1 digest_0.6.33 goftest_1.2-3
[105] spatstat.utils_3.0-4 XVector_0.42.0 htmltools_0.5.7 pkgconfig_2.0.3
[109] sparseMatrixStats_1.14.0 MatrixGenerics_1.14.0 fastmap_1.1.1 rlang_1.1.2
[113] htmlwidgets_1.6.4 shiny_1.8.0 DelayedMatrixStats_1.24.0 zoo_1.8-12
[117] jsonlite_1.8.8 BiocParallel_1.36.0 BiocSingular_1.18.0 RCurl_1.98-1.13
[121] magrittr_2.0.3 scuttle_1.12.0 GenomeInfoDbData_1.2.11 dotCall64_1.1-1
[125] patchwork_1.1.3 munsell_0.5.0 Rcpp_1.0.11 reticulate_1.34.0
[129] stringi_1.8.2 zlibbioc_1.48.0 MASS_7.3-60 plyr_1.8.9
[133] pkgbuild_1.4.3 parallel_4.3.2 listenv_0.9.0 ggrepel_0.9.4
[137] deldir_2.0-2 Biostrings_2.68.1 splines_4.3.2 tensor_1.5
[141] hms_1.1.3 locfit_1.5-9.8 igraph_1.5.1 spatstat.geom_3.2-7
[145] RcppHNSW_0.5.0 reshape2_1.4.4 biomaRt_2.56.1 ScaledMatrix_1.10.0
[149] pkgload_1.3.3 BiocVersion_3.17.1 XML_3.99-0.15 scran_1.28.2
[153] BiocManager_1.30.22 httpuv_1.6.13 RANN_2.6.1 tidyr_1.3.0
[157] purrr_1.0.2 polyclip_1.10-6 future_1.33.0 scattermore_1.2
[161] ggplot2_3.4.4 rsvd_1.0.5 xtable_1.8-4 restfulr_0.0.15
[165] RSpectra_0.16-1 later_1.3.2 viridisLite_0.4.2 tibble_3.2.1
[169] memoise_2.0.1 GenomicAlignments_1.36.0 cluster_2.1.4 globals_0.16.2
[173] here_1.0.1

@MeganRMonaghan MeganRMonaghan added the bug Something isn't working label Dec 11, 2023
@mhkowalski
Copy link
Contributor

Hello,

This may not be related to the Matrix package. I see from your output that you are getting the error message Duplicate rownames not allowed. Can you check if there are duplicate row names in the counts matrix you are providing to CreateSeuratObject?

For instance, what is sum(duplicated(rownames(count_matrix)))?

@MeganRMonaghan
Copy link
Author

Hello,

This may not be related to the Matrix package. I see from your output that you are getting the error message Duplicate rownames not allowed. Can you check if there are duplicate row names in the counts matrix you are providing to CreateSeuratObject?

For instance, what is sum(duplicated(rownames(count_matrix)))?

I'm seeing the following:

sum(duplicated(rownames(rna_sce)))
[1] 20

Which is unusual, as I did not have this issue with the duplicates the last time I ran this analysis.

@mhkowalski
Copy link
Contributor

Ok, thanks for your response. This is likely causing the problem, as the row names of the matrix must be unique. Please either remove the duplicate rows or change the row names to ensure there aren't duplicates.

@erzakiev
Copy link

erzakiev commented Jan 15, 2024

Error still pops up with all rownames being unique though. It's somewhat dataset-specific (only occurs sometimes) so here is a csv dataset where it does pop up

Guo <- read.csv(file = 'example.csv')
Guo <- CreateSeuratObject(counts = Guo, min.cells = 0, min.features = 0)
Error in validObject(.Object) : 
  invalid class “LogMap” object: Duplicate rownames not allowed

Relevant packages' versions:

[1] Matrix_1.6-4          Seurat_5.0.1          rhdf5_2.46.0          SeuratDisk_0.0.0.9021
[5] shiny_1.8.0           SeuratObject_5.0.1    sp_2.1-1

@Nicomakii
Copy link

Hi @erzakiev I am having the same exact issue with you, please let me know if you have resolved the problem. Thank you!

@pikapika505
Copy link

this is the problem I have had since I updated Seurat to V5. I running it on macOS Ventura 13.3. I still don't know how to resolve it. It's not caused by duplicates @mhkowalski

@chloe-shard
Copy link

I am also having the same issue - It's not caused by duplicates. I encountered this issue trying to run MetaFLUX analysis.

mean_exp=calculate_avg_exp(myseurat = sc_test_example,myident = 'Cell_type',n_bootstrap=3,seed=1)
Error in validObject(.Object) :
invalid class “LogMap” object: Duplicate rownames not allowed

@AHerik
Copy link

AHerik commented Feb 18, 2024

Also having this issue, not caused by duplicates and downgrading my version of Matrix has not helped. Would appreciate any fixes or advice.

Thanks!

@samIndeed
Copy link

Hi, I had the same issue and fixed it by making my column names unique!

I guess the problem (in my case anyway) is that the error says rownames instead of column names.

@nsauerwald
Copy link

nsauerwald commented Feb 20, 2024

Hi, I'm having the same issue with no duplicated row or column names. This never happened in previous versions of Seurat for me - this is with Seurat 5.0.1

sc701 <- CreateSeuratObject(counts = sc.data, project = "sample701", min.cells = 3, min,features = 200)
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Error in validObject(.Object) :
invalid class “LogMap” object: Duplicate rownames not allowed
sum(duplicated(colnames(sc.data)))
[1] 0
sum(duplicated(rownames(sc.data)))
[1] 0

@MomenehForoutan
Copy link

MomenehForoutan commented Apr 18, 2024

Hi team, I am having the same issue with Seurat v5.0.3 when trying to create Seurat object using CreateSeuratObject() function. The error says I have duplicated row names while I do not.
Thanks for any help with this in advance!
EDIT: it turned out that I also had duplicated column names but got the error for duplicated row names.

@apaikari
Copy link

Use options(Seurat.object.assay.version = 'v3') and it will work

@Ana1335
Copy link

Ana1335 commented Aug 23, 2024

I am having the same issue, any idea how to fix?

@shisang7
Copy link

shisang7 commented Oct 8, 2024

just use seurat v4, and it will work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests