CountGroups {FlowSOM}R Documentation

Calculate differences in cell counts between groups

Description

Calculate differences in cell counts between groups

Usage

CountGroups(fsom, groups, plot = TRUE, silent = FALSE)

Arguments

fsom

FlowSOM object as generated by BuildSOM

groups

List containing an array with file names for each group

plot

Logical. If TRUE, make a starplot of each individual file

silent

Logical. If TRUE, print progress messages

Value

Distance matrix

Examples

   set.seed(1)
   
   # Build the FlowSOM tree on the example file
   fileName <- system.file("extdata", "68983.fcs", package="FlowSOM")
   flowSOM.res <- FlowSOM(fileName, compensate=TRUE,transform=TRUE,
                    scale=TRUE,colsToUse=c(9,12,14:18),nClus = 10)
   
   # Have a look at the resulting tree
   PlotStars(flowSOM.res[[1]],backgroundValues = as.factor(flowSOM.res[[2]]))
   
   # Select all cells except the branch that corresponds with automated 
   # cluster 7 (CD3+ TCRyd +) and write te another file for the example
   # In practice you would not generate any new file but use your different
   # files from your different groups
   ff <- flowCore::read.FCS(fileName)
   ff_tmp <- ff[flowSOM.res[[1]]$map$mapping[,1] %in% 
                     which(flowSOM.res[[2]] != 7),]
   flowCore::write.FCS(ff_tmp,file="ff_tmp.fcs")
   # Make an extra file without cluster 7 and double amount of cluster 10
   ff_tmp <- ff[c(which(flowSOM.res[[1]]$map$mapping[,1] %in% 
                                 which(flowSOM.res[[2]] != 7)),
                  which(flowSOM.res[[1]]$map$mapping[,1] %in% 
                                 which(flowSOM.res[[2]] == 5))),]
   flowCore::write.FCS(ff_tmp,file="ff_tmp2.fcs")
   
   # Compare the original file with the two new files we made
   groupRes <- CountGroups(flowSOM.res[[1]], 
                 groups=list("AllCells"=c(fileName),
                           "Without_ydTcells"=c("ff_tmp.fcs","ff_tmp2.fcs")))
   PlotGroups(flowSOM.res[[1]], groupRes)
   
   # Compare only the file with the double amount of cluster 10
   groupRes <- CountGroups(flowSOM.res[[1]], 
                 groups=list("AllCells"=c(fileName),
                 "Without_ydTcells"=c("ff_tmp2.fcs")))
   PlotGroups(flowSOM.res[[1]], groupRes)


[Package FlowSOM version 1.22.0 Index]