[flowSOM] extracting data from tree
0
0
Entering edit mode
@fabriziobenedetti82-20543
Last seen 4.9 years ago

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?

flowcytometry flowSOM flowSET flowFrame • 1.0k views
ADD COMMENT
0
Entering edit mode

After a couple of days I found a possible solution:

ff <- MYFlowSET[[1]]#  Assigning one of the frame of the flosSET to "ff"
# generating a list for the cluster number 8
alist=flowSOM.res[[1]]$map$mapping[,1] %in% which(flowSOM.res[[2]] == 8)
# cut the list at the size of "ff"
alist=alist[1:nrow(ff)]
ff_tmp <- ff[alist,]
ADD REPLY

Login before adding your answer.

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