Hello, I am using FlowSOM to perform some analysis on two flow frame. According to the manual of FlowSOM it is possible to extract the data belongings to a specific cluster. Here the code from the manual of FlowSOM (page 16):
# Build the FlowSOM tree on the example file
fileName <- system.file("extdata","lymphocytes.fcs",package="FlowSOM")
flowSOM.res <- FlowSOM(fileName, compensate=TRUE,transform=TRUE, scale=TRUE,colsToUse=c(9,12,14:18),nClus = 10, seed=1) # 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")
The problem is that I am working with a flowSET. I need to build a tree for all the data I have. I cannot generate two trees for the two files separately because they will produce two different trees. In a sense I will not be able to make a comparison between the two trees and their data. To generate my cluster I can simply use:
MYFlowSET=read.flowSet(list_of_two_files)
flowSOM.res <- FlowSOM(MYFlowSET, scale=TRUE,colsToUse=c(9,12,14:18),nClus = 10, seed=1)
At this point, I am lost. I would like to extract, from the tree, the data inside a specific sub-cluster that belong to a specific flowFrame of my flowSet. In a sense, I would like to do something like:
MyFlowSET[[1]][flowSOM.res[[1]]$map$mapping[,1] %in% which(flowSOM.res[[2]] != 7),]
But that command doesn't work. Any suggestions?
After a couple of days I found a possible solution: