SeuratToExpressionSet: Converts Seurat object to Expression Set

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

'SeuratToExpressionSet()' returns an Expression Set with phenotype data indicating cell type (cellType) and individual (SubjectName) for each cell in a Seurat object. Raw counts data is used for assay data.

Usage

1
2
3
4
5
6
SeuratToExpressionSet(
  seurat.object,
  delimiter,
  position,
  version = c("v2", "v3")
)

Arguments

seurat.object

Seurat object with attributes raw.data, ident, and cell.names

delimiter

Character to split cell names with to find individual ID.

position

Integer indicating 1-indexed position of individual ID after splitting cell name with delimiter.

version

Character string. Either "v2" or "v3. Seurat version used to create Seurat object.

Details

Note that the Seurat and Biobase libraries should be attached before running this function. The delimiter and position arguments are used to infer the individual ID from the cell ID. For example, a delimiter of "-" and position of "2" indicates that the individual ID for the cell ID ACTG-2 would be 2.

Value

sc.eset Expression set containing relevant phenotype and individual data, cellType and SubjectName.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
  library(Seurat)
  library(Biobase)

  # We make a class to emulate a Seurat v2 object for illustration only
  setClass("testSeuratv2", representation(cell.names = "character",
                                          ident = "character",
                                          raw.data = "matrix"))
  sc.counts <- matrix(0,nrow=3,ncol=3)
  # These barcodes correspond to a delimiter of "-" and position 2 for individual id.
  test.cell.names <- c("ATCG-1", "TAGC-2", "GTCA-3")
  test.ident <- c("cell type a", "cell type b", "cell type c")
  names(test.ident) <- test.cell.names
  colnames(sc.counts) <- test.cell.names
  test.seurat.obj <- new("testSeuratv2",
                         cell.names=test.cell.names,
                         ident=test.ident,
                         raw.data=sc.counts)

  single.cell.expression.set <- SeuratToExpressionSet(test.seurat.obj, delimiter='-',
                                                      position=2, version="v2")

BisqueRNA documentation built on May 24, 2021, 1:06 a.m.