Search
Question: Errors in creating a flowSet from fcs files
0
gravatar for mbxtp1
14 months ago by
mbxtp10
mbxtp10 wrote:

Hi all,

I have been trying to use the read.flowSet() command to read in multiple .fcs files but I keep getting the following error:

all <- read.flowSet(files=NULL,path=".",pattern=".fcs")

Error in asMethod(object) : 
  The individual flowFrames do not contain identical stains.
In addition: Warning message:
In ucol == sort(colNames[, 1]) :
  longer object length is not a multiple of shorter object length

On the contrary, I am able to read in the files individually using the command below. The files all follow the same format, only differences being the data and number of cells. They have the same row and column names despite the error message.

unstained1 <- read.FCS("Unstained.fcs",transformation="linearize")
> unstained1
flowFrame object 'Unstained.fcs'
with 16462 cells and 14 observables:
            name desc     range minRange  maxRange
$P1         Time <NA> 536870912        0 536870911
$P2          FSC <NA> 536870912        0 536870911
$P3          FSC <NA> 536870912        0 536870911
$P4          SSC <NA> 536870912        0 536870911
$P5          SSC <NA> 536870912        0 536870911
$P6   FL1-Height <NA> 536870912        0 536870911
$P7   FL2-Height <NA> 536870912        0 536870911
$P8   FL4-Height <NA> 536870912        0 536870911
$P9   FL6-Height <NA> 536870912        0 536870911
$P10  FL7-Height <NA> 536870912        0 536870911
$P11 FL10-Height <NA> 536870912        0 536870911
$P12 FL11-Height <NA> 536870912        0 536870911
$P13 FL12-Height <NA> 536870912        0 536870911
$P14 FL14-Height <NA> 536870912        0 536870911
101 keywords are stored in the 'description' slot

I have also tried the following command to create a flowSet but still get an error:

> all_data<-lapply(list.files(path=".",full.names=TRUE),function(x)read.FCS(x,transforation="scale"))
Error in if (!version %in% c("FCS2.0", "FCS3.0", "FCS3.1")) stop("This does not seem to be a valid FCS2.0, FCS3.0 or FCS3.1 file") : 

  argument is of length zero

I would like to perform probability binning but it requires a flowSet to be created, yet I cannot surpass this step. Any suggestions would be a great help! Thanks in advance.

> sessionInfo()
R version 3.2.4 (2016-03-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.3 (El Capitan)
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets  methods 
[8] base   
 
other attached packages:
 [1] BiocInstaller_1.20.1      flowStats_3.28.1        
 [3] flowWorkspace_3.16.16     gridExtra_2.2.1         
 [5] ncdfFlow_2.16.1           BH_1.60.0-1             
 [7] RcppArmadillo_0.6.700.3.0 cluster_2.0.4           
 [9] mvoutlier_2.0.6           sgeostat_1.0-27         
[11] fda_2.4.4                 Matrix_1.2-5            
[13] flowFP_1.28.0             flowViz_1.34.1          
[15] lattice_0.20-33           flowCore_1.36.9         

loaded via a namespace (and not attached):
 [1] Biobase_2.30.0        jsonlite_0.9.19       assertthat_0.1      
 [4] sp_1.2-3              stats4_3.2.4          latticeExtra_0.6-28 
 [7] RBGL_1.46.0           robustbase_0.92-5     VIM_4.4.1           
[10] quantreg_5.21         RUnit_0.4.31          chron_2.3-47        
[13] RColorBrewer_1.1-2    minqa_1.2.4           colorspace_1.2-6    
[16] plyr_1.8.3            multicool_0.1-9       pcaPP_1.9-60        
[19] XML_3.98-1.4          misc3d_0.8-4          SparseM_1.7         
[22] zlibbioc_1.16.0       corpcor_1.6.8         mvtnorm_1.0-5       
[25] scales_0.4.0          lme4_1.1-12           MatrixModels_0.4-1  
[28] mgcv_1.8-12           car_2.1-2             ggplot2_2.1.0       
[31] nnet_7.3-12           BiocGenerics_0.16.1   hexbin_1.27.1       
[34] pbkrtest_0.4-6        magrittr_1.5          IDPmisc_1.1.17      
[37] ks_1.10.3             GGally_1.0.1          nlme_3.1-127        
[40] MASS_7.3-45           class_7.3-14          graph_1.48.0        
[43] tools_3.2.4           data.table_1.9.6      matrixStats_0.50.2  
[46] stringr_1.0.0         munsell_0.4.3         flowUtils_1.34.0    
[49] pls_2.5-0             e1071_1.6-7           vcd_1.4-1         
[52] grid_3.2.4            nloptr_1.0.4          cvTools_0.3.2       
[55] codetools_0.2-14      gtable_0.2.0          DBI_0.3.1           
[58] reshape_0.8.5         rrcov_1.3-11          R6_2.1.2            
[61] robCompositions_2.0.0 zoo_1.7-12            dplyr_0.4.3         
[64] sROC_0.1-2            KernSmooth_2.23-15    Rgraphviz_2.14.0    
[67] stringi_1.0-1         parallel_3.2.4        Rcpp_0.12.4         
[70] rgl_0.95.1441         DEoptimR_1.0-4        lmtest_0.9-34       
ADD COMMENTlink modified 14 months ago by Jiang, Mike960 • written 14 months ago by mbxtp10
1
gravatar for Jiang, Mike
14 months ago by
Jiang, Mike960
(Private Address)
Jiang, Mike960 wrote:

Check your folder to see if all files are valid FCS files. 

 

ADD COMMENTlink written 14 months ago by Jiang, Mike960

I have checked and double checked and they are all valid. I have even tried using the command on raw FCS files directly from FlowJo but got the same error which is why I am more baffled.

ADD REPLYlink written 14 months ago by mbxtp10

The error message was clearly telling you there are two issues with your files:

1. they do not all have the same channels

2. some of your files are not FCS 2.0, 3.0 or 3.1. 

 

ADD REPLYlink written 14 months ago by Jiang, Mike960

I was using trying this on a Mac but moved to a Windows PC and it was able to read the raw FCS files (which were FCS3.0). However the output of read.flowSet() is blank without any error messages. 

> all

A flowSet with 11 experiments.

  column names:
  TIME TIME2 FSC-Height FSC-Area SSC-Height SSC-Area FL1-Log_Height FL2-Log_Height FL4-Log_Height FL6-Log_Height FL7-Log_Height FL10-Log_Height FL11-Log_Height FL12-Log_Height FL14-Log_Height

However, using read.FCS() the data is there for each FCS - is there any explanation for this or should I ask a new question? Thanks for your suggestions btw Mike, it is very appreciated!

ADD REPLYlink written 13 months ago by mbxtp10

Your message indicates the `read.flowSet` successfully loads the data.

ADD REPLYlink written 13 months ago by Jiang, Mike960

So it does! Sorry I was expecting a similar output to the read.FCS() Thanks for your guidance!

ADD REPLYlink written 13 months ago by mbxtp10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 113 users visited in the last hour