sparseDCEstimate: Estimate SparseDC simulation parameters

Description Usage Arguments Details Value Examples

View source: R/sparseDC-estimate.R

Description

Estimate simulation parameters for the SparseDC simulation from a real dataset.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
sparseDCEstimate(
  counts,
  conditions,
  nclusters,
  norm = TRUE,
  params = newSparseDCParams()
)

## S3 method for class 'SingleCellExperiment'
sparseDCEstimate(
  counts,
  conditions,
  nclusters,
  norm = TRUE,
  params = newSparseDCParams()
)

## S3 method for class 'matrix'
sparseDCEstimate(
  counts,
  conditions,
  nclusters,
  norm = TRUE,
  params = newSparseDCParams()
)

Arguments

counts

either a counts matrix or an SingleCellExperiment object containing count data to estimate parameters from.

conditions

numeric vector giving the condition each cell belongs to.

nclusters

number of cluster present in the dataset.

norm

logical, whether to library size normalise counts before estimation. Set this to FALSE if counts is already normalised.

params

PhenoParams object to store estimated values in.

Details

The nGenes and nCells parameters are taken from the size of the input data. The counts are preprocessed using pre_proc_data and then parameters are estimated using sparsedc_cluster using lambda values calculated using lambda1_calculator and lambda2_calculator.

See SparseDCParams for more details on the parameters.

Value

SparseParams object containing the estimated parameters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
if (requireNamespace("SparseDC", quietly = TRUE)) {
    # Load example data
    library(scater)
    set.seed(1)
    sce <- mockSCE(ncells = 20, ngenes = 100)

    conditions <- sample(1:2, ncol(sce), replace = TRUE)

    params <- sparseDCEstimate(sce, conditions, nclusters = 3)
    params
}

splatter documentation built on Dec. 3, 2020, 2:01 a.m.