GabrielHoffman / variancePartition

Quantify and interpret divers of variation in multilevel gene expression experiments
http://gabrielhoffman.github.io/variancePartition/
60 stars 14 forks source link

Error in if (inherits(possibleError, "error") && grep("the fixed-effects model matrix is column rank deficient", : missing value where TRUE/FALSE needed #96

Closed sdwang008 closed 5 months ago

sdwang008 commented 8 months ago

Hello, I have run into this error when running fitExtractVarPartModel: Error in if (inherits(possibleError, "error") && grep("the fixed-effects model matrix is column rank deficient", : missing value where TRUE/FALSE needed

I see that this issue has been reported several times and it's usually have to do with the formula design or levels not having enough observations, but even when I reduce it to a very simple formula, I still get this error.

Currently I have a 1000x200 (gene x sample) matrix object, and my formula is ~ Age + (1 | Smoker) which should be simple enough. Age is continuous and Smoker is binary (Yes or No). No NAs in either columns.

Full error:

Error in if (inherits(possibleError, "error") && grep("the fixed-effects model matrix is column rank deficient", : missing value where TRUE/FALSE needed
3..fitExtractVarPartModel(exprObj, formula, data, REML = REML, useWeights = useWeights, weightsMatrix = weightsMatrix, showWarnings = showWarnings, control = control, quiet = quiet, BPPARAM = BPPARAM, ...)
2.fitExtractVarPartModel(vst.matrix.ACSg.var[select.ACSg.var, ], form, metadata.ACSg)
1.fitExtractVarPartModel(vst.matrix.ACSg.var[select.ACSg.var, ], form, metadata.ACSg)

sessionInfo:

R version 4.3.1 (2023-06-16)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /nfs/sw/miniconda3/miniconda3-3.22.0/envs/R-4.2.3/lib/libopenblasp-r0.3.24.so;  LAPACK version 3.11.0

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   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: America/New_York
tzcode source: system (glibc)

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

other attached packages:
 [1] variancePartition_1.30.2    BiocParallel_1.34.2         limma_3.56.2                ggplot2_3.4.4               dplyr_1.1.3                
 [6] readxl_1.4.3                DESeq2_1.38.3               SummarizedExperiment_1.30.2 Biobase_2.60.0              MatrixGenerics_1.12.3      
[11] matrixStats_1.0.0           GenomicRanges_1.52.0        GenomeInfoDb_1.36.3         IRanges_2.34.1              S4Vectors_0.38.2           
[16] BiocGenerics_0.46.0        

loaded via a namespace (and not attached):
 [1] Rdpack_2.5              DBI_1.1.3               bitops_1.0-7            rlang_1.1.1             magrittr_2.0.3          compiler_4.3.1         
 [7] RSQLite_2.3.1           reshape2_1.4.4          png_0.1-8               vctrs_0.6.4             stringr_1.5.0           pkgconfig_2.0.3        
[13] crayon_1.5.2            fastmap_1.1.1           backports_1.4.1         XVector_0.40.0          caTools_1.18.2          utf8_1.2.4             
[19] nloptr_2.0.3            purrr_1.0.2             bit_4.0.5               xfun_0.40               zlibbioc_1.46.0         cachem_1.0.8           
[25] progress_1.2.2          EnvStats_2.8.1          blob_1.2.4              remaCor_0.0.16          DelayedArray_0.26.7     broom_1.0.5            
[31] parallel_4.3.1          prettyunits_1.1.1       R6_2.5.1                stringi_1.7.12          RColorBrewer_1.1-3      boot_1.3-28.1          
[37] cellranger_1.1.0        Rcpp_1.0.11             iterators_1.0.14        knitr_1.45              Matrix_1.6-5            splines_4.3.1          
[43] tidyselect_1.2.0        rstudioapi_0.15.0       abind_1.4-5             doParallel_1.0.17       gplots_3.1.3            codetools_0.2-19       
[49] plyr_1.8.9              lattice_0.22-5          tibble_3.2.1            withr_2.5.2             KEGGREST_1.40.0         Biostrings_2.68.1      
[55] pillar_1.9.0            KernSmooth_2.23-22      foreach_1.5.2           generics_0.1.3          RCurl_1.98-1.12         hms_1.1.3              
[61] munsell_0.5.0           scales_1.2.1            aod_1.3.2               minqa_1.2.6             gtools_3.9.4            xtable_1.8-4           
[67] RhpcBLASctl_0.23-42     glue_1.6.2              tools_4.3.1             lme4_1.1-34             annotate_1.78.0         locfit_1.5-9.8         
[73] mvtnorm_1.2-3           XML_3.99-0.14           grid_4.3.1              tidyr_1.3.0             rbibutils_2.2.15        AnnotationDbi_1.62.2   
[79] colorspace_2.1-0        nlme_3.1-163            GenomeInfoDbData_1.2.10 cli_3.6.1               fansi_1.0.5             S4Arrays_1.2.0         
[85] gtable_0.3.4            pbkrtest_0.5.2          geneplotter_1.78.0      memoise_2.0.1           lifecycle_1.0.3         httr_1.4.7             
[91] bit64_4.0.5             MASS_7.3-60

Please share some advice on why this error is happening. Thanks!

sdwang008 commented 8 months ago

Very quick update: this error happens on a managed hpc environment. When I moved to my own computer the error does not occur. Although I'm still not clear on why this is happening. Is it a version issue?

Local sessionInfo:

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.3.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

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

other attached packages:
 [1] variancePartition_1.32.5    BiocParallel_1.36.0         limma_3.58.1               
 [4] ggplot2_3.5.0               DESeq2_1.42.0               SummarizedExperiment_1.32.0
 [7] Biobase_2.62.0              MatrixGenerics_1.14.0       matrixStats_1.2.0          
[10] GenomicRanges_1.54.1        GenomeInfoDb_1.38.6         IRanges_2.36.0             
[13] S4Vectors_0.40.2            BiocGenerics_0.48.1        

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.0        farver_2.1.1            dplyr_1.1.4            
 [4] bitops_1.0-7            fastmap_1.1.1           RCurl_1.98-1.14        
 [7] digest_0.6.34           lifecycle_1.0.4         statmod_1.5.0          
[10] magrittr_2.0.3          compiler_4.3.1          rlang_1.1.3            
[13] tools_4.3.1             utf8_1.2.4              knitr_1.45             
[16] labeling_0.4.3          S4Arrays_1.2.0          DelayedArray_0.28.0    
[19] plyr_1.8.9              abind_1.4-5             KernSmooth_2.23-22     
[22] withr_3.0.0             purrr_1.0.2             numDeriv_2016.8-1.1    
[25] grid_4.3.1              aod_1.3.3               fansi_1.0.6            
[28] caTools_1.18.2          colorspace_2.1-0        scales_1.3.0           
[31] gtools_3.9.5            iterators_1.0.14        MASS_7.3-60.0.1        
[34] mvtnorm_1.2-4           cli_3.6.2               crayon_1.5.2           
[37] generics_0.1.3          rstudioapi_0.15.0       reshape2_1.4.4         
[40] minqa_1.2.6             stringr_1.5.1           zlibbioc_1.48.0        
[43] splines_4.3.1           parallel_4.3.1          XVector_0.42.0         
[46] vctrs_0.6.5             boot_1.3-30             Matrix_1.6-5           
[49] pbkrtest_0.5.2          locfit_1.5-9.8          tidyr_1.3.1            
[52] glue_1.7.0              nloptr_2.0.3            codetools_0.2-19       
[55] stringi_1.8.3           gtable_0.3.4            EnvStats_2.8.1         
[58] lme4_1.1-35.1           lmerTest_3.1-3          munsell_0.5.0          
[61] tibble_3.2.1            remaCor_0.0.18          pillar_1.9.0           
[64] htmltools_0.5.7         gplots_3.1.3.1          GenomeInfoDbData_1.2.11
[67] R6_2.5.1                Rdpack_2.6              lattice_0.22-5         
[70] rbibutils_2.2.16        backports_1.4.1         RhpcBLASctl_0.23-42    
[73] broom_1.0.5             fANCOVA_0.6-1           corpcor_1.6.10         
[76] Rcpp_1.0.12             SparseArray_1.2.4       nlme_3.1-164           
[79] xfun_0.42               pkgconfig_2.0.3
GabrielHoffman commented 8 months ago

It looks like it’s a bug in variancePartition_1.30.2 that’s been fixed in variancePartition_1.32.5