Skip to content

Features in splatter simulation will be inconsistent #13

@lazappi

Description

@lazappi

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions