Skip to contents

This function determines the class of a loaded object and converts it to a SingleCellExperiment object if necessary. It handles Seurat objects, updating old Seurat v2 objects if detected, and converts them to SingleCellExperiment. If the input object is already a SingleCellExperiment, it is returned as is. For other object types, an attempt is made to convert them to SingleCellExperiment.

Usage

convert_seurat_to_sce(data)

Arguments

data

The loaded object to be converted.

Value

A SingleCellExperiment object.

Details

The function first checks if the input object is a Seurat object. If it is, it prints a summary of the object and checks for indicators of Seurat v2, updating the object if necessary. It then converts the Seurat object to a SingleCellExperiment. If the object is already a SingleCellExperiment, it is returned directly. For other object types, an attempt is made to convert them to SingleCellExperiment.

Examples

if (FALSE) { # \dontrun{
library(Seurat)
library(SingleCellExperiment)
seurat_obj <- CreateSeuratObject(counts = matrix(1:4, ncol = 2))
sce <- convert_seurat_to_sce(seurat_obj)
} # }