RGLab / openCyto

A package that provides data analysis pipeline for flow cytometry.
GNU Affero General Public License v3.0
77 stars 29 forks source link

unexplained warning messages with flowWorkspaceData samples #193

Closed rwbaer closed 5 years ago

rwbaer commented 5 years ago

The code below produces 12 unexpected warning messages when applying the gating template to the gating set for the flowWorkspaceData.

The warnings:

> warnings()
Warning messages:
1: In rlm.default(x, y, weights, method = method, wt.method = wt.method,  ... :
  'rlm' failed to converge in 5 steps
2: In singletGate(fr, area = channels[1], height = channels[2],  ... :
  The IRLS algorithm employed in 'rlm' did not converge.
3: In rlm.default(x, y, weights, method = method, wt.method = wt.method,  ... :
  'rlm' failed to converge in 5 steps
4: In singletGate(fr, area = channels[1], height = channels[2],  ... :
  The IRLS algorithm employed in 'rlm' did not converge.
5: In getChannelMarker(parent_data[[1, use.exprs = FALSE]],  ... :
  HLA is partially matched with V545-AHLA-DR V500
6: In getChannelMarker(frm, channel) :
  HLA is partially matched with V545-AHLA-DR V500
7: In getChannelMarker(fr, dim) : HLA is partially matched with V545-AHLA-DR V500
8: In getChannelMarker(fr, dim) : HLA is partially matched with V545-AHLA-DR V500
9: In getChannelMarker(parent_data[[1, use.exprs = FALSE]],  ... :
  HLA is partially matched with V545-AHLA-DR V500
10: In getChannelMarker(frm, channel) :
  HLA is partially matched with V545-AHLA-DR V500
11: In getChannelMarker(fr, dim) :
  HLA is partially matched with V545-AHLA-DR V500
12: In getChannelMarker(fr, dim) :
  HLA is partially matched with V545-AHLA-DR V500

The code that produced them:

#  This code is based on the Section 4 of openCyto introduction
library(openCyto)
library(ggcyto)
#################
# load data
#################
# read in the gating template
library(data.table)
gtFile <- system.file("extdata/gating_template/tcell.csv", package = "openCyto")
# gt = "gating template" object (used around line 50)
gt = gatingTemplate(gtFile, autostart = 1L)

# Read in flowset data
flowDataPath <- system.file("extdata", package = "flowWorkspaceData") # data location
fcsFiles <- list.files(pattern = "CytoTrol", flowDataPath, full = TRUE)
ncfs  <- read.ncdfFlowSet(fcsFiles)
fr <- ncfs[[1]]

# create a gating set around the flowset data
gs <- GatingSet(ncfs)
gs

################
# Apply compensation matrix
################
# Read a compensation from a flowjo workspace
    # Replace with usable code to OTHERWISE get a compensation matrix
    # ----------------------------------
    flowDataPath <- system.file("extdata", package = "flowWorkspaceData")
    gs2 <- load_gs(file.path(flowDataPath,"gs_manual"))
    gh2 <- gs2[[1]]
    plot(gh2)
    compMat = getCompensationMatrices(gh2)  # here we use ones embedded in files
    # ----------------------------------
gs = compensate(gs, compMat)  # Apply compensation to gating set

################
# Transform the stained data to logicle
################
chnls = parameters(compMat) # Get stained channel names from compensation matrix
trans = estimateLogicle(gs[[1]], channels = chnls)
gs = transform(gs, trans)

################
# Apply the gating template to gating set
################
gating(gt, gs)

My sessionInfo():

> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

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] parallel  stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] data.table_1.12.2         ggcyto_1.11.5            
[3] ggplot2_3.1.1             openCyto_1.21.4          
[5] flowWorkspace_3.31.16     ncdfFlow_2.29.3          
[7] BH_1.69.0-1               RcppArmadillo_0.9.400.2.0
[9] flowCore_1.49.10         

loaded via a namespace (and not attached):
 [1] mclust_5.4.3        Rcpp_1.0.1          mvtnorm_1.0-10     
 [4] lattice_0.20-38     corpcor_1.6.9       gtools_3.8.1       
 [7] assertthat_0.2.1    digest_0.6.18       plyr_1.8.4         
[10] R6_2.4.0            stats4_3.6.0        pcaPP_1.9-73       
[13] ellipse_0.4.1       pillar_1.3.1        zlibbioc_1.29.0    
[16] rlang_0.3.4         lazyeval_0.2.2      rstudioapi_0.10    
[19] Rgraphviz_2.27.0    hexbin_1.27.2       R.utils_2.8.0      
[22] R.oo_1.22.0         Matrix_1.2-17       splines_3.6.0      
[25] stringr_1.4.0       munsell_0.5.0       compiler_3.6.0     
[28] pkgconfig_2.0.2     BiocGenerics_0.29.2 mnormt_1.5-5       
[31] IDPmisc_1.1.19      tidyselect_0.2.5    tibble_2.1.1       
[34] gridExtra_2.3       matrixStats_0.54.0  XML_3.98-1.19      
[37] withr_2.1.2         flowViz_1.47.4      rrcov_1.4-7        
[40] crayon_1.3.4        dplyr_0.8.0.1       MASS_7.3-51.4      
[43] R.methodsS3_1.7.1   grid_3.6.0          RBGL_1.59.8        
[46] gtable_0.3.0        magrittr_1.5        scales_1.0.0       
[49] flowStats_3.41.3    graph_1.61.1        RcppParallel_4.4.2 
[52] KernSmooth_2.23-15  stringi_1.4.3       latticeExtra_0.6-28
[55] robustbase_0.93-4   RColorBrewer_1.1-2  tools_3.6.0        
[58] Biobase_2.43.1      glue_1.3.1          DEoptimR_1.0-8     
[61] purrr_0.3.2         ks_1.11.4           clue_0.3-57        
[64] colorspace_1.4-1    cluster_2.0.8       flowClust_3.21.4   
[67] fda_2.4.8  
mikejiang commented 5 years ago

Partial channel/marker matching warnings are legitimate and should be preserved. We will look into singletGate warnings.

jacobpwagner commented 5 years ago

In https://github.com/RGLab/flowStats/commit/833a994b1ba13cf4d9381ed2d99bdab6a96970b6 I bumped the default maximum number of iterations for singletGate up to the default value for the underlying rlm (20 iterations). Those calls to singletGate were taking 9 iterations to converge within the default accuracy of 1e-4, so that should get rid of those warnings. I agree that the partial matching warnings should remain.

jacobpwagner commented 5 years ago

Actually, in the interest of not increasing the duration of singletGate calls, I've reverted the default maximum number of iterations to 5 but just muffled the convergence warnings from rlm in https://github.com/RGLab/flowStats/commit/babc3bf380b343f2c0cd0bdd2b7a45dfb434b084.