flowCore filterSummary toTable() function not working
1
0
Entering edit mode
mahlon • 0
@mahlon-19973
Last seen 5.8 years ago

The function toTable() is supposed to create a data frame summarizing the output of a filter operation. This would be a nice way to get the number of cells in a multiple filter result, however, the function doesn't work for me. Minimal reproducible example is running the code contained in the documentation for the function:

## Loading example data, creating and applying a curv1Filter
dat <- read.FCS(system.file("extdata","0877408774.B08",
                            package="flowCore"))
c1f <- curv1Filter(filterId="myCurv1Filter", x=list("FSC-H"), bwFac=2)
fres <- filter(dat, c1f)

## creating and showing the summary
summary(fres)
s <- summary(fres)

## subsetting
s[[1]]
s[["peak 2"]]

##accessing details
s$true
s$n
toTable(s)

Traceback:

rest: 3581 of 10000 events (35.81%)
peak 1: 331 of 10000 events (3.31%)
peak 2: 5575 of 10000 events (55.75%)
peak 3: 455 of 10000 events (4.55%)
peak 4: 58 of 10000 events (0.58%)
> > > Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘toTable’ for signature ‘"filterSummary"’
> traceback()
3: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
       sQuote(fdef@generic), sQuote(cnames)), domain = NA)
2: (function (classes, fdef, mtable) 
   {
       methods <- .findInheritedMethods(classes, fdef, mtable)
       if (length(methods) == 1L) 
           return(methods[[1L]])
       else if (length(methods) == 0L) {
           cnames <- paste0("\"", vapply(classes, as.character, 
               ""), "\"", collapse = ", ")
           stop(gettextf("unable to find an inherited method for function %s for signature %s", 
               sQuote(fdef@generic), sQuote(cnames)), domain = NA)
       }
       else stop("Internal error in finding inherited methods; didn't return a unique method", 
           domain = NA)
   })(list("filterSummary"), new("standardGeneric", .Data = function (x) 
   standardGeneric("toTable"), generic = "toTable", package = "AnnotationDbi", 
       group = list(), valueClass = character(0), signature = "x", 
       default = NULL, skeleton = (function (x) 
       stop("invalid call in method dispatch to 'toTable' (no default method)", 
           domain = NA))(x)), <environment>)
1: toTable(s)

Session Info:

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.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] stats4    parallel  splines   stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] BiocInstaller_1.32.1      ggcyto_1.10.2             ggplot2_3.1.0             geneplotter_1.60.0        annotate_1.60.0           XML_3.98-1.16             AnnotationDbi_1.44.0     
 [8] IRanges_2.16.0            S4Vectors_0.20.1          Biobase_2.42.0            BiocGenerics_0.28.0       flowFP_1.40.1             flowStats_3.40.1          flowWorkspace_3.28.2     
[15] ncdfFlow_2.28.1           BH_1.69.0-1               RcppArmadillo_0.9.200.7.0 cluster_2.0.7-1           fda_2.4.8                 Matrix_1.2-15             flowUtils_1.46.1         
[22] flowViz_1.46.1            lattice_0.20-38           flowCore_1.48.1           colorspace_1.4-0         

loaded via a namespace (and not attached):
 [1] bit64_0.9-7         assertthat_0.2.0    BiocManager_1.30.4  latticeExtra_0.6-28 blob_1.1.1          robustbase_0.93-3   pillar_1.3.1        RSQLite_2.1.1       glue_1.3.0         
[10] RUnit_0.4.32        digest_0.6.18       RColorBrewer_1.1-2  plyr_1.8.4          pcaPP_1.9-73        pkgconfig_2.0.2     zlibbioc_1.28.0     xtable_1.8-3        purrr_0.3.0        
[19] corpcor_1.6.9       mvtnorm_1.0-8       scales_1.0.0        tibble_2.0.1        withr_2.1.2         lazyeval_0.2.1      hexbin_1.27.2       magrittr_1.5        crayon_1.3.4       
[28] IDPmisc_1.1.19      mclust_5.4.2        memoise_1.1.0       ks_1.11.4           MASS_7.3-51.1       graph_1.60.0        tools_3.5.0         data.table_1.12.0   matrixStats_0.54.0 
[37] stringr_1.4.0       munsell_0.5.0       bindrcpp_0.2.2      compiler_3.5.0      rlang_0.3.1         RCurl_1.95-4.11     grid_3.5.0          bitops_1.0-6        gtable_0.2.0       
[46] DBI_1.0.0           rrcov_1.4-7         R6_2.4.0            gridExtra_2.3       dplyr_0.8.0.1       bit_1.1-14          bindr_0.1.1         KernSmooth_2.23-15  Rgraphviz_2.26.0   
[55] stringi_1.3.1       Rcpp_1.0.0          DEoptimR_1.0-8      tidyselect_0.2.5   
flowCore flowcore flow cytometry • 1.5k views
ADD COMMENT
0
Entering edit mode

Your reproducible example seems incomplete, as curv.filter was never defined. I assume by "code contained in the documentation for the function", you mean effectively this:

dat <- read.FCS(system.file("extdata","0877408774.B08",package="flowCore"))
c1f <- curv1Filter(filterId="myCurv1Filter", x=list("FSC-H"), bwFac=2)
fres <- filter(dat, c1f)
summary(fres)
s <- summary(fres)
toTable(s)

But I can't reproduce your dispatch error from that, as the last line produces the expected output:

toTable(s)
percent count true false      p      q
rest     35.81 10000 3581  6419 0.3581 0.6419
peak 1    3.31 10000  331  9669 0.0331 0.9669
peak 2   55.75 10000 5575  4425 0.5575 0.4425
peak 3    4.55 10000  455  9545 0.0455 0.9545
peak 4    0.58 10000   58  9942 0.0058 0.9942

I'll keep trying to find the cause of your error, but if you could update the reproducible example to the precise code that brought about the error it will help me out. Thanks.

ADD REPLY
0
Entering edit mode

Updated and, yes, the code you used is what I also used. I get the same error w/ other gate types and datasets too, FWIW.

Thank you for the response and any additional assistance you can provide.

ADD REPLY
2
Entering edit mode
Jake Wagner ▴ 310
@jake-wagner-19995
Last seen 4.2 years ago

After carefully checking your session, I can reproduce your error. So it looks like attaching geneplotter is attaching annotate, which is attaching AnnotationDbi, which is masking flowCore::toTable(). I'll look in to the clash, but for now you can just explicitly ask for toTable from the flowCore namespace:

flowCore::toTable(s)
ADD COMMENT
0
Entering edit mode

Thank you for the help with this. I definitely would not have been able to track this down on my own. Appreciate the simple solution and quick follow-up. Cheers.

ADD REPLY
0
Entering edit mode

No problem. Hervé Pagès was kind enough to move the toTable generic to BiocGenerics to remove the masking issue from AnnotationDBI, so in the next release this shouldn't be a problem.

ADD REPLY

Login before adding your answer.

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