Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: filter,flowSet,filter fails: trying to generate an object from a virtual class ("tmixFilterResultList") #13

Open
malcook opened this issue Aug 14, 2015 · 2 comments

Comments

@malcook
Copy link

malcook commented Aug 14, 2015

I find that the flowCore glue fails where flowClust succeeds.

The following, using your example data, demonstrates the issue

fcsFile <- system.file("extdata", "0877408774.B08", package="flowCore")                                                                                                                                                                      
samp <-  read.FCS(fcsFile, transformation="linearize")                                                                                                                                                                                       
fc<-flowClust(samp,varNames=c( "FSC-H","SSC-H"), K=1:3, B=100)                                                                                                                                                                               
plot(fc,data=samp)
 # the above shows three clusters.  So far so good!                                                                                                                                                                                                   

# But, the following fails
s2filter <- tmixFilter("s2filter", c( "FSC-H","SSC-H"), K=1:3, B=100)                                                                                                                                                                        
res2f <- filter(samp, s2filter)                                                                                                                                                                                                              
The prior specification has no effect when usePrior=no                                                                                                                                                                                       
Using the parallel (multicore) version of flowClust with 4 cores                                                                                                                                                                             
Error in new("tmixFilterResultList", from, subSet = factor(Map(from[[from@index]],  :                                                                                                                                                        
 trying to generate an object from a virtual class ("tmixFilterResultList")    

All done with librarys from github

library(devtools)                                                                                                                                                                                                                            
install_github('RGLab/flowCore')                                                                                                                                                                                                             
install_github('RGLab/flowViz')                                                                                                                                                                                                              
install_github('RGLab/flowStats')                                                                                                                                                                                                            
install_github('RGLab/flowClust')                                                                                                                                                                                                            
install_github('RGLab/ggcyto')   

with

sessionInfo()                                                                                                                                                                                                                             
 R version 3.2.0 (2015-04-16)                                                                                                                                                                                                                
 Platform: x86_64-unknown-linux-gnu (64-bit)                                                                                                                                                                                                 
 Running under: CentOS release 6.6 (Final)                                                                                                                                                                                                   

 locale:                                                                                                                                                                                                                                     
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C  \
              LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C                                                                                                                                                      

 attached base packages:                                                                                                                                                                                                                     
  [1] grid      splines   parallel  stats     graphics  grDevices utils     datasets  methods   base                                                                                                                                         

 other attached packages:                                                                                                                                                                                                                    
  [1] hexbin_1.27.0           ggcyto_1.5              flowStats_3.27.0        flowWorkspace_3.15.15   gridExtra_2.0.0         ncdfFlow_2.15.3         BH_1.58.0-1             RcppArmadillo_0.5.300.4 cluster_2.0.1           mvoutlier_2.0.\
 6         sgeostat_1.0-25         fda_2.4.4               Matrix_1.2-1            flowClust_3.7.01        clue_0.3-50             corpcor_1.6.8           mnormt_1.5-3            flowViz_1.33.2          lattice_0.20-31         flowCore_\
 1.35.9         ellipse_0.3-8           RBGL_1.44.0             graph_1.46.0            Biobase_2.28.0                                                                                                                                       
 [25] BiocGenerics_0.14.0     data.table_1.9.4        scales_0.2.5            ggplot2_1.0.1           devtools_1.8.0                                                                                                                         

 loaded via a namespace (and not attached):                                                                                                                                                                                                  
  [1] httr_0.6.1            assertthat_0.1        stats4_3.2.0          latticeExtra_0.6-26   robustbase_0.92-5     chron_2.3-47          digest_0.6.8          RColorBrewer_1.1-2    colorspace_1.2-6      plyr_1.8.3            pcaPP_1.9-\
 60          XML_3.98-1.3          misc3d_0.8-4          zlibbioc_1.14.0       mvtnorm_1.0-3         git2r_0.10.1          proto_0.3-10          magrittr_1.5          IDPmisc_1.1.17        memoise_0.2.1         ks_1.9.4              GGa\
 lly_0.5.0          MASS_7.3-40           xml2_0.1.1            tools_3.2.0           stringr_1.0.0         MCMCpack_1.3-3                                                                                                                   
 [28] munsell_0.4.2         rversions_1.0.1       compiler_3.2.0        pls_2.4-3             RCurl_1.95-4.6        labeling_0.3          bitops_1.0-6          gtable_0.1.2          DBI_0.3.1             reshape_0.8.5         curl_0.8  \
             reshape2_1.4.1        rrcov_1.3-8           R6_2.1.0              robCompositions_1.9.1 knitr_1.10.5          dplyr_0.4.2           sROC_0.1-2            KernSmooth_2.23-14    Rgraphviz_2.12.0      stringi_0.5-5         Rcp\
 p_0.12.0           rgl_0.95.1247         DEoptimR_1.0-3        coda_0.17-1        
@SamGG
Copy link

SamGG commented Aug 14, 2015

While I can not answer about the filter function, I think that filtering is usually done using %in%. Have you try the following command? It works nicely. But Mike will provide you a better answer.

> res2f <- samp %in% s2filter
The prior specification has no effect when usePrior=no
Using the parallel (multicore) version of flowClust with 2 cores
> res2f
Object of class 'flowClustList' 
This object consists of a list of 'flowClust' elements, each of which has the following slots:
expName, varNames, K, w, mu, sigma, lambda, nu, z, u, label, uncertainty, ruleOutliers, flagOutliers, rm.min, rm.max, logLike, BIC, ICL, prior
> plot(res2f, data=samp)
Rule of identifying outliers: 90% quantile

@mikejiang
Copy link
Member

There is a unresolved design problem of tmixFilterResultList class.

here shows that flowCore::filter method invokes %in% method before trying to coerce the result to filterResult

When K is of length 1, %in% method returns a tmixFilterResult, which corresponds to multipleFilterResultand thus compatible with filterResult.

However, when K has length >1, %in% method returns a tmixFilterResultList, which is simply a list of tmixFilterResult and there is no equivalent class existing in flowCore. Thus the coerce method defined here is problematic.

The workaround will be looping through different K value and calling flowClust inside of the loop. e.g.

res2f <- lapply(1:3, function(k){
s2filter <- tmixFilter("s2filter", c( "FSC-H","SSC-H"), K=k, B=100)                                                                                                                                                                        
 filter(samp, s2filter)   })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants