Boolean Gate Combination for Any 2 Positive Events in flowWorkspace
1
0
Entering edit mode
Valeria • 0
@c260bf97
Last seen 4 months ago
United States

I am looking to get the number of events for different boolean combination of gates. For example, if looking at IFNg, TNFa, and IL2, I am interested in getting the number of events where any 2 are positive: (IFNg & TNFa) | (IFNg & IL2) | (TNFa & IL2),

would the equivalent of this be

bg <- booleanFilter(`IFNg & TNFa | IFNg & IL2 | TNFa & IL2`)
gs_pop_add(gs,bg,parent="4+", name = "Any2")
recompute(gs, "Any2")

I'm assuming I can't add parenthesis to explicitly showcase the order of events?

flowWorkspace FlowCytometry • 304 views
ADD COMMENT
0
Entering edit mode
Kevin Blighe ★ 4.0k
@kevin
Last seen 2 hours ago
The Cave, 181 Longwood Avenue, Boston, …

Your proposed code is correct and will achieve the desired outcome. The boolean filter expression IFNg & TNFa | IFNg & IL2 | TNFa & IL2 is parsed such that the ampersand operator has higher precedence than the pipe operator, resulting in the equivalent of (IFNg & TNFa) | (IFNg & IL2) | (TNFa & IL2). This captures events where any two of the three markers are positive, assuming that IFNg, TNFa, and IL2 refer to the appropriate gate names in your gating set.

You can add parentheses to the expression if you wish to make the order explicit, as in:

bg <- booleanFilter(`(IFNg & TNFa) | (IFNg & IL2) | (TNFa & IL2)`)
gs_pop_add(gs, bg, parent = "4+", name = "Any2")
recompute(gs, "Any2")

This will function identically to your original code. The flowCore package supports parentheses in boolean filter expressions for clarity or to override default precedence rules when needed.

To retrieve the event counts after recomputation, use gs_pop_get_stats(gs, "Any2") or a similar function from the flowWorkspace package.

Kevin

ADD COMMENT

Login before adding your answer.

Traffic: 960 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6