RGLab / openCyto

A package that provides data analysis pipeline for flow cytometry.
GNU Affero General Public License v3.0
77 stars 29 forks source link

Extract Multiple Populations From GatingSet with getData API #170

Closed DillonHammill closed 6 years ago

DillonHammill commented 6 years ago

Hi Mike,

Just wondering whether it would be possible to extract multiple populations using the getData API?

I have 13 bead populations that I would like to look at fluorescence in PE channel, I can do this manually for each but this is tedious and time consuming.

Is there a more succinct way of doing this?

RANTES <- getData(gs,"RANTES") MIP3a <- getData(gs,"MIP3a") and so on..... to MDC <- getData(gs,"MDC")

# Then extract median fluorescence in PE channel for each RANTES.MFI <- fsApply(RANTES, function(fr) median(exprs(fr[,"PE-A]))) and so on .... to MDC.MFI <- fsApply(MDC, function(fr) median(exprs(fr[,"PE-A])))

image

Thanks for your help.

Dillon

SamGG commented 6 years ago

Hi, I don't know the answer, but with a little bit of programming you could ease your process.

populations <- c("RANTES", "MIP3a", and_so_on)
results <- NULL
for (pop in populations) {
  selection <- getData(gs, pop)
  MFI <- fsApply(selection, function(fr) median(exprs(fr[,"PE-A])))
  results <- cbind(results, MFI)
}
# check results is a data.frame or a matrix at the end
colnames(results) <- populations
rownames(results) <- get_the_fcs_names_here

HTH

DillonHammill commented 6 years ago

Thanks @SamGG that is perfect!

SamGG commented 6 years ago

You are welcome. Mike has probably a better solution.

mikejiang commented 6 years ago

Alternatively you can use cytoUtils::getStats if your goal is to retrieve the stats see https://support.bioconductor.org/p/98430/