knitr::opts_chunk$set(echo = TRUE, cache = FALSE, eval = TRUE,
                      warning = TRUE, message = TRUE)

Introduction

Although multidimensional single-cell-based flow and mass cytometry have been increasingly applied to microenvironmental composition and stem-cell research, integrated analysis workflows to facilitate the interpretation of experimental cytometry data remain underdeveloped. We present flowSpy, a comprehensive R package designed for the analysis and interpretation of flow and mass cytometry data. We applied flowSpy to mass cytometry and time-course flow cytometry data to demonstrate the usage and practical utility of its computational modules. flowSpy is a reliable tool for multidimensional cytometry data workflows and produces compelling results for trajectory construction and pseudotime estimation.

Overview of flowSpy workflow

The flowSpy package is developed to complete the majority of standard analysis and visualization workflow for FCS data. In flowSpy workflow, an S4 object in R is built to implement the statistical and computational approach, and all computational modules are integrated into one single channel which only requires a specified input data format. Computational modules of flowSpy can be divided into four main parts (Fig. 1): preprocessing, trajectory, analysis and visualization.

## 2020-04-20 15:31:10 [INFO] Number of cells in processing: 600
## 2020-04-20 15:31:10 [INFO] rownames of meta.data and raw.data will be named using column cell
## 2020-04-20 15:31:10 [INFO] Index of markers in processing
## 2020-04-20 15:31:10 [INFO] Creating FSPY object.
## 2020-04-20 15:31:10 [INFO] Determining normalization factors
## 2020-04-20 15:31:10 [INFO] Normalization and log-transformation.
## 2020-04-20 15:31:10 [INFO] Build FSPY object succeed
## FSPY Information:
##  Input cell number: 600  cells 
##  Enroll marker number: 10  markers 
##  Cells after downsampling: 600  markers
## Mapping data to SOM
## 2020-04-20 15:31:16 [INFO] Calculating Pseudotime.
## 2020-04-20 15:31:16 [INFO] Pseudotime exists in meta.data, it will be replaced.
## 2020-04-20 15:31:16 [INFO] The log data will be used to calculate trajectory
## 2020-04-20 15:31:17 [INFO] Calculating Pseudotime completed.
## 2020-04-20 15:31:17 [INFO] 37 cells will be added to leaf.cells .
## 2020-04-20 15:31:17 [INFO] Calculating walk between root.cells and leaf.cells .
## 2020-04-20 15:31:17 [INFO] Generating an adjacency matrix.
## 2020-04-20 15:31:17 [INFO] Walk forward.
## 2020-04-20 15:31:17 [INFO] Calculating walk completed.

## Warning: `fun.y` is deprecated. Use `fun` instead.

## Warning: `fun.y` is deprecated. Use `fun` instead.

## Warning: `fun.y` is deprecated. Use `fun` instead.

## `geom_smooth()` using formula 'y ~ x'

## `geom_smooth()` using formula 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.00097701
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.11592
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0066319
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.00097701
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.11592
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0066319
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.00097701
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.11592
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0066319
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.00097701
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.11592
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0066319
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.00097701
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.11592
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0066319
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.00097701
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.11592
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0066319
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.00097701
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.11592
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0066319
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.00097701
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.11592
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0066319
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.00097701
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.11592
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0066319
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.00097701
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.11592
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0066319

