R/package.R
dyngen.RdA toolkit for generating synthetic single cell data.
initialise_model(): Define and store settings for all following steps. See each of the sections below for more information.
Use a predefined backbone:
Create a custom backbone:
Visualise the backbone:
generate_tf_network(): Generate a transcription factor network from the backbone
tf_network_default(): Parameters for configuring this step
generate_feature_network(): Generate a target network
feature_network_default(): Parameters for configuring this step
plot_feature_network(): Visualise the gene network
generate_kinetics(): Generate the gene kinetics
kinetics_default(), kinetics_random_distributions(): Parameters for configuring this step
generate_gold_standard(): Simulate the gold standard backbone, used for mapping to cell states afterwards
gold_standard_default(): Parameters for configuring this step
plot_gold_mappings(): Visualise the mapping of the simulations to the gold standard
plot_gold_simulations(): Visualise the gold standard simulations using the dimred
plot_gold_expression(): Visualise the expression of the gold standard over simulation time
generate_cells(): Simulate the cells based on its GRN
simulation_default(): Parameters for configuring this step
simulation_type_wild_type(), simulation_type_knockdown(): Used for configuring the type of simulation
kinetics_noise_none(), kinetics_noise_simple(): Different kinetics randomisers to apply to each simulation
plot_simulations(): Visualise the simulations using the dimred
plot_simulation_expression(): Visualise the expression of the simulations over simulation time
generate_experiment(): Sample cells and transcripts from experiment
list_experiment_samplers(), experiment_snapshot(), experiment_synchronised(): Parameters for configuring this step
simtime_from_backbone(): Determine the simulation time from the backbone
plot_experiment_dimred(): Plot a dimensionality reduction of the final dataset
as_dyno(), wrap_dataset(): Convert a dyngen model to a dyno dataset
as_anndata(): Convert a dyngen model to an anndata dataset
as_sce(): Convert a dyngen model to a SingleCellExperiment dataset
as_seurat(): Convert a dyngen model to a Seurat dataset
generate_dataset(): Run through steps 2 to 8 with a single function
plot_summary(): Plot a summary of all dyngen simulation steps
example_model: A (very) small toy dyngen model, used for documentation and testing purposes
realcounts: A set of real single-cell expression datasets, to be used as reference datasets
realnets: A set of real gene regulatory networks, to be sampled in step 3
dyngen: This help page
get_timings(): Extract execution timings for each of the dyngen steps
combine_models(): Combine multiple dyngen models
rnorm_bounded(): A bounded version of rnorm()
runif_subrange(): A subrange version of runif()
model <- initialise_model(
backbone = backbone_bifurcating()
)
# \dontshow{
# actually use a smaller example
# to reduce execution time during
# testing of the examples
model <- initialise_model(
backbone = model$backbone,
num_cells = 5,
num_targets = 0,
num_hks = 0,
gold_standard_params = gold_standard_default(census_interval = 1, tau = 0.1),
simulation_params = simulation_default(
burn_time = 10,
total_time = 10,
census_interval = 1,
ssa_algorithm = ssa_etl(tau = 0.1),
experiment_params = simulation_type_wild_type(num_simulations = 1)
)
)
# }
# \donttest{
model <- model %>%
generate_tf_network() %>%
generate_feature_network() %>%
generate_kinetics() %>%
generate_gold_standard() %>%
generate_cells() %>%
generate_experiment()
#> Generating TF network
#> Sampling feature network from real network
#> Generating kinetics for 33 features
#> Generating formulae
#> Generating gold standard mod changes
#> Precompiling reactions for gold standard
#> Running gold simulations
#>
| | 0 % elapsed=00s
|======== | 14% elapsed=00s, remaining~00s
|=============== | 29% elapsed=00s, remaining~00s
|====================== | 43% elapsed=00s, remaining~00s
|============================= | 57% elapsed=00s, remaining~00s
|==================================== | 71% elapsed=00s, remaining~00s
|=========================================== | 86% elapsed=00s, remaining~00s
|==================================================| 100% elapsed=01s, remaining~00s
#> Precompiling reactions for simulations
#> Running 1 simulations
#> Mapping simulations to gold standard
#> Warning: Simulation does not contain all gold standard edges. This simulation likely suffers from bad kinetics; choose a different seed and rerun.
#> Performing dimred
#> Simulating experiment
#> Warning: Certain backbone segments are not covered by any of the simulations. If this is intentional, please ignore this warning.
#> Otherwise, increase the number of simulations (see `?simulation_default`) or decreasing the census interval (see `?simulation_default`).
dataset <- wrap_dataset(model, format = "dyno")
# format can also be set to "sce", "seurat", "anndata" or "list"
# library(dynplot)
# plot_dimred(dataset)
# }