DillonHammill / CytoExploreR

Interactive Cytometry Data Analysis
59 stars 12 forks source link

cyto_plot computed stats look off #201

Open Biomiha opened 2 months ago

Biomiha commented 2 months ago

Hi Dillon,

I've noticed that the stats that are plotted with cyto_plot don't actually correspond to the stats obtained by cyto_stats_compute for the same gates. I've used the prebundled GatingSet that comes with flowWorkspace as a test:

library(flowWorkspace)
dataDir <- system.file("extdata",package="flowWorkspaceData")
gs_archive <- list.files(dataDir, pattern = "gs_bcell_auto",full = TRUE)
gs <- load_gs(gs_archive)

cyto_plot(gs, parent = "Live", alias = "CD19", channels = c("CD19", "CD3"))

# Contrast this to ggcyto
autoplot(gs, gate = "CD19", bins = 128)

# The computed values correspond to the ones plotted by ggcyto
cyto_stats_compute(x = gs, parent = "Live", alias = "CD19", stat = "percent")

image image

Any idea why the stats computation within cyto_plot looks a bit off? Thanks

DillonHammill commented 1 month ago

cyto_plot() down samples to 50000 events by default so the stats will vary slightly. The stats should be the same if you set events =1 to display all the events.