merge_simulations | R Documentation |
we recommend to only merge simulations from the same dataset object, otherwise the count matrices might not correspond on the gene level
merge_simulations(simulation_list)
simulation_list |
a list of simulations |
named list; bulk
a SummarizedExperiment object, where the assays store the simulated bulk RNAseq datasets. Can hold either one or two assays, depending on how many matrices were present in the dataset
cell-fractions
is a dataframe with the simulated cell-fractions per sample;
scaling_vector
scaling value for each cell in dataset
counts <- Matrix::Matrix(matrix(rpois(3e5, 5), ncol = 300), sparse = TRUE)
tpm <- Matrix::Matrix(matrix(rpois(3e5, 5), ncol = 300), sparse = TRUE)
tpm <- Matrix::t(1e6 * Matrix::t(tpm) / Matrix::colSums(tpm))
colnames(counts) <- paste0("cell_", rep(1:300))
colnames(tpm) <- paste0("cell_", rep(1:300))
rownames(counts) <- paste0("gene_", rep(1:1000))
rownames(tpm) <- paste0("gene_", rep(1:1000))
annotation <- data.frame(
"ID" = paste0("cell_", rep(1:300)),
"cell_type" = c(
rep("T cells CD4", 50),
rep("T cells CD8", 50),
rep("Macrophages", 100),
rep("NK cells", 10),
rep("B cells", 70),
rep("Monocytes", 20)
)
)
dataset <- SimBu::dataset(
annotation = annotation,
count_matrix = counts,
tpm_matrix = tpm,
name = "test_dataset"
)
s1 <- SimBu::simulate_bulk(dataset,
scenario = "even",
scaling_factor = "NONE",
nsamples = 10,
ncells = 100
)
s2 <- SimBu::simulate_bulk(dataset,
scenario = "even",
scaling_factor = "NONE",
nsamples = 10,
ncells = 100
)
s <- SimBu::merge_simulations(list(s1, s2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.