newBASiCS_Data {BASiCS} | R Documentation

## 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 = rep(FALSE, nrow(Counts)),
      SpikeInfo = NULL, BatchInfo = NULL, SpikeType = "ERCC")

### 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. Defaul value: `Tech = rep(FALSE, nrow(Counts))`.
`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. If `SpikeInfo = NULL`, only the horizontal integration implementation (no spikes) can be run. Default value: `SpikeInfo = NULL`.
`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`.
`SpikeType` | Character to indicate what type of spike-ins are in use. For more details see argument 'type' in see 'help(isSpike, package = "SingleCellExperiment")'. Default value: `SpikeType = "ERCC"`.

### Value

An object of class `SingleCellExperiment`.

### Author(s)

Catalina A. Vallejos cnvallej@uc.cl

Nils Eling eling@ebi.ac.uk

### See Also

`SingleCellExperiment`

### Examples

    ## Data with spike-ins

    # Expression counts
    set.seed(1)
    Counts <- matrix(rpois(50*10, 2), ncol = 10)
    rownames(Counts) <- c(paste0('Gene', 1:40), paste0('ERCC', 1:10))
    # Technical information
    Tech <- grepl("ERCC", rownames(Counts))
    # 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 = Tech, SpikeInfo = SpikeInfo)

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

    ## Data without spike-ins (BatchInfo is required)

    # Expression counts
    set.seed(1)
    Counts <- matrix(rpois(50*10, 2), ncol = 10)
    rownames(Counts) <- paste0('Gene', 1:50)
    BatchInfo <- c(rep(1, 5), rep(2, 5))

    # Creating a BASiCS_Data object (with batch effect)
    DataExample <- newBASiCS_Data(Counts, BatchInfo = BatchInfo)

[Package BASiCS version 1.6.0 Index]