On boolean combinations (flowWorkspace)
0
0
Entering edit mode
Jiang, Mike ★ 1.3k
@jiang-mike-4886
Last seen 23 days ago
(Private Address)

Three ways of doing this:

1. add a boolean gate to the existing GatingSet

    #say you want a combination of cytokine gates: '4+/IFNg', '4+/TNFa', '4+/IL2'
    #simply construct a booleanFilter object
    boolgate <- booleanFilter(`4+/IFNg & 4+/TNFa & 4+/IL2`)
    #  or
    char2booleanFilter("4+/IFNg & 4+/TNFa & 4+/IL2") # takes a character as input which is more programmatic
    #then add to GatingSet, if name is not supplied, then the entire expression string is used to name the new gate

    add(gs, boolgate, parent="4+", name = "myBool")
    #compute the gate
    recompute(gs, "myBool")
    #get the count
    getTotal(gs, "myBool")
    #delete the gate if it is no longer needed
    Rm("myBool", gs)

2. or there is one wrapper function does all the above steps in one call
     

    #calculate boolean indices
       ind.list <- getIndices(gs,quote(`4+/IFNg & 4+/TNFa & 4+/IL2`))
       #count the events
       count <- lapply(ind.list, function(ind)length(which(ind)))

3. if you don't like the idea of adding new gates, you can grab the event indices from each gate and do the boolean operations on them

    #get indices for each gate
    ind1.list <- getIndice((gs, 'cd4/IFNg')
    ind2.list <- getIndice((gs, 'cd4/TNFa')
    ind3.list <- getIndice((gs, 'cd4/IL2')
    #combine these indices
    ind.list <- mapply(ind1.list, ind2.list, ind3.list, FUN = function(ind1, ind2,ind3)ind1&ind2&ind3)
    #count events
    count <- lapply(ind.list, function(ind)length(which(ind)))

On 05/29/2015 02:29 AM, John Aponte wrote:

Dear Mike,

We would need to calculate the number of events for boolean combination of gates. I wonder if you could guide me on how this numbers can be obtained?

Best regards

JJ

 

--

John J. Aponte

flowworkspace flow cytometry • 868 views
ADD COMMENT

Login before adding your answer.

Traffic: 272 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