dropsim

Here dropsim method will be demonstrated clearly and hope that this document can help you.

Estimating parameters from a real dataset

Before simulating datasets, it is important to estimate some essential parameters from a real dataset in order to make the simulated data more real.

library(simmethods)
library(SingleCellExperiment)
# Load data
ref_data <- simmethods::data
estimate_result <- simmethods::dropsim_estimation(
  ref_data = ref_data,
  verbose = T,
  seed = 10
)
# Estimating parameters using dropsim

Simulating datasets using dropsim

After estimating parameter from a real dataset, we will simulate a dataset based on the learned parameters with different scenarios.

  1. Datasets with default parameters
  2. Determin the number of cells and genes

Datasets with default parameters

The reference data contains 160 cells and 4000 genes, if we simulate datasets with default parameters and then we will obtain a new data which has the same size as the reference data. In addtion, the simulated dataset will have one group of cells.

simulate_result <- simmethods::dropsim_simulation(
  parameters = estimate_result[["estimate_result"]],
  other_prior = NULL,
  return_format = "SCE",
  seed = 111
)
# nCells: 160
# nGenes: 4000
SCE_result <- simulate_result[["simulate_result"]]
dim(SCE_result)
# [1] 4000  160

Determin the number of cells and genes

In dropsim, we can set nCells and nGenes to specify the number of cells and genes.

Here, we simulate a new dataset with 1000 cells and 1000 genes:

simulate_result <- simmethods::dropsim_simulation(
  parameters = estimate_result[["estimate_result"]],
  return_format = "list",
  other_prior = list(nCells = 1000,
                     nGenes = 1000),
  seed = 111
)
# nCells: 1000
# nGenes: 1000
result <- simulate_result[["simulate_result"]][["count_data"]]
dim(result)
# [1] 1000 1000