Force an object to belong to a class

CellCycleMarkers to tbl_df

S4 coercion support for creating a tbl_df from CellCycleMarkers.

CellTypeMarkers to tbl_df

S4 coercion support for creating a tbl_df from CellTypeMarkers.

Seurat to SingleCellExperiment

S4 coercion support for creating a SingleCellExperiment from a Seurat class object. The Seurat FAQ page explains the Seurat S4 class structure in detail. Internally, this method improves the basic Seurat::as.SingleCellExperiment S3 coercion method, including the object@scale.data matrix, and will keep track of stashed rowRanges and metadata if the Seurat object was originally created from a SingleCellExperiment (i.e. from the bcbioSingleCell package).

Seurat to RangedSummarizedExperiment

S4 coercion support for creating a RangedSummarizedExperiment from a Seurat class object.

Seurat to SummarizedExperiment

S4 coercion support for creating a SummarizedExperiment from a Seurat class object.

SeuratMarkers to tbl_df

S4 coercion support for creating a tbl_df from a Markers object.

SeuratMarkersPerCluster to tbl_df

S4 coercion support for creating a tbl_df from SeuratMarkersPerCluster.

SingleCellExperiment to Seurat

Interally Seurat::CreateSeuratObject is called without applying any additional filtering cutoffs, since we have already defined them during our quality control analysis. Here we are passing the raw gene-level counts of the filtered cells into a new Seurat class object. Use convertGenesToSymbols to convert gene IDs to names (symbols).

See also

Examples

data(sce, package = "acidtest") data(seurat) ## SingleCellExperiment to Seurat ==== object <- sce print(object)
#> class: SingleCellExperiment #> dim: 500 100 #> metadata(1): date #> assays(1): counts #> rownames(500): gene1 gene2 ... gene499 gene500 #> rowData names(5): geneID geneName geneBiotype broadClass entrezID #> colnames(100): cell001 cell002 ... cell099 cell100 #> colData names(2): expLibSize sampleID #> reducedDimNames(0): #> spikeNames(0):
x <- as(object, "Seurat") class(x)
#> [1] "Seurat" #> attr(,"package") #> [1] "Seurat"
#> An object of class Seurat #> 500 features across 100 samples within 1 assay #> Active assay: RNA (500 features)
## Seurat to SingleCellExperiment ==== x <- as(seurat, "SingleCellExperiment") print(x)
#> class: SingleCellExperiment #> dim: 230 80 #> metadata(2): scaleData variableFeatures #> assays(2): counts logcounts #> rownames(230): MS4A1 CD79B ... SPON2 S100B #> rowData names(10): broadClass entrezID ... variance.expected #> variance.standardized #> colnames(80): ATGCCAGAACGACT CATGGCCTGTGCAT ... GGAACACTTCAGAC #> CTTGATTGATCTTC #> colData names(8): orig.ident nCount_RNA ... RNA_snn_res.1 ident #> reducedDimNames(3): PCA TSNE UMAP #> spikeNames(0):