Transfer SingleCellExperiment object to a Seurat object for preparation for DR.SC model fitting; see our [DR.SC package website](https://feiyoung.github.io/DR.SC/index.html) for more usage of DR.SC.

sce2seurat(sce, verbose = TRUE)

Arguments

sce

a SingleCellExperiment object, at least including the raw gene count expression matrix.

verbose

an optional logical value, whether output the information.

Value

Return a Seurat object.

Examples

library(SingleCellExperiment)
dir <- system.file(
  file.path("extdata", "10xVisium", "section1"),
  package = "SpatialExperiment")

# read in counts
fnm <- file.path(dir, "raw_feature_bc_matrix")
sce <- DropletUtils::read10xCounts(fnm)
colnames(sce) <- paste0("cell", 1:ncol(spe))


seu <- sce2seurat(sce)
#> Transfer SingleCellExperiment object to a Seurat object
#> preparation for  model fitting
head(seu)
#>           orig.ident nCount_RNA nFeature_RNA
#> cell1  SeuratProject          9            7
#> cell2  SeuratProject         22           13
#> cell3  SeuratProject         11            9
#> cell4  SeuratProject         20           12
#> cell5  SeuratProject         18            9
#> cell6  SeuratProject          1            1
#> cell7  SeuratProject          7            6
#> cell8  SeuratProject          2            2
#> cell9  SeuratProject          1            1
#> cell10 SeuratProject          3            2
#>                                                                                                      Sample
#> cell1  B:/ProgramFiles/R/R-4.1.2/library/SpatialExperiment/extdata/10xVisium/section1/raw_feature_bc_matrix
#> cell2  B:/ProgramFiles/R/R-4.1.2/library/SpatialExperiment/extdata/10xVisium/section1/raw_feature_bc_matrix
#> cell3  B:/ProgramFiles/R/R-4.1.2/library/SpatialExperiment/extdata/10xVisium/section1/raw_feature_bc_matrix
#> cell4  B:/ProgramFiles/R/R-4.1.2/library/SpatialExperiment/extdata/10xVisium/section1/raw_feature_bc_matrix
#> cell5  B:/ProgramFiles/R/R-4.1.2/library/SpatialExperiment/extdata/10xVisium/section1/raw_feature_bc_matrix
#> cell6  B:/ProgramFiles/R/R-4.1.2/library/SpatialExperiment/extdata/10xVisium/section1/raw_feature_bc_matrix
#> cell7  B:/ProgramFiles/R/R-4.1.2/library/SpatialExperiment/extdata/10xVisium/section1/raw_feature_bc_matrix
#> cell8  B:/ProgramFiles/R/R-4.1.2/library/SpatialExperiment/extdata/10xVisium/section1/raw_feature_bc_matrix
#> cell9  B:/ProgramFiles/R/R-4.1.2/library/SpatialExperiment/extdata/10xVisium/section1/raw_feature_bc_matrix
#> cell10 B:/ProgramFiles/R/R-4.1.2/library/SpatialExperiment/extdata/10xVisium/section1/raw_feature_bc_matrix
#>                   Barcode
#> cell1  AAACAACGAATAGTTC-1
#> cell2  AAACAAGTATCTCCCA-1
#> cell3  AAACAATCTACTAGCA-1
#> cell4  AAACACCAATAACTGC-1
#> cell5  AAACAGAGCGACTCCT-1
#> cell6  AAACAGCTTTCAGAAG-1
#> cell7  AAACAGGGTCTATATT-1
#> cell8  AAACAGTGTTCCTGGG-1
#> cell9  AAACATGGTGAGAGGA-1
#> cell10 AAACATTTCCCGGATT-1

## Fit DR-SC model
library(DR.SC)
library(Seurat)
seu <- NormalizeData(seu)
seu <- FindVariableFeatures(seu)
seu <- DR.SC(seu = seu, K=4, platform = "scRNAseq")
#> Fit DR-SC model...
#> Using accurate PCA to obtain initial values
#> Finish DR-SC model fitting