scDesign2_simulation | R Documentation |
This function is used to simulate datasets from learned parameters by simulate_count_scDesign2
function in scDesign2 package.
scDesign2_simulation(
parameters,
other_prior = NULL,
return_format,
verbose = FALSE,
seed
)
parameters |
A object generated by |
other_prior |
A list with names of certain parameters. Some methods need
extra parameters to execute the estimation step, so you must input them. In
simulation step, the number of cells, genes, groups, batches, the percent of
DEGs are usually customed, so before simulating a dataset you must point it out.
See |
return_format |
A character. Alternative choices: list, SingleCellExperiment,
Seurat, h5ad. If you select |
verbose |
Logical. Whether to return messages or not. |
seed |
A random seed. |
In addtion to simulate datasets with default parameters, users want to simulate other kinds of datasets, e.g. a counts matrix with 2 or more cell groups. In scDesign2, you can set extra parameters to simulate datasets.
The customed parameters you can set are below:
nCells. In scDesign2, You can directly set other_prior = list(nCells = 5000)
to simulate 5000 cells.
prob.group. You can directly set other_prior = list(prob.group = c(0.4, 0.6))
to assign two proportions of cell groups. Note that the the length of the vector must equal to the groups or types that users input in estimation step.
For more customed parameters in scDesign2, please check scDesign2::simulate_count_scDesign2()
.
Sun T, Song D, Li W V, et al. scDesign2: a transparent simulator that generates high-fidelity single-cell gene expression count data with gene correlations captured. Genome biology, 2021, 22(1): 1-37. https://doi.org/10.1186/s13059-021-02367-2
Github URL: https://github.com/JSB-UCLA/scDesign2
## Not run:
ref_data <- simmethods::data
## cell groups
group_condition <- as.numeric(simmethods::group_condition)
## In scDesign2, cell group information is not neccessary which indicates the type
## that each cell belongs to.
estimate_result <- simmethods::scDesign2_estimation(
ref_data = ref_data,
other_prior = list(group.condition = group_condition),
verbose = TRUE,
seed = 111
)
## Simulate 1000 cells (40% in Group1, 60% in Group2)
simulate_result <- simmethods::scDesign2_simulation(
parameters = estimate_result[["estimate_result"]],
other_prior = list(nCells = 1000,
prob.group = c(0.4, 0.6)),
return_format = "list",
verbose = TRUE,
seed = 111
)
## counts
counts <- simulate_result[["simulate_result"]][["count_data"]]
dim(counts)
## cell information
col_data <- simulate_result[["simulate_result"]][["col_meta"]]
table(col_data$group)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.