Question: How to find Geometric Mean from gated Quantibeads
0
gravatar for justinyi10
2.3 years ago by
justinyi1010
justinyi1010 wrote:

Is there a way to find the geometric means of different fluorescence intensities that arise when gating quantibeads in Bioconductor?

flowworkspace opencyto • 838 views
ADD COMMENTlink modified 2.3 years ago by Jiang, Mike1.2k • written 2.3 years ago by justinyi1010
Answer: How to find Geometric Mean from gated Quantibeads
1
gravatar for Jiang, Mike
2.3 years ago by
Jiang, Mike1.2k
(Private Address)
Jiang, Mike1.2k wrote:

With `cytoUtils::getStats`, you can pass in your own customized function, it will receive a `flowFrame` object as the input, from which you can extract the fluorescence intensity matrix, and then do whatever calculation you want, in this case, 

geometric.means <- function(fr){
   chnls <- colnames(fr)
   res <- apply(exprs(fr), 2, function(x)exp(mean(log(x))))
   names(res) <- chnls
   res
   }
getStats(gs, nodes, type = geometric.means)
ADD COMMENTlink written 2.3 years ago by Jiang, Mike1.2k

How would you extract the fluorescence intensity matrix?

ADD REPLYlink modified 2.3 years ago • written 2.3 years ago by justinyi1010
1

geometric.means is the name of customised function. fr is the name of its unique argument. As stated by Mike, getStats sends a flowFrame to geometric.means while getStats goes through.the workspace alias gs. Within the code of geometric.means, fr is the name of the variable that contains the flowFrame of the selected events. You can simply get the intensity matrix using the function exprs as shown in the code from Mike as exprs(fr).

HTH

ADD REPLYlink written 2.3 years ago by SamGG190

After using the customized function above on my quantibead sample, I get the warning message below. Why would this be? Also, the geometric means seem to be way out of the expected range (comparing against the flow cytometer software). Does the function above return the geometric mean of the number of cells with a certain fluorescence intensity (there should be four)?

1. In log(x) : NaNs produced

ADD REPLYlink written 2.3 years ago by justinyi1010

This might help you to answer and improve the function.

> log(0)
[1] -Inf
> log(-1)
[1] NaN
Warning message:
In log(-1) : NaNs produced

 

ADD REPLYlink written 2.3 years ago by SamGG190
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 224 users visited in the last hour