checkBatchConsistency {batchelor} | R Documentation

## Check batch inputs

### Description

Utilities to check inputs into batch correction functions.

### Usage

    checkBatchConsistency(batches, cells.in.columns = TRUE)

    checkSpikeConsistency(batches)

    checkIfSCE(batches)

    checkRestrictions(batches, restrictions, cells.in.columns = TRUE)

### Arguments

`batches` | A list of batches, usually containing gene expression matrices or SingleCellExperiment objects.
`cells.in.columns` | A logical scalar specifying whether batches contain cells in the columns.
`restrictions` | A list of length equal to `batches`, specifying the cells in each batch that should be used for correction.

### Details

These functions are intended for internal use and other package developers.

`checkBatchConsistency` will check whether the input `batches` are consistent with respect to the size of the dimension containing features (i.e., not cells). It will also verify that the dimension names are consistent, to avoid problems from variable ordering of rows/columns in the inputs.

`checkSpikeConsistency` will check whether the spike-in information is consistent across all `batches`. This only works for SingleCellExperiment objects, so one should only run this function if `checkIfSCE` returns `TRUE`.

`checkRestrictions` will check whether `restrictions` are consistent with the supplied `batches`, in terms of the length and names of the two lists. It will also check that each batch contains at least one usable cell after restriction.

### Value

`checkBatchConsistency` and `checkSpikeConsistency` will return an invisible `NULL` if there are no errors.

`checkIfSCE` will return a logical vector specifying whether each element of `batches` is a SingleCellExperiment objects.

`checkRestrictions` will return `NULL` if `restrictions=NULL`. Otherwise, it will return a list by taking `restrictions` and converting each non-`NULL` element into an integer subsetting vector.

### Author(s)

Aaron Lun

### See Also

`divideIntoBatches`

### Examples

    checkBatchConsistency(list(cbind(1:5), cbind(1:5, 2:6)))
    try( # fails
        checkBatchConsistency(list(cbind(1:5), cbind(1:4, 2:5)))
    )

[Package batchelor version 1.2.4 Index]