# Simulate Single Cell Analysis Pipeline Expression

Source: `R/Flow.R`
`simulateFlow.Rd`

Blabla

    simulateFlow(n1=c(20,50,100), n2=c(30,60,120),
    sim.settings,
    DEmethod,
    normalisation,
    Preclust=FALSE,
    Prefilter = NULL,
    Impute = NULL,
    DEFilter = FALSE,
    GeneSelect=NULL,
    DimReduce=NULL,
    ClustMethod=NULL,
    Pipeline=NULL,
    spikeIns=FALSE,
    NCores=NULL,
    verbose=TRUE)

## Arguments

n1, n2 | Integer vectors specifying the number of biological replicates in each group. Default values are n1=c(20,50,100) and n2=c(30,60,120).
sim.settings | This object specifies the simulation setup. This must be the return object from `SimSetup`.
DEmethod | A character vector specifying the DE detection method to be used. Please consult the Details section for available options.
normalisation | Normalisation method to use. Please consult the Details section for available options.
Preclust | A logical vector indicating whether to run a hierarchical clustering prior to normalisation. This is implemented for scran only. Default is `FALSE`. For details, see `quickCluster`.
Prefilter | A character vector specifying the gene expression filtering method to be used prior to normalisation (and possibly imputation). Default is `NULL`, i.e. no filtering. Please consult the Details section for available options.
Impute | A character vector specifying the gene expression imputation method to be used prior to normalisation. Default is `NULL`, i.e. no imputation. Please consult the Details section for available options.
DEFilter | A logical vector indicating whether to run DE testing on filtered and/or imputed count data. Default is `FALSE`.
GeneSelect | A character vector specifying the gene selection method. Default is `NULL`, i.e. no gene selection. Availabe options are: HVG, Gini-Index.
DimReduce | A character vector specifying the dimension reduction method. Default is `NULL`, i.e. no dimension reduction. Availabe options are: Euclidean, Spearman, PCA, t-SNE-expr, t-SNE-Euclidean, PCA+t-SNE, CIDR.
ClustMethod | A character vector specifying the clustering method. Default is `NULL`, i.e. no clustering. Availabe options are: kmeans, PAM.
Pipeline | A character vector specifying out-of-the-box single cell clustering pipelines. Available options are: CIDR_free and CIDR_bound.
spikeIns | Logical value to indicate whether to simulate spike-ins. Default is `FALSE`.
NCores | integer positive number of cores for parallel processing, default is `NULL`, ie 1 core.
verbose | Logical value to indicate whether to show progress report of simulations. Default is `TRUE`.

## Value

A list with the following fields:

pvalue, fdr

  3D array (ngenes * N * nsims) for p-values and FDR from each simulation. Note that FDR values will be empty and the calculation will be done by `evaluateDE` whenever applicable.

mu,disp,dropout

  3D (ngenes * N * nsims) array for mean, dispersion and dropout of library size factor normalized read counts.

elfc,rlfc

  3D array (ngenes * N * nsims) for log2 fold changes (LFC): elfc is for the DE tool estimated LFC; rlfc is for the LFC estimated from the normalised read counts.

sf.values,gsf.values

  3D array (ngenes * N * nsims) for size factor estimates. Global estimates per sample in sf.values; Gene- and sample-wise estimates in gsf.values only for SCnorm normalisation.

true.designs,def.designs

  3D array (ngenes * N * nsims) for group assignment specifications. true.designs for the simulated group assignment; def.designs for the group assignment determined after clustering.

sim.settings

  The input sim.settings to which the specifications of `simulateDE` is added.

time.taken

  The time taken for each simulation, given for preprocessing, normalisation, clustering, differential expression testing and moment estimation.

## See also

`estimateParam`, `insilicoNBParam` for negative binomial parameter specifications;
`DESetup`, `SimSetup` for simulation setup

## Examples

    # NOT RUN {
    ## not yet
    # }