Seurat object can't be imported into monocle:the object type you want to export to is not supported yet
1
0
Entering edit mode
5.8 years ago
yuhongruoyi ▴ 10

Hello,

I was wondering why my Seurat object can't be imported into monocle? I follow the official website to do it, but it turns out that the importCDS doesn't take that.

Below is the R code and my sessioninfo:

If you do know of how to might help us, that would be incredibly helpful!

Thank you! Sophia

> library(monocle)

mo <- importCDS(tc, import_all = TRUE) Error in importCDS(tc, import_all = TRUE) : the object type you want to export to is not supported yet mo <- importCDS(tc) Error in importCDS(tc) : the object type you want to export to is not supported yet sessionInfo() R version 3.5.2 (2018-12-20) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=Chinese (Simplified)_China.936 LC_CTYPE=Chinese (Simplified)_China.936 LC_MONETARY=Chinese (Simplified)_China.936 [4] LC_NUMERIC=C LC_TIME=Chinese (Simplified)_China.936

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

other attached packages: [1] Seurat_3.0.0.9000 monocle_2.8.0 DDRTree_0.1.5 irlba_2.3.3 VGAM_1.1-1 ggplot2_3.1.0 Biobase_2.40.0
[8] BiocGenerics_0.26.0 BiocInstaller_1.30.0 Matrix_1.2-15

loaded via a namespace (and not attached): [1] Rtsne_0.15 colorspace_1.4-0 ggridges_0.5.1 rprojroot_1.3-2 fs_1.2.6 rstudioapi_0.9.0
[7] listenv_0.7.0 npsurv_0.4-0 remotes_2.0.2 ggrepel_0.8.0 codetools_0.2-16 R.methodsS3_1.7.1
[13] docopt_0.6.1 lsei_1.2-0 pkgload_1.0.2 jsonlite_1.6 ica_1.0-2 cluster_2.0.7-1
[19] png_0.1-7 R.oo_1.22.0 pheatmap_1.0.12 httr_1.4.0 compiler_3.5.2 backports_1.1.3
[25] assertthat_0.2.0 lazyeval_0.2.1 limma_3.36.5 cli_1.0.1 htmltools_0.3.6 prettyunits_1.0.2
[31] tools_3.5.2 rsvd_1.0.0 igraph_1.2.4 gtable_0.2.0 glue_1.3.0 RANN_2.6.1
[37] reshape2_1.4.3 dplyr_0.8.0.1 Rcpp_1.0.0 slam_0.1-44 gdata_2.18.0 ape_5.2
[43] nlme_3.1-137 gbRd_0.4-11 lmtest_0.9-36 stringr_1.4.0 globals_0.12.4 ps_1.3.0
[49] testthat_2.0.1 gtools_3.8.1 devtools_2.0.1 future_1.11.1.1 MASS_7.3-51.1 zoo_1.8-4
[55] scales_1.0.0 RColorBrewer_1.1-2 yaml_2.2.0 reticulate_1.10 memoise_1.1.0 pbapply_1.4-0
[61] gridExtra_2.3 fastICA_1.2-1 stringi_1.3.1 desc_1.2.0 caTools_1.17.1.1 densityClust_0.3
[67] pkgbuild_1.0.2 bibtex_0.4.2 Rdpack_0.10-1 SDMTools_1.1-221 rlang_0.3.1 pkgconfig_2.0.2
[73] matrixStats_0.54.0 bitops_1.0-6 qlcMatrix_0.9.7 lattice_0.20-38 ROCR_1.0-7 purrr_0.3.0
[79] htmlwidgets_1.3 cowplot_0.9.4 processx_3.2.1 tidyselect_0.2.5 plyr_1.8.4 magrittr_1.5
[85] R6_2.4.0 gplots_3.0.1.1 combinat_0.0-8 pillar_1.3.1 withr_2.1.2 fitdistrplus_1.0-14
[91] survival_2.43-3 tsne_0.1-3 tibble_2.0.1 future.apply_1.1.0 crayon_1.3.4 KernSmooth_2.23-15
[97] plotly_4.8.0 viridis_0.5.1 usethis_1.4.0 grid_3.5.2 data.table_1.12.0 FNN_1.1.3
[103] callr_3.1.1 HSMMSingleCell_0.114.0 metap_1.1 sparsesvd_0.1-4 digest_0.6.18 tidyr_0.8.2
[109] R.utils_2.8.0 munsell_0.5.0 viridisLite_0.3.0 sessioninfo_1.1.1
enter image description here

seurat R monocle single cell RNA-Seq • 5.4k views
ADD COMMENT
0
Entering edit mode

I would restart the computer and then, in R, run BiocManager::install() to ensure that everything is up to date. Then specifically also re-install monocle and seurat.

ADD REPLY
0
Entering edit mode

I also am having this issue. I have performed some filtering in Seurat and wish to import my Seurat object. > HH10_monocle <- importCDS(HH10, import_all = T)

Error in importCDS(HH10, import_all = T) : the object type you want to export to is not supported yet

Any advice would be welcome!

> attributes(HH10)

$assays
$assays$RNA
Assay data with 11952 features for 2044 cells


$meta.data
                    orig.ident nCount_RNA nFeature_RNA percent.mito
AAACCTGCAATGGACG SeuratProject       1165          640 0.0042918455
....