## R version 3.6.3 (2020-02-29)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS Catalina 10.15.3
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] stringr_1.4.0   flowCore_1.52.1 flowSpy_1.0.5   igraph_1.2.5   
## [5] ggplot2_3.3.0  
## 
## loaded via a namespace (and not attached):
##   [1] reticulate_1.14             R.utils_2.9.2              
##   [3] ks_1.11.7                   RUnit_0.4.32               
##   [5] tidyselect_1.0.0            RSQLite_2.2.0              
##   [7] AnnotationDbi_1.48.0        grid_3.6.3                 
##   [9] ranger_0.12.1               BiocParallel_1.20.1        
##  [11] Rtsne_0.15                  scatterpie_0.1.4           
##  [13] munsell_0.5.0               destiny_3.0.1              
##  [15] codetools_0.2-16            umap_0.2.5.0               
##  [17] withr_2.1.2                 colorspace_1.4-1           
##  [19] flowViz_1.50.0              Biobase_2.46.0             
##  [21] knitr_1.28                  stats4_3.6.3               
##  [23] SingleCellExperiment_1.8.0  flowClust_3.24.0           
##  [25] robustbase_0.93-6           vcd_1.4-6                  
##  [27] openCyto_1.24.0             VIM_5.1.1                  
##  [29] TTR_0.23-6                  labeling_0.3               
##  [31] GenomeInfoDbData_1.2.2      mnormt_1.5-6               
##  [33] polyclip_1.10-0             bit64_0.9-7                
##  [35] farver_2.0.3                pheatmap_1.0.12            
##  [37] flowWorkspace_3.34.1        vctrs_0.2.4                
##  [39] xfun_0.12                   ggthemes_4.2.0             
##  [41] R6_2.4.1                    GenomeInfoDb_1.22.1        
##  [43] clue_0.3-57                 RcppEigen_0.3.3.7.0        
##  [45] bitops_1.0-6                DelayedArray_0.12.2        
##  [47] assertthat_0.2.1            scales_1.1.0               
##  [49] nnet_7.3-13                 gtable_0.3.0               
##  [51] sva_3.34.0                  rlang_0.4.5                
##  [53] genefilter_1.68.0           scatterplot3d_0.3-41       
##  [55] flowUtils_1.50.0            splines_3.6.3              
##  [57] hexbin_1.28.1               BiocManager_1.30.10        
##  [59] yaml_2.2.1                  abind_1.4-5                
##  [61] IDPmisc_1.1.20              RBGL_1.62.1                
##  [63] tools_3.6.3                 ellipsis_0.3.0             
##  [65] RColorBrewer_1.1-2          proxy_0.4-23               
##  [67] BiocGenerics_0.32.0         Rcpp_1.0.4                 
##  [69] plyr_1.8.6                  base64enc_0.1-3            
##  [71] zlibbioc_1.32.0             purrr_0.3.3                
##  [73] RCurl_1.98-1.1              FlowSOM_1.18.0             
##  [75] openssl_1.4.1               S4Vectors_0.24.3           
##  [77] zoo_1.8-7                   SummarizedExperiment_1.16.1
##  [79] haven_2.2.0                 cluster_2.1.0              
##  [81] fda_2.4.8.1                 magrittr_1.5               
##  [83] ncdfFlow_2.32.0             data.table_1.12.8          
##  [85] RSpectra_0.16-0             openxlsx_4.1.4             
##  [87] gmodels_2.18.1              RANN_2.6.1                 
##  [89] lmtest_0.9-37               pcaMethods_1.78.0          
##  [91] mvtnorm_1.1-0               matrixStats_0.56.0         
##  [93] xtable_1.8-4                hms_0.5.3                  
##  [95] evaluate_0.14               smoother_1.1               
##  [97] XML_3.99-0.3                rio_0.5.16                 
##  [99] jpeg_0.1-8.1                mclust_5.4.5               
## [101] readxl_1.3.1                IRanges_2.20.2             
## [103] gridExtra_2.3               ggcyto_1.14.1              
## [105] compiler_3.6.3              ellipse_0.4.1              
## [107] tibble_3.0.0                flowStats_3.44.0           
## [109] KernSmooth_2.23-16          crayon_1.3.4               
## [111] R.oo_1.23.0                 htmltools_0.4.0            
## [113] mgcv_1.8-31                 corpcor_1.6.9              
## [115] pcaPP_1.9-73                tidyr_1.0.2                
## [117] rrcov_1.5-2                 RcppParallel_5.0.0         
## [119] DBI_1.1.0                   tweenr_1.0.1               
## [121] MASS_7.3-51.5               boot_1.3-24                
## [123] Matrix_1.2-18               car_3.0-7                  
## [125] cli_2.0.2                   R.methodsS3_1.8.0          
## [127] gdata_2.18.0                parallel_3.6.3             
## [129] GenomicRanges_1.38.0        forcats_0.5.0              
## [131] pkgconfig_2.0.3             rvcheck_0.1.8              
## [133] prettydoc_0.3.1             foreign_0.8-76             
## [135] laeken_0.5.1                sp_1.4-1                   
## [137] annotate_1.64.0             XVector_0.26.0             
## [139] digest_0.6.25               tsne_0.1-3                 
## [141] ConsensusClusterPlus_1.50.0 graph_1.64.0               
## [143] rmarkdown_2.1               cellranger_1.1.0           
## [145] curl_4.3                    gtools_3.8.1               
## [147] ggplot.multistats_1.0.0     nlme_3.1-145               
## [149] lifecycle_0.2.0             jsonlite_1.6.1             
## [151] carData_3.0-3               BiocNeighbors_1.4.2        
## [153] askpass_1.1                 limma_3.42.2               
## [155] fansi_0.4.1                 pillar_1.4.3               
## [157] lattice_0.20-40             survival_3.1-11            
## [159] DEoptimR_1.0-8              glue_1.3.2                 
## [161] xts_0.12-0                  zip_2.0.4                  
## [163] png_0.1-7                   bit_1.1-15.2               
## [165] Rgraphviz_2.30.0            ggforce_0.3.1              
## [167] class_7.3-16                stringi_1.4.6              
## [169] blob_1.2.1                  RcppHNSW_0.2.0             
## [171] CytoML_1.12.1               memoise_1.1.0              
## [173] latticeExtra_0.6-29         dplyr_0.8.5                
## [175] knn.covertree_1.0           irlba_2.3.3                
## [177] e1071_1.7-3

