Description Usage Arguments Details Value Author(s) References Examples
Simulation of complex scRNA-seq data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
x |
a |
nc, ns, nk |
# of cells, samples and clusters to simulate. |
probs |
a list of length 3 containing probabilities of a cell belonging to each cluster, sample, and group, respectively. List elements must be NULL (equal probabilities) or numeric values in [0, 1] that sum to 1. |
p_dd |
numeric vector of length 6. Specifies the probability of a gene being EE, EP, DE, DP, DM, or DB, respectively. |
paired |
logical specifying whether a paired design should be simulated (both groups use the same set of reference samples) or not (reference samples are drawn at random). |
p_ep, p_dp, p_dm |
numeric specifying the proportion of cells to be shifted to a different expression state in one group (see details). |
p_type |
numeric. Probability of EE/EP gene being a type-gene. If a gene is of class "type" in a given cluster, a unique mean will be used for that gene in the respective cluster. |
lfc |
numeric value to use as mean logFC (logarithm base 2) for DE, DP, DM, and DB type of genes. |
rel_lfc |
numeric vector of relative logFCs for each cluster.
Should be of length |
phylo_tree |
newick tree text representing cluster relations
and their relative distance. An explanation of the syntax can be found
here.
The distance between the nodes, except for the original branch, will be
translated in the number of shared genes between the clusters belonging to
these nodes (this relation is controlled with |
phylo_pars |
vector of length 2 providing the parameters that control the number of type genes. Passed to an exponential PDF (see details). |
ng |
# of genes to simulate. Importantly, for the library sizes
computed by |
force |
logical specifying whether to force
simulation despite |
simData
simulates multiple clusters and samples
across 2 experimental conditions from a real scRNA-seq data set.
The simulation of type genes can be performed in 2 ways;
(1) via p_type
to simulate independant clusters, OR
(2) via phylo_tree
to simulate a hierarchical cluster structure.
For (1), a subset of p_type
% of genes are selected per cluster
to use a different references genes than the remainder of clusters,
giving rise to cluster-specific NB means for count sampling.
For (2), the number of shared/type genes at each node
are given by a*G*e^(-b*d)
, where
a
– controls the percentage of shared genes between nodes.
By default, at most 10% of the genes are reserved as type genes
(when b
= 0). However, it is advised to tune this parameter
depending on the input prep_sce
.
b
– determines how the number of shared genes
decreases with increasing distance d between clusters
(defined through phylo_tree
).
a SingleCellExperiment
containing multiple clusters & samples across 2 groups
as well as the following metadata:
colData(.)
)a DataFrame
containing,
containing, for each cell, it's cluster, sample, and group ID.
rowData(.)
)a DataFrame
containing,
for each gene, it's class
(one of "state", "type", "none") and
specificity (specs
; NA for genes of type "state", otherwise
a character vector of clusters that share the given gene).
metadata(.)
)experiment_info
a data.frame
summarizing the experimental design.
n_cells
the number of cells for each sample.
gene_info
a data.frame
containing, for each gene
in each cluster, it's differential distribution category
,
mean logFC
(NA for genes for categories "ee" and "ep"),
gene used as reference (sim_gene
), dispersion sim_disp
,
and simulation means for each group sim_mean.A/B
.
ref_sids/kidskids
the sample/cluster IDs used as reference.
args
a list of the function call's input arguments.
Helena L Crowell & Anthony Sonrel
Crowell, HL, Soneson, C, Germain, P-L, Calini, D, Collin, L, Raposo, C, Malhotra, D & Robinson, MD: On the discovery of population-specific state transitions from multi-sample multi-condition single-cell RNA sequencing data. bioRxiv 713412 (2018). doi: https://doi.org/10.1101/713412
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | data(sce)
library(SingleCellExperiment)
# prep. SCE for simulation
ref <- prepSim(sce)
# simulate data
(sim <- simData(ref, nc = 200,
p_dd = c(0.9, 0, 0.1, 0, 0, 0),
ng = 100, force = TRUE,
probs = list(NULL, NULL, c(1, 0))))
# simulation metadata
head(gi <- metadata(sim)$gene_info)
# should be ~10% DE
table(gi$category)
# unbalanced sample sizes
sim <- simData(ref, nc = 100, ns = 2,
probs = list(NULL, c(0.25, 0.75), NULL),
ng = 10, force = TRUE)
table(sim$sample_id)
# one group only
sim <- simData(ref, nc = 100,
probs = list(NULL, NULL, c(1, 0)),
ng = 10, force = TRUE)
levels(sim$group_id)
# HIERARCHICAL CLUSTER STRUCTURE
# define phylogram specifying cluster relations
phylo_tree <- "(('cluster1':0.1,'cluster2':0.1):0.4,'cluster3':0.5);"
# verify syntax & visualize relations
library(phylogram)
plot(read.dendrogram(text = phylo_tree))
# let's use a more complex phylogeny
phylo_tree <- "(('cluster1':0.4,'cluster2':0.4):0.4,('cluster3':
0.5,('cluster4':0.2,'cluster5':0.2,'cluster6':0.2):0.4):0.4);"
plot(read.dendrogram(text = phylo_tree))
# simulate clusters accordingly
sim <- simData(ref,
phylo_tree = phylo_tree,
phylo_pars = c(0.1, 3),
ng = 500, force = TRUE)
# view information about shared 'type' genes
table(rowData(sim)$class)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.