ruvSimulate {scMerge} | R Documentation

## Simulate a simple matrix or SingleCellExperiment to test internals of scMerge

### Description

This function is designed to generate Poisson-random-variable data matrix to test on the internal algorithms of scMerge. It does not represent real biological situations and it is not intended to be used by end-users.

### Usage

    ruvSimulate(m = 100, n = 5000, nc = floor(n/2), nCelltypes = 3,
      nBatch = 2, k = 20, lambda = 0.1, sce = FALSE)

### Arguments

`m` | Number of observations
`n` | Number of features
`nc` | Number of negative controls
`nCelltypes` | Number of cell-types
`nBatch` | Number of batches
`k` | Number of unwanted factors in simulation
`lambda` | Rate parameter for random Poisson generation
`sce` | If `TRUE`, returns a SingleCellExperiment object

### Value

If `sce` is FALSE, then the output is a list consists of

- Y, expression matrix generated through Poisson random variables,

- ctl, a logical vector indicating the control genes,

- M, replicate mapping matrix,

- cellTypes, a vector indicating simulated cell types

- batch, a vector indicating simulated batches

if `sce` is TRUE, a SingleCellExperiment wrapper will be applied on all above simulated objects.

### Examples

    set.seed(1)
    L = ruvSimulate(m = 200, n = 1000, nc = 200,
    nCelltypes = 3, nBatch = 2, lambda = 0.1, k = 10, sce = TRUE)
    print(L)
    example <- scMerge(sce_combine = L,
                          ctl = paste0('gene', 1:500),
                          cell_type = L$cellTypes,
                          ruvK = 10,
                          assay_name = 'scMerge')

    scater::plotPCA(L, colour_by = 'cellTypes', shape = 'batch',
                     run_args = list(exprs_values = 'logcounts'))

    scater::plotPCA(example, colour_by = 'cellTypes', shape = 'batch',
                     run_args = list(exprs_values = 'scMerge'))

[Package scMerge version 1.0.0 Index]