References

  1. Hahne F, Arlt D, Sauermann M, Majety M, Poustka A, Wiemann S, Huber W: Statistical methods and software for the analysis of highthroughput reverse genetic assays using flow cytometry readouts. Genome Biol 2006, 7:R77.
  2. Olsen LR, Leipold MD, Pedersen CB, Maecker HT: The anatomy of single cell mass cytometry data. Cytometry A 2019, 95:156-172.
  3. Butler A, Hoffman P, Smibert P, Papalexi E, Satija R: Integrating single-cell transcriptomic data across different conditions, technologies, and species. Nat Biotechnol 2018, 36:411-420.
  4. Trapnell C, Cacchiarelli D, Grimsby J, Pokharel P, Li S, Morse M, Lennon NJ, Livak KJ, Mikkelsen TS, Rinn JL: The dynamics and regulators of cell fate decisions are revealed by pseudotemporal ordering of single cells. Nat Biotechnol 2014, 32:381-386.
  5. Kiselev VY, Yiu A, Hemberg M: scmap: projection of single-cell RNA-seq data across data sets. Nat Methods 2018, 15:359-362.
  6. Amir el AD, Davis KL, Tadmor MD, Simonds EF, Levine JH, Bendall SC, Shenfeld DK, Krishnaswamy S, Nolan GP, Pe’er D: viSNE enables visualization of high dimensional single-cell data and reveals phenotypic heterogeneity of leukemia. Nat Biotechnol 2013, 31:545-552.
  7. Haghverdi L, Buettner F, Theis FJ: Diffusion maps for high-dimensional single-cell analysis of differentiation data. Bioinformatics 2015, 31:2989-2998.
  8. Becht E, McInnes L, Healy J, Dutertre CA, Kwok IWH, Ng LG, Ginhoux F, Newell EW: Dimensionality reduction for visualizing single-cell data using UMAP. Nat Biotechnol 2018.
  9. Wang L, Hoffman RA: Standardization, Calibration, and Control in Flow Cytometry. Curr Protoc Cytom 2017, 79:1 3 1-1 3 27.
  10. Hahne F, LeMeur N, Brinkman RR, Ellis B, Haaland P, Sarkar D, Spidlen J, Strain E, Gentleman R: flowCore: a Bioconductor package for high throughput flow cytometry. BMC Bioinformatics 2009, 10:106.
  11. Sarkar D, Le Meur N, Gentleman R: Using flowViz to visualize flow cytometry data. Bioinformatics 2008, 24:878-879.
  12. Van Gassen S, Callebaut B, Van Helden MJ, Lambrecht BN, Demeester P, Dhaene T, Saeys Y: FlowSOM: Using self-organizing maps for visualization and interpretation of cytometry data. Cytometry A 2015, 87:636-645.
  13. Qiu P, Simonds EF, Bendall SC, Gibbs KD, Jr., Bruggner RV, Linderman MD, Sachs K, Nolan GP, Plevritis SK: Extracting a cellular hierarchy from high-dimensional cytometry data with SPADE. Nat Biotechnol 2011, 29:886-891.
  14. Chen H, Lau MC, Wong MT, Newell EW, Poidinger M, Chen J: Cytofkit: A Bioconductor Package for an Integrated Mass Cytometry Data Analysis Pipeline. PLoS Comput Biol 2016, 12:e1005112.
  15. Chattopadhyay PK, Winters AF, Lomas WE, 3rd, Laino AS, Woods DM: High-Parameter Single-Cell Analysis. Annu Rev Anal Chem (Palo Alto Calif) 2019, 12:411-430.
  16. Bendall SC, Davis KL, Amir el AD, Tadmor MD, Simonds EF, Chen TJ, Shenfeld DK, Nolan GP, Pe’er D: Single-cell trajectory detection uncovers progression and regulatory coordination in human B cell development. Cell 2014, 157:714-725.
  17. Nowicka M, Krieg C, Crowell HL, Weber LM, Hartmann FJ, Guglietta S, Becher B, Levesque MP, Robinson MD: CyTOF workflow: differential discovery in high-throughput high-dimensional cytometry datasets. F1000Res 2017, 6:748.