Skip to contents

This function is used to convert a SingleCellExperiment, SpatialExperiment or a Seurat object into Seurat object containing all required fields and structured for scFeatures functions.

Usage

makeSeurat(
  data,
  sample = NULL,
  celltype = NULL,
  assay = NULL,
  spatialCoords = NULL,
  spotProbability = NULL
)

Arguments

data

input data, either a SingleCellExperiment or SpatialExperiment object. The object needs to contain a column named "sample" and a column named "celltype". Alternatively, user can provide the name of the column containing sample and celltype into the sample and celltype argument. When passing as SingleCellExperiment or SpatialExperiment, by default we use the assay stored in "logcount". Alternatively, user can specify the assay to use in the assay argument. If users want to construct features from the spatial category, by default we need columns called "x_cord" and "y_cord". Alternatively, please specify the relevant column in the spatialCoords argument. For spot-based spatial transcriptomics, we also requires a matrix containing cell type prediction probability of each spot, in the format of celltype x spot

sample

a vector providing sample identifier for each cell. If not provided, we assume the data contain a metadata column "sample" for running scFeatures.

celltype

a vector providing celltype identifier. If not provided, we assume the data contain a metadata column "celltype" for running scFeatures.

assay

the assay identifier if using a SingleCellExperiment or SpatialExperiment object.

spatialCoords

the spatialCoords identifiers provided in a list of two vectors, if users want to construct features from the spatial category. If not provided, we assume the data contain the metadata columns "x_cord" and "y_cord" for constructing spatial features.

spotProbability

a matrix in the format of celltype x spot, where each entry is the prediction probability of that cell type for each spot. This is needed by spatial transcriptomics data.

Value

A Seurat dataset containing required metadata for running scFeatures.

Examples


 data("example_scrnaseq" , package = "scFeatures")
 data <- example_scrnaseq
 coordinate <- list(x = rep(1, ncol(data)), y = rep(1, ncol(data)))
 data <- makeSeurat(data, spatialCoords = coordinate)