$active.assay
[1] "RNA"

$active.ident
AAACCTGCAATGGACG
...

Levels: SeuratProject

$graphs
list()

$neighbors
list()

$reductions
list()

$project.name
[1] "SeuratProject"

$misc
list()

$version
[1] ‘3.0.0.9000’

$commands
list()

$tools
list()

$class
[1] "Seurat"
attr(,"package")
[1] "Seurat"`




R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS

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

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   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] monocle_2.99.3        L1Graph_0.1.1         lpSolveAPI_5.5.2.0-17 DDRTree_0.1.5         irlba_2.3.3           igraph_1.2.4         
 [7] ggplot2_3.1.0         DelayedArray_0.8.0    BiocParallel_1.16.5   matrixStats_0.54.0    Seurat_3.0.0.9000     Rmagic_1.4.0         
[13] Matrix_1.2-15         org.Gg.eg.db_3.7.0    AnnotationDbi_1.44.0  IRanges_2.16.0        S4Vectors_0.20.1      Biobase_2.42.0       
[19] BiocGenerics_0.28.0   dplyr_0.8.0.1        

loaded via a namespace (and not attached):
ADD REPLY
2
Entering edit mode
5.8 years ago

I think this has to do with the update from Seurat2 to Seurat3, which changes where data is stored. It worked for me after updating the import script.

I updated the import script for monocle so it refers to the Seurat3 objects and slots, so you can just run that in R first (below):

and following that did:

seurat_data <- newimport(SeuratObject)

###
newimport <- function(otherCDS, import_all = FALSE) {
  if(class(otherCDS)[1] == 'Seurat') {
    requireNamespace("Seurat")
    data <- otherCDS@assays$RNA@counts

    if(class(data) == "data.frame") {
      data <- as(as.matrix(data), "sparseMatrix")
    }

    pd <- tryCatch( {
      pd <- new("AnnotatedDataFrame", data = otherCDS@meta.data)
      pd
    }, 
    #warning = function(w) { },
    error = function(e) { 
      pData <- data.frame(cell_id = colnames(data), row.names = colnames(data))
      pd <- new("AnnotatedDataFrame", data = pData)

      message("This Seurat object doesn't provide any meta data");
      pd
    })

    # remove filtered cells from Seurat
    if(length(setdiff(colnames(data), rownames(pd))) > 0) {
      data <- data[, rownames(pd)]  
    }

    fData <- data.frame(gene_short_name = row.names(data), row.names = row.names(data))
    fd <- new("AnnotatedDataFrame", data = fData)
    lowerDetectionLimit <- 0

    if(all(data == floor(data))) {
      expressionFamily <- negbinomial.size()
    } else if(any(data < 0)){
      expressionFamily <- uninormal()
    } else {
      expressionFamily <- tobit()
    }

    valid_data <- data[, row.names(pd)]

    monocle_cds <- newCellDataSet(data,
                                  phenoData = pd, 
                                  featureData = fd,
                                  lowerDetectionLimit=lowerDetectionLimit,
                                  expressionFamily=expressionFamily)

    if(import_all) {
      if("Monocle" %in% names(otherCDS@misc)) {
        otherCDS@misc$Monocle@auxClusteringData$seurat <- NULL
        otherCDS@misc$Monocle@auxClusteringData$scran <- NULL

        monocle_cds <- otherCDS@misc$Monocle
        mist_list <- otherCDS

      } else {
        # mist_list <- list(ident = ident) 
        mist_list <- otherCDS
      }
    } else {
      mist_list <- list()
    }

    if(1==1) {
      var.genes <- setOrderingFilter(monocle_cds, otherCDS@assays$RNA@var.features)

    }
    monocle_cds@auxClusteringData$seurat <- mist_list

  } else if (class(otherCDS)[1] == 'SCESet') {
    requireNamespace("scater")

    message('Converting the exprs data in log scale back to original scale ...')    
    data <- 2^otherCDS@assayData$exprs - otherCDS@logExprsOffset

    fd <- otherCDS@featureData
    pd <- otherCDS@phenoData
    experimentData = otherCDS@experimentData
    if("is.expr" %in% slotNames(otherCDS))
      lowerDetectionLimit <- otherCDS@is.expr
    else 
      lowerDetectionLimit <- 1

    if(all(data == floor(data))) {
      expressionFamily <- negbinomial.size()
    } else if(any(data < 0)){
      expressionFamily <- uninormal()
    } else {
      expressionFamily <- tobit()
    }

    if(import_all) {
      # mist_list <- list(iotherCDS@sc3,
      #                   otherCDS@reducedDimension)
      mist_list <- otherCDS 

    } else {
      mist_list <- list()
    }

    monocle_cds <- newCellDataSet(data,
                                  phenoData = pd, 
                                  featureData = fd,
                                  lowerDetectionLimit=lowerDetectionLimit,
                                  expressionFamily=expressionFamily)
    # monocle_cds@auxClusteringData$sc3 <- otherCDS@sc3
    # monocle_cds@auxOrderingData$scran <- mist_list

    monocle_cds@auxOrderingData$scran <- mist_list

  } else {
    stop('the object type you want to export to is not supported yet')
  }

  return(monocle_cds)
}
ADD COMMENT

Login before adding your answer.

Traffic: 2083 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6