Spike-in methods {SingleCellExperiment} | R Documentation

## Spike-in methods

### Description

Gets or sets the rows corresponding to spike-in transcripts.

Note: these methods have been deprecated in favour of storing spike-in information as alternative Experiments, see `altExps` for details.

### Usage

    ## S4 method for signature 'SingleCellExperiment,character'
    isSpike(x, type)

    ## S4 method for signature 'SingleCellExperiment,missing'
    isSpike(x, type)

    ## S4 method for signature 'SingleCellExperiment,NULL'
    isSpike(x, type)

    ## S4 replacement method for signature 'SingleCellExperiment,character'
    isSpike(x, type) <- value

    ## S4 method for signature 'SingleCellExperiment'
    clearSpikes(x)

    ## S4 method for signature 'SingleCellExperiment'
    spikeNames(x)

### Arguments

`x` | A SingleCellExperiment object.
`type` | A string containing the name of the spike-in set.
`value` | A vector indicating which rows correspond to spike-in transcripts.

### Details

Spike-in transcripts may be added during library preparation in single-cell RNA sequencing experiments. These usually need to be handled differently during data analysis, compared to the endogenous genes. Thus, it is important to indicate which rows correspond to spike-in transcripts.

The `isSpike<-` method accepts any `value` that indicates which rows correspond to spike-ins. This can be a logical or integer subsetting vector, or a vector of row names. The `type` should be set to the name of the spike-in set, e.g., `"ERCC"` or `"SIRV"`.

In this manner, multiple types of spike-in sets are supported for a single experiment. This is useful not only when different spike-ins are used, but also for different mixtures of the same set (e.g., ERCC mixes 1 and 2). The names of all available spike-in sets can be obtained using `spikeNames`.

To remove spike-ins for a particular set, `value` should be set to `NULL` when using `isSpike<-`. To remove all spike-in information, `clearSpikes` should be used to obtain a new SingleCellExperiment object with no spike-ins specified.

In previous versions (<= 1.1.1), if `value` was `NULL` in `isSpike<-`, all existing spike-in sets would be removed. This behaviour is now deprecated, and `clearSpikes` should be used instead. Also, if `type` was missing or `NULL` for `isSpike<-`, the spike-in set would be automatically assigned an empty name. This is also deprecated, and all spike-ins should be given a user-supplied name.

The `isSpike` getter methods will return a logical vector indicatng which rows represent spike-ins of the set specified by `type`. If `type` is missing or `NULL`, the vector will instead indicate whether each row is in any spike-in set. If `type` is specified but not available, an error will be raised.

### Value

For `isSpike`, a logical vector is returned indicating whether each row is in the specified set `type` or any set.

For `isSpike<-`, a SingleCellExperiment is returned with spike-in information stored in the internal metadata fields.

For `spikeNames`, a character vector is returned containing the names of available spike-in sets.

For `clearSpikes`, a SingleCellExperiment is returned with no spike-in information.

### Author(s)

Aaron Lun

### See Also

`SingleCellExperiment-class`

### Examples

    example(SingleCellExperiment, echo=FALSE) # Using the class example
    isSpike(sce, "ERCC") <- 1:10
    isSpike(sce)

    isSpike(sce, "SIRV") <- 11:20
    spikeNames(sce)
    which(isSpike(sce))
    which(isSpike(sce, "SIRV"))

    isSpike(sce, "ERCC") <- NULL
    spikeNames(sce)

[Package SingleCellExperiment version 1.8.0 Index]