GatingSetList-class {flowWorkspace} | R Documentation

## Class `"GatingSetList"`

### Description

A list of of `GatingSet` objects. This class exists for method dispatching.

use `GatingSetList` constructor to create a GatingSetList from a list of GatingSet

### Usage

    GatingSetList(x, samples = NULL)

    ## S4 method for signature 'GatingSetList,missing'
    rbind2(x, y = "missing", ...)

### Arguments

`x` | a `list` of `GatingSet`
`samples` | `character` vector specifying the order of samples. if not specified, the samples are ordered as the underlying stored order.
`y` | `missing` not used.
`...` | other arguments passed to `rbind2` method for `ncdfFlowList`

### Details

Objects store a collection of GatingSets,which usually has the same gating trees and markers. Most GatingSets methods can be applied to GatingSetList.

### See Also

`GatingSet` `GatingHierarchy`

### Examples

      ## Not run:
        #load several GatingSets from disk
       gs_list<-lapply(list.files("../gs_toMerge",full=T) ,function(this_folder){
                         load_gs(this_folder)
                         })

       #gs_list is a list
        gs_groups <- merge(gs_list)
        #returns a list of GatingSetList objects
        gslist2 <- gs_groups[[2]]
        #gslist2 is a GatingSetList that contains multiple GatingSets and they share the same gating and data structure
        gslist2
        class(gslist2)
        sampleNames(gslist2)

        #reference a GatingSet by numeric index
        gslist2[[1]]
        #reference a GatingSet by character index
        gslist2[["30104.fcs"]]

        #loop through all GatingSets within GatingSetList
        lapply(gslist2,sampleNames)

        #subset a GatingSetList by [
        sampleNames(gslist2[c(4,1)])
        sampleNames(gslist2[c(1,4)])
        gslist2[c("30104.fcs")]

        #get flow data from it
        getData(gslist2)
        #get gated flow data from a particular popoulation
        getData(gslist2, "3+")

        #extract the gates associated with one popoulation
        getGate(gslist2,"3+")
        getGate(gslist2,5)

        #extract the pheno data
        pData(gslist2[3:1])
        #modify the pheno data
        pd <- pData(gslist2)
        pd$id <- 1:nrow(pd)
        pData(gslist2) <- pd
        pData(gslist2[3:2])

        #plot the gate
        plotGate(gslist2[1:2],5,smooth=T)
        plotGate_labkey(gslist2[3:4],4,x="<APC Cy7-A>",y="<PE Tx RD-A>",smooth=T)

        #remove cerntain gates by loop through GatingSets
        getNodes(gslist2[[1]])
        lapply(gslist2,function(gs)Rm("Excl",gs))

        #extract the stats
        getPopStats(gslist2)
        #extract statistics by using getQAStats defined in QUALIFIER package
        res<-getQAStats(gslist2[c(4,2)],isMFI=F,isSpike=F,nslaves=1)

        #archive the GatingSetList
        save_gslist(gslist2, path ="~/rglab/workspace/flowIncubator/output/gslist",overwrite=T)
        gslist2 <- load_gslist(path ="~/rglab/workspace/flowIncubator/output/gslist")

        #convert GatingSetList into one GatingSet by rbind2
        gs_merged2 <- rbind2(gslist2,ncdfFile=path.expand(tempfile(tmpdir="~/rglab/workspace/flowIncubator/output/",fileext=".nc")))
        gs_merged2

    ## End(Not run)

    ## Not run:
    samleNames(gsA) # return A1, A2
    samleNames(gsB) # return B1, B2
    gs.list <- list(gsA, gsB)
    gslist<- GatingSetList(gs.list)
    sampleNames(gslist) #return A1,A2,B1,B2

    #set different order when create the GatingSetList
    gslist<- GatingSetList(gs.list, samples = c("A1","B1", "A2", "B2"))
    sampleNames(gslist) #return A1,B1,A2,B2

    ## End(Not run)

[Package flowWorkspace version 3.32.0 Index]