Learn R Programming

BASiCS (version 1.1.0)

newBASiCS_Data: Creates a SingleCellExperiment object from a matrix of expression counts and experimental information about spike-in genes

Description

newBASiCS_Data creates a '>SingleCellExperiment object from a matrix of expression counts and experimental information about spike-in genes.

Usage

newBASiCS_Data(Counts, Tech, SpikeInfo, BatchInfo = NULL)

Arguments

Counts

Matrix of dimensions q times n whose elements contain the expression counts to be analyses (including biological and technical spike-in genes). Gene names must be stored as rownames(Counts).

Tech

Logical vector of length q. If Tech = FALSE the gene is biological; otherwise the gene is spike-in.

SpikeInfo

data.frame whose first and second columns contain the gene names assigned to the spike-in genes (they must match the ones in rownames(Counts)) and the associated input number of molecules, respectively.

BatchInfo

Vector of length n whose elements indicate batch information. Not required if a single batch is present on the data. Default value: BatchInfo = NULL.

Value

An object of class '>SingleCellExperiment.

References

Vallejos, Marioni and Richardson (2015). PLoS Computational Biology.

See Also

'>SingleCellExperiment

Examples

Run this code
# NOT RUN {
# Expression counts
set.seed(1)
Counts <- matrix(rpois(50*10, 2), ncol = 10)
rownames(Counts) <- c(paste0('Gene', 1:40), paste0('Spike', 1:10))

# Technical information
Tech <- c(rep(FALSE,40),rep(TRUE,10))

# Spikes input number of molecules
set.seed(2)
SpikeInfo <- data.frame(gene=rownames(Counts)[Tech],amount=rgamma(10,1,1))

# Creating a BASiCS_Data object (no batch effect)
DataExample <- newBASiCS_Data(Counts, Tech, SpikeInfo)

# Creating a BASiCS_Data object (with batch effect)
BatchInfo <- c(rep(1, 5), rep(2, 5))
DataExample <- newBASiCS_Data(Counts, Tech, SpikeInfo, BatchInfo)

# }

Run the code above in your browser using DataLab