kkdey / CountClust

A R package for Grade of Membership model and Visualization of counts data:
31 stars 11 forks source link

Error in if (QNup$L < L) { : missing value where TRUE/FALSE needed #22

Closed lisabang closed 7 years ago

lisabang commented 8 years ago

Was just trying it out; I get an output of Error in if (QNup$L < L) { : missing value where TRUE/FALSE needed

With the debugging function in RStudio it can be traced to the tpxfit function in maptpx. probably an error in one of the if statements.

Maybe another version of maptpx would work for this, as a stopgap solution. could you let me know which?

> FitGoM(t(deng.counts),
+        K=c(3,6), tol=0.1,
+        path_rda="/data/Deng2014MouseEsc.rda")
Fitting the topic model (due to Matt Taddy)

Estimating on a 259 document collection.
Fit and Bayes Factor Estimation for K = 3
log posterior increase: 
Error in if (QNup$L < L) { : missing value where TRUE/FALSE needed 

Traceback:

 Error in if (QNup$L < L) { : missing value where TRUE/FALSE needed 
9 tpxfit(X = X, theta = initheta, alpha = alpha, tol = tol, verb = verb, 
    admix = admix, grp = grp, tmax = tmax, wtol = wtol, qn = qn) 
8 tpxSelect(X, K, bf, initopics, alpha = shape, tol, kill, verb, 
    ...) 
7 topics(as.matrix(data), K = per_clust, control$shape, control$initopics, 
    tol, control$bf, control$ill, control$ord, control$verb) 
6 withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning")) 
5 suppressWarnings(out <- topics(as.matrix(data), K = per_clust, 
    control$shape, control$initopics, tol, control$bf, control$ill, 
    control$ord, control$verb)) 
4 FUN(X[[i]], ...) 
3 lapply(K, function(per_clust) {
    suppressWarnings(out <- topics(as.matrix(data), K = per_clust, 
        control$shape, control$initopics, tol, control$bf, control$ill, 
        control$ord, control$verb)) ... 
2 lapply(K, function(per_clust) {
    suppressWarnings(out <- topics(as.matrix(data), K = per_clust, 
        control$shape, control$initopics, tol, control$bf, control$ill, 
        control$ord, control$verb)) ... 
1 FitGoM(t(deng.counts), K = c(3, 6), tol = 0.1, path_rda = "/data/Deng2014MouseEsc.rda") 
kkdey commented 8 years ago

Hi Lisa,

We have been making changes to the maptpx function.. There is a more updated version of it that you can install by

library(devtools)
install_github("kkdey/maptpx")

or

library(devtools)
install_github("TaddyLab/maptpx")

Can you check if this version works?

Thanks

lisabang commented 8 years ago

It seemed to work at first! Since I'm on a mac, I did run into an lgfortran and lquadmath error, just fyi: http://www.thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/

but after using the coatlessprofessor's solution, still run into this error:

Fitting the topic model (due to Matt Taddy)

Estimating on a 259 document collection.
Fit and Bayes Factor Estimation for K = 3
log posterior increase: 3680128824.8, 790780.1, 13284094.4, 8592054.7, 10301003.7, 8230878.7, 4037504.8, 3344640.6, 2051205.7, 1584813.5, 1688064.7, 1418035.7, 1061327.9, 1014910.5, 837036.4, 691482.4, 477127.7, 278532.8, 187311.3, 116721.2, 71006.3, 45085.6, 36701.2, 29171.1, 34219.4, 44490.4, 45890.7, 31863, 34211, 34839.6, 37652.3, 37439.1, 36053.4, 37694.9, 36294.4, 39743.1, 30702.8, 38808.3, 25027.3, 22604.5, 19281.2, 14860.1, 7701.1, 5801.1, 4153, 2443.2, 1640.1, 1893.4, 1757.5, 1505.8, 1192.8, 663.9, 385.2, 282.2, 270.2, 277.6, 214.2, 120.9, 76.1, 68.2, 62.6, 58.5, 59.5, 53.9, 44.9, 39.9, 34.9, 29.7, 25.8, 22.9, 20.4, 17.9, 15, 12.1, 9.7, 8, 6.7, 5.8, 5.2, 4.8, 4.4, 4, 3.7, 3.4, 3.1, 3, 2.9, 2.9, 3, 2.9, 2.7, 2.4, 2.1, 1.7, 1.5, 1.3, 1.1, 1, 1, 0.9, p 22431 iter 1000 diff 1
0.9, 0.8, 0.8, 0.7, 0.7, 0.6, 0.6, 0.5, 0.5, 0.4, 0.4, 0.4, 0.3, 0.3, 0.3, 0.3, 0.3, 0.2, 0.2, 0.2, 0.2, 0.2, 0.1, 0.1, 0.1, done.
log BF( 3 ) = NA
NAN for Bayes factor.
Error in base::colSums(x, na.rm, dims, ...) : 
  'x' must be an array of at least two dimensions

I see that this error has been mentioned in a now-deleted stackoverflow post: http://webcache.googleusercontent.com/search?q=cache:ikJY2-mnft0J:stackoverflow.com/questions/31604055/error-in-colsumsn-na-rm-true-x-must-be-an-array-of-at-least-two-dimensi+&cd=1&hl=en&ct=clnk&gl=us

however the StructureGGplot works beautifully! so perhaps it doesn't really matter...

kkdey commented 8 years ago

Thanks for the feedback and the heads up on the lgfortran lquadmath stuff, I would add that as an issue too as I am sure other users may face similar problem.

I modified the maptpx function, it seemed to work on my demo example, can you try re-installing the Github version kkdey/maptpx again and run the function again?

Thanks for your patience

lisabang commented 7 years ago

Hi, Sorry for not closing this issue earlier. This has been working great.

eacton commented 7 years ago

Hi @kkdey. I also ran into this error, which was solved by your updated maptpx at install_github("kkdey/maptpx"). Could you update your README to install your version of maptpx? I had installed from install_github("TaddyLab/maptpx") as recommended in the CountClust pdf on Bioconductor, but it could save some time if the correction is in the README instead of rooting through issues. Thanks!

kkdey commented 7 years ago

Hi Erica,

Sorry for the inconvenience caused. I very recently got access to update the TaddyLab/maptpx repository and now it is in sync with the version on kkdey/maptpx. Also for later updates to the package, the TaddyLab/maptpx will have the most recent version. Thanks for your suggestions and for using CountClust !!

GuidoLeoni commented 6 years ago

Hi @kkdey Also In my case I'm running the tutorial

and after running FitGoM(t(gtex.counts), K=2:4, tol=0.1, path_rda="GTExV6Brain.FitGoM.rda")

I retrieve the the Error in if (QNup$L < L) { : missing value where TRUE/FALSE needed

I installed maptx from TaddyLab rep without any success. Thank you Guido

sessionInfo() R version 3.4.4 (2018-03-15) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.4 LTS

Matrix products: default BLAS: /usr/lib/libblas/libblas.so.3.6.0 LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

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

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

other attached packages: [1] Biobase_2.38.0 BiocGenerics_0.24.0 devtools_1.13.6 CountClust_1.4.1 ggplot2_3.0.0 BiocInstaller_1.28.0

loaded via a namespace (and not attached): [1] Rcpp_0.12.17 git2r_0.23.0 pillar_1.3.0 compiler_3.4.4 plyr_1.8.3 bindr_0.1.1 tools_3.4.4
[8] digest_0.6.9 memoise_1.1.0 nlme_3.1-137 tibble_1.4.2 gtable_0.1.2 lattice_0.20-35 mgcv_1.8-24
[15] pkgconfig_2.0.1 rlang_0.2.1 Matrix_1.2-14 curl_3.2 yaml_2.2.0 bindrcpp_0.2.2 httr_1.3.1
[22] cluster_2.0.7-1 withr_2.1.2 dplyr_0.7.6 stringr_1.0.0 gtools_3.5.0 stats4_3.4.4 grid_3.4.4
[29] nnet_7.3-12 tidyselect_0.2.4 cowplot_0.9.3 glue_1.3.0 R6_2.2.2 maptpx_1.9-5 flexmix_2.3-14
[36] limma_3.34.9 reshape2_1.4 purrr_0.2.5 magrittr_1.5 MASS_7.3-50 scales_0.5.0 modeltools_0.2-22 [43] assertthat_0.2.0 permute_0.9-4 ape_5.1 picante_1.7 colorspace_1.2-4 stringi_1.0-1 lazyeval_0.2.1
[50] munsell_0.4.2 slam_0.1-43 vegan_2.5-2 crayon_1.3.4

kkdey commented 6 years ago

@GuidoLeoni From the sessionInfo() output, it does look like you have the latest version of maptpx package. I am wondering if the maptpx you install with CountClust is over-riding the one you load from TaddyLab/maptpx.

Can you try

library(CountClust) library(maptpx) FitGoM(t(gtex.counts), K=2:4, tol=0.1, path_rda="GTExV6Brain.FitGoM.rda")

Can you check if the exact order of the code as in the README currently is how you ran it?

Let me know if that works for you !

Kushal