Currently the splatter method estimates parameters from each cell type and simulates them separately. The different simulated datasets are them combined.
|
simulated_result <- NULL |
|
for (spatial_cluster in unique(input_ordered$obs[["spatial_cluster"]])) { |
|
res <- try({ |
|
input_spatial_cluster <- input_ordered[input_ordered$obs[["spatial_cluster"]] == spatial_cluster] |
|
params <- splatter::splatEstimate(as.matrix(t(input_spatial_cluster$layers[["counts"]]))) |
|
sim_spatial_cluster <- splatter::splatSimulate(params) |
|
sim_spatial_cluster$spatial_cluster <- spatial_cluster |
|
colnames(sim_spatial_cluster) <- paste0(spatial_cluster, colnames(sim_spatial_cluster)) |
|
names(rowData(sim_spatial_cluster)) <- paste(spatial_cluster, names(rowData(sim_spatial_cluster))) |
|
|
|
# combine the cell types |
|
if (is.null(simulated_result)) { |
|
simulated_result <- sim_spatial_cluster |
|
} else { |
|
simulated_result <- SingleCellExperiment::cbind(simulated_result, sim_spatial_cluster) |
|
} |
|
}) |
|
} |
This seems like a sensible approach but it will result in an inconsistent final dataset because the simulations for each cell type are completely independent. This means that the simulated "Gene1" for cell type A has no relationship to "Gene1" for cell type B and the two cell type can not be combined.
Currently the
splattermethod estimates parameters from each cell type and simulates them separately. The different simulated datasets are them combined.task_spatial_simulators/src/methods/splatter/script.R
Lines 26 to 43 in cd39dd4
This seems like a sensible approach but it will result in an inconsistent final dataset because the simulations for each cell type are completely independent. This means that the simulated "Gene1" for cell type A has no relationship to "Gene1" for cell type B and the two cell type can not be combined.