Skip to content

Instantly share code, notes, and snippets.

@soh-i
Created January 30, 2020 07:37
Show Gist options
  • Select an option

  • Save soh-i/dc5ecf456ddb5ca12c1f95fe1b142cd4 to your computer and use it in GitHub Desktop.

Select an option

Save soh-i/dc5ecf456ddb5ca12c1f95fe1b142cd4 to your computer and use it in GitHub Desktop.
Plot gate and event data from fcs and gating_ml.xml files
library(CytoML)
library(flowWorkspace)
library(ggcyto)
fcsFiles <- list.files(pattern='.fcs', path='./FCS/data_path_dir', full.names=TRUE)
xmlfile <- 'Gate.xml'
gs <- cytobank2GatingSet(xmlfile, fcsFiles)
g <- ggcyto(gs, aes(x='FITC-A', y='FSC-A'), subset="P1") +
geom_hex(bins=128) +
geom_gate(c("P2"), colour='deeppink') +
geom_stats(type='percent', digits=2, fill=NA, adjust=0.8) +
axis_x_inverse_trans() +
axis_y_inverse_trans() +
scale_x_logicle(t=100000) +
scale_y_continuous(limits=c(0, 150000)) +
ggcyto_par_set(limits = "instrument") +
labs(x='EGFP intensity', y='Forward scatter') +
theme_bw() +
theme(
strip.background=element_rect(colour=NA, fill=NA),
panel.grid.minor=element_blank(),
aspect.ratio=1)
ggsave(plot=g, filename='FCS_plot.pdf', w=6, h=3)
@soh-i
Copy link
Author

soh-i commented Jan 30, 2020

SS 2020-01-30 at 16 37 40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment