parsing flowFrame@description in flowCore
1
0
Entering edit mode
Robert Baer ▴ 70
@robert-baer-4660
Last seen 2.4 years ago
United States

# flowCore’ version 1.38.1

Steps to reproduce:

1. Read an .fcs file created with a BioRad S3 cell sorter using f <- read.FCS(.)

# Names of  in flowFrame

names(f@description)
  [1] "FCSversion"        "$BEGINANALYSIS"    "$ENDANALYSIS"     
  [4] "$BEGINDATA"        "$ENDDATA"          "$BEGINSTEXT"      
  [7] "$ENDSTEXT"         "$NEXTDATA"         "$DATATYPE"        
 [10] "$MODE"             "$PAR"              "$BYTEORD"         
 [13] "$TOT"              "$SYS"              "$CYT"             
 [16] "$CYTSN"            "$INST"             "$P1N"             
 [19] "$P1S"              "$P1B"              "$P1R"             
 [22] "$P1E"              "$P1G"              "$P1CALIBATION"    
 [25] "$P2N"              "$P2S"              "$P2B"             
 [28] "$P2R"              "$P2E"              "$P2G"             
 [31] "$P2CALIBATION"     "$P3N"              "$P3S"             

...         
[145] "$P21G"             "$ETIM"             "$BTIM"            
[148] "$DATE"             "$SPILLOVER"        "FILENAME"         
[151] "transformation"    "flowCore_$P1Rmax"  "flowCore_$P1Rmin" 
[154] "flowCore_$P2Rmax"  "flowCore_$P2Rmin"  "flowCore_$P3Rmax" 
[157] "flowCore_$P3Rmin"  "flowCore_$P4Rmax"  "flowCore_$P4Rmin" 
[160] "flowCore_$P5Rmax"  "flowCore_$P5Rmin"  "flowCore_$P6Rmax" 
[163] "flowCore_$P6Rmin"  "flowCore_$P7Rmax"  "flowCore_$P7Rmin" 
[166] "flowCore_$P8Rmax"  "flowCore_$P8Rmin"  "flowCore_$P9Rmax" 
[169] "flowCore_$P9Rmin"  "flowCore_$P10Rmax" "flowCore_$P10Rmin"
[172] "flowCore_$P11Rmax" "flowCore_$P11Rmin" "flowCore_$P12Rmax"
[175] "flowCore_$P12Rmin" "flowCore_$P13Rmax" "flowCore_$P13Rmin"
[178] "flowCore_$P14Rmax" "flowCore_$P14Rmin" "flowCore_$P15Rmax"
[181] "flowCore_$P15Rmin" "flowCore_$P16Rmax" "flowCore_$P16Rmin"
[184] "flowCore_$P17Rmax" "flowCore_$P17Rmin" "flowCore_$P18Rmax"
[187] "flowCore_$P18Rmin" "flowCore_$P19Rmax" "flowCore_$P19Rmin"
[190] "flowCore_$P20Rmax" "flowCore_$P20Rmin" "flowCore_$P21Rmax"
[193] "flowCore_$P21Rmin" "GUID" 

# Now try to access this data and note a strange parsing problem

# i.e., some fields seem to have extra $ character and require backwards apostrophe " ` "

# It seems this is not intended, but I don't know if this is a "file reading" or "file writing" problem"

# It certainly is in net a "file parsing" problem

# Example

> f@description$DATE
NULL

# But with extra $ and back single quote

> f@description$`$DATE`
[1] "17-May-2016"

# on the other hand some things work as expected

> f@description$GUID
[1] "2016-05-17 b16.fcs"

> f@description$FILENAME
[1] "./fullFCS/2016-05-17 b16.fcs"

#  Another broken one:

> f@description$SPILLOVER
NULL

#  The oddball fix
> f@description$`$SPILLOVER`
     FL1-AREA FL2-AREA FL3-AREA FL4-AREA
[1,]        1        0        0        0
[2,]        0        1        0        0
[3,]        0        0        1        0
[4,]        0        0        0        1

 

Question:  Is this a flowCore parsing problem or an S3 Cell Sorter writing problem?   And obviously, is there a way to improve this parsing behavior?

Thanks,

Rob Baer

Professor of Physiology

AT Still University of Health Sciences

 

----------------------------------------------------------------------------------

flowCore’ version 1.38.1  running on Windows 10 in US locale

It could be important that I'm running inside RStudio 0.99.893

-------------------------------------------------------------------------------------

> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] flowViz_1.36.2  lattice_0.20-33 flowCore_1.38.1 sfsmisc_1.1-0  

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.5         matrixStats_0.50.2  mvtnorm_1.0-5      
 [4] corpcor_1.6.8       rrcov_1.3-11        MASS_7.3-45        
 [7] grid_3.3.0          stats4_3.3.0        pcaPP_1.9-60       
[10] KernSmooth_2.23-15  graph_1.50.0        hexbin_1.27.1      
[13] latticeExtra_0.6-28 robustbase_0.92-5   RColorBrewer_1.1-2 
[16] tools_3.3.0         Biobase_2.32.0      DEoptimR_1.0-4     
[19] parallel_3.3.0      BiocGenerics_0.18.0 cluster_2.0.4      
[22] IDPmisc_1.1.17     

 

FCS file flowcore @description • 1.2k views
ADD COMMENT
3
Entering edit mode
Jiang, Mike ★ 1.3k
@jiang-mike-4886
Last seen 3.1 years ago
(Private Address)

It is part of the FCS Standard.

>The '$' character flags this keyword as a standard FCS keyword.

So flowCore simply reads the keyword as it is in the original FCS TEXT segment. 

To avoid back ticks,  you can use "[[" instead "$"  to index the element of the list.

Also accessing the slot of S4 object directly through `@` operator makes your code less robust, try to use the public API when it is available.

In this case, 'keyword' method should be used.

 

ADD COMMENT

Login before adding your answer.

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