SofieVG / FlowSOM

Using self-organizing maps for visualization and interpretation of cytometry data
61 stars 26 forks source link

SaveClusters ToFCS with multiple data segments #22

Open jaybob66 opened 5 years ago

jaybob66 commented 5 years ago

In R console I call FlowSOM() to load an FCS and apply clustering and metaclustering and then call SaveClustersToFCS() to save the modified file.

However, SaveClustersToFCS reports an error to me (see below), it looks like FlowSOM can't load or save FCS files with multiple data segments? Is that correct?

Thanks

> fileName <- "MyFile.LMD"
> cols <- c(3:7)

> fsom <- FlowSOM(fileName, pattern=".LMD", compensate=FALSE,transform=FALSE,scale=FALSE,colsToUse=cols, nClus=20)
> SaveClustersToFCS(fsom,fileName)
Extending MyFile.LMD using the FlowSOMmapping of MyFile.LMD indexed by 
Error in m[s, ] <- fsom_f$map$mapping[, 1] : 
  number of items to replace is not a multiple of replacement length
In addition: Warning messages:
1: The file contains 1 additional data segment.
The default is to read the first segment only.
Please consider setting the 'dataset' argument. 
2: Invalid bitwidth specification.
This is a known bug in Beckman Coulter's CPX software.
The data might be corrupted if produced by another software. 
3: The file contains 1 additional data segment.
The default is to read the first segment only.
Please consider setting the 'dataset' argument. 
4: Invalid bitwidth specification.
This is a known bug in Beckman Coulter's CPX software.
The data might be corrupted if produced by another software. 
5: In NewData(fsom, ff) :
  5469 cells (1.63%) seem far from their cluster centers.
SofieVG commented 5 years ago

Hi,

I have to admit that I haven't tried FlowSOM yet on any files with multiple data segments, so I am not entirely sure how it would behave. From the warnings, I assume only the first data segment is read into R? Maybe that is why it is not matching up later. However, in that case, I'm surprised that there were no warnings running the FlowSOM command. Would it be possible for you to share an example file with me, so I can have a look myself?

Kind regards, Sofie

SamGG commented 5 years ago

IMHO, the best way is to solve/clean the LMD file from Beckman instrument before applying FlowSOM. IIRC the first segment is coded as FCS2 while the second is coded as FCS3. But the channels are not in the order. I have no code yet for transcoding.