Description Usage Arguments Details Value See Also Examples
This function simulates pure and mixed cell-type expression data for two cell types, namely T and N. The simulation is based on multivariate normal (MVN) distribution.
1 2 3 4 5 | oneStepSim(n.samp, mu.T, mu.N, Sigma.T=NULL, Sigma.N=NULL, prop.T="seq",
# structure for Sigma.T
block.size, rho, dd=NULL, str.type="interchangeable",
# selected genes to add structure
select.gene="first")
|
n.samp |
number of samples to simulate for each cell type. |
mu.T |
mean vector for cell type T. |
mu.N |
mean vector for cell type N. |
Sigma.T |
covariance matrix for cell type T. If |
Sigma.N |
covariance matrix for cell type N. If |
prop.T |
a vector of mixing proportions for cell type T. Options: |
block.size |
see |
rho |
see |
dd |
see |
str.type |
see |
select.gene |
select which genes to add special structures on. Note that |
The function takes the mean expression of each cell type at the log2-transformed scale and mixes the cell types in the raw scale (i.e. 2^x). If covariance matrices are not given, by default, the function generates an identity matrix for Sigma.N
; and Sigma.T
can be customized using corresponding arguments. Mixing proportion of cell type T is required; cell type N takes the complementary proportion. Pure cell-type samples are simulated from MVN; after mixing, the mixed samples are log2-transformed.
All MVN simulated expression data are forced to be non-negative by replacing negative values with zero. All simulated samples are quantile normalized by normalize.quantiles()
from the preprocessCore
package.
A list with the following components:
m.gene |
number of genes. |
Sigma.T |
covariance matrix of cell type T. |
Sigma.N |
covariance matrix of cell type N. |
true.str.T |
true structure in generated |
expr.pure.T |
expression matrix for pure cell type T. |
expr.pure.N |
expression matrix for pure cell type N. |
expr.mixed |
expression matrix for mixed cell types. |
prop.T |
true proportions of cell type T in mixed samples. |
See sim.expr
and generate.Sigma
for more intermediate details.
rmvnorm
from the mvtnorm
package is used for simulate random MVN samples.
normalize.quantiles
from the preprocessCore
package is used for quantile normalization.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## load cell type data
set.seed(999)
data("celltype")
mu.T <- expr[,ctab$Fastq_file_name[which(ctab$X3_letter_code=="ASM")]]
mu.N <- expr[,ctab$Fastq_file_name[which(ctab$X3_letter_code=="AEC")]]
## number of samples to simulate
n.samp <- 5
## parameters for correlation design of cell type T
rho <- c(0.9,0.8,0.7)
block.size <- c(5,10,15)
str.type <- c("interchangeable","decaying","star")
select.gene <- "DEG"
## mixing proportion of cell type T
prop.T <- runif(n.samp)
## one-step simulation
out.oneStepSim <- oneStepSim(n.samp, mu.T, mu.N, Sigma.T=NULL, Sigma.N=NULL, prop.T=prop.T,
# structure for Sigma.T
dd=NULL, rho=rho, block.size=block.size, str.type=str.type,
# selected genes to add structure
select.gene=select.gene)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.