LUMC / dgeAnalysis

R package with Shiny application for DGE analysis
MIT License
11 stars 5 forks source link

Errors with gam modeling #11

Closed Hayoung-hiro closed 3 years ago

Hayoung-hiro commented 4 years ago

Hello,

I found an error message when using this script.

when do gamConfidenceFit function,

this function can't find biasColumn.

and after fix it, gamModel argument doesn't created.

with

Error in terms.formula(reformulate(term[i])) : invalid model formula in ExtractVars'

I hope this comments helpful.

sincerely

tomkuipers1402 commented 4 years ago

Hi,

Could be a problem related to the broom package. I suggest you install an older version of broom: devtools::install_github("tidymodels/broom", ref="0.5.6")

This problem is fixed in the "develop" version, where the latest version of broom can be used again!

Hayoung-hiro commented 4 years ago

Thank you for your comment.

But, it didn't work for me.

tomkuipers1402 commented 4 years ago

Ok, in that case can you tell me:

As it has a problem with "biasColumn" I assume you are plotting a bias plot? If yes, on what value do you want the bias to be plotted, and what gene annotation file are you using?

Hayoung-hiro commented 4 years ago

Hi,

I used example dataset in this Git.

I found this errors when I do "Run analysis" with example data.

Then, I found gamConfidenceFit results called by ma_plot function were wrong.

In those function, gamConfidenceFit(deTab, avgLog2CPM)

"formula <- paste(gsub("columnHere", parse(text=biasColumn), formula))"

returns "avgLog2CPM didn't find"

then, I changed it to

gamConfidenceFit(deTab, deTab$avgLog2CPM)

but, "gamModel <- do.call(mgcv::gam, c(base.args, method.args))"

returns "in terms.formula(reformulate(term[i])) : invalid model formula in ExtractVars"

tomkuipers1402 commented 4 years ago

Yes, gamConfidenceFit(deTab, deTab$avgLog2CPM) won't work, as gamConfidenceFit() expects a string not a vector. The "original" gamConfidenceFit() input in ma_plot() shouldn't be changed, as it is correct and not the problem. Please send me the sessionInfo() of your current session which produces the first error message.

Hayoung-hiro commented 4 years ago

Here is my sessionInfo().

R version 3.6.3 (2020-02-29) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.1 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

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

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

other attached packages: [1] MASS_7.3-51.5 gam_1.20 foreach_1.5.0 reshape2_1.4.4 org.Mm.eg.db_3.10.0 org.Hs.eg.db_3.10.0
[7] AnnotationDbi_1.48.0 igraph_1.2.6 ReactomePA_1.30.0 graphite_1.32.0 DOSE_3.12.0 clusterProfiler_3.14.3
[13] plotly_4.9.2.1 ggplot2_3.3.2 broom_0.5.6 scales_1.1.1 tidyr_1.1.2 DESeq2_1.26.0
[19] edgeR_3.28.1 limma_3.42.2 SummarizedExperiment_1.16.1 DelayedArray_0.12.3 BiocParallel_1.20.1 matrixStats_0.57.0
[25] GenomicRanges_1.38.0 GenomeInfoDb_1.22.1 IRanges_2.20.2 S4Vectors_0.24.4 knitr_1.30 BiocManager_1.30.10
[31] shinyjs_2.0.0 shinycssloaders_1.0.0 shinyWidgets_0.5.4 shinydashboard_0.7.1 shiny_1.5.0 dgeAnalysis_1.1.0
[37] devtools_2.3.2 usethis_1.6.3 proDA_1.0.0 Biobase_2.46.0 BiocGenerics_0.32.0

loaded via a namespace (and not attached): [1] rappdirs_0.3.1 pkgmaker_0.31.1 bit64_4.0.5 data.table_1.13.0 rpart_4.1-15 RCurl_1.98-1.2 doParallel_1.0.15
[8] generics_0.0.2 snow_0.4-3 preprocessCore_1.48.0 cowplot_1.1.0 callr_3.5.0 RSQLite_2.2.1 europepmc_0.4
[15] bit_4.0.4 enrichplot_1.6.1 xml2_1.3.2 httpuv_1.5.4 assertthat_0.2.1 viridis_0.5.1 xfun_0.18
[22] hms_0.5.3 evaluate_0.14 promises_1.1.1 progress_1.2.2 fansi_0.4.1 dendextend_1.14.0 DBI_1.1.0
[29] geneplotter_1.64.0 htmlwidgets_1.5.2 purrr_0.3.4 ellipsis_0.3.1 crosstalk_1.1.0.1 RSpectra_0.16-0 dplyr_1.0.2
[36] backports_1.1.10 annotate_1.64.0 gridBase_0.4-7 vctrs_0.3.4 remotes_2.2.0 imputeLCMD_2.0 withr_2.3.0
[43] ggforce_0.3.2 triebeard_0.3.0 checkmate_2.0.0 prettyunits_1.1.1 cluster_2.1.0 lazyeval_0.2.2 crayon_1.3.4
[50] genefilter_1.68.0 pkgconfig_2.0.3 tweenr_1.0.1 nlme_3.1-144 pkgload_1.1.0 ProtGenerics_1.18.0 nnet_7.3-13
[57] rlang_0.4.8 lifecycle_0.2.0 miniUI_0.1.1.1 sandwich_2.5-1 registry_0.5-1 affyio_1.56.0 doSNOW_1.0.18
[64] rprojroot_1.3-2 polyclip_1.10-0 graph_1.64.0 DEqMS_1.4.0 rngtools_1.5 urltools_1.7.3 Matrix_1.2-18
[71] zoo_1.8-8 DEP_1.8.0 base64enc_0.1-3 pheatmap_1.0.12 ggridges_0.5.2 GlobalOptions_0.1.2 processx_3.4.4
[78] png_0.1-7 viridisLite_0.3.0 rjson_0.2.20 mzR_2.20.0 bitops_1.0-6 blob_1.2.1 shape_1.4.5
[85] stringr_1.4.0 qvalue_2.18.0 M3C_1.8.0 gridGraphics_0.5-0 readr_1.3.1 jpeg_0.1-8.1 tmvtnorm_1.4-10
[92] reactome.db_1.70.0 memoise_1.1.0 magrittr_1.5 plyr_1.8.6 bibtex_0.4.2.3 zlibbioc_1.32.0 compiler_3.6.3
[99] RColorBrewer_1.1-2 pcaMethods_1.78.0 clue_0.3-57 cli_2.0.2 affy_1.64.0 XVector_0.26.0 ps_1.4.0
[106] htmlTable_2.1.0 Formula_1.2-3 mgcv_1.8-31 tidyselect_1.1.0 vsn_3.54.0 stringi_1.5.3 yaml_2.2.1
[113] GOSemSim_2.12.1 askpass_1.1 locfit_1.5-9.4 norm_1.0-9.5 latticeExtra_0.6-29 MALDIquant_1.19.3 ggrepel_0.8.2
[120] sigclust_1.1.0 grid_3.6.3 fastmatch_1.1-0 tools_3.6.3 matrixcalc_1.0-3 circlize_0.4.10 rstudioapi_0.11
[127] foreign_0.8-75 gridExtra_2.3 farver_2.0.3 mzID_1.24.0 Rtsne_0.15 ggraph_2.0.3 rvcheck_0.1.8
[134] digest_0.6.25 Rcpp_1.0.5 later_1.1.0.1 ncdf4_1.17 httr_1.4.2 MSnbase_2.12.0 ComplexHeatmap_2.2.0
[141] colorspace_1.4-1 esquisse_0.3.1 XML_3.99-0.3 fs_1.5.0 reticulate_1.16 umap_0.2.6.0 graphlayouts_0.7.0
[148] gmm_1.6-5 ggplotify_0.0.5 sessioninfo_1.1.1 xtable_1.8-4 jsonlite_1.7.1 tidygraph_1.2.0 corpcor_1.6.9
[155] testthat_2.3.2 R6_2.4.1 Hmisc_4.4-1 pillar_1.4.6 htmltools_0.5.0 mime_0.9 NMF_0.23.0
[162] glue_1.4.2 fastmap_1.0.1 DT_0.15 codetools_0.2-16 fgsea_1.12.0 pkgbuild_1.1.0 mvtnorm_1.1-1
[169] lattice_0.20-40 tibble_3.0.3 curl_4.3 GO.db_3.10.0 openssl_1.4.3 survival_3.1-8 rmarkdown_2.4
[176] desc_1.2.0 munsell_0.5.0 DO.db_2.9 GetoptLong_1.0.2 GenomeInfoDbData_1.2.2 iterators_1.0.12 impute_1.60.0
[183] gtable_0.3.0

tomkuipers1402 commented 4 years ago

Ok, no major problems in your session info, please start a new R session and load dgeAnalysis again. If you still get the same warning, you can try the latest develop version by installing: devtools::install_github("LUMC/dgeAnalysis", ref='develop')

This is the latest development version, using the latest package versions as well. Required packages will also be updated when installing this version.

Hayoung-hiro commented 4 years ago

I tried development versions.

but another error on ma_plot was occurred "Error : arguments imply differing number of rows: 500, 0"

other bias plot which would uses "biasColumn" works well.

Thanks for your kindness answer.

tomkuipers1402 commented 4 years ago

Just to be sure, as you are working on an ubuntu/linux environment, did you install these libraries?:

Hayoung-hiro commented 4 years ago

Sure. I confirmed those libraries were installed on my server, but still got same error.

tomkuipers1402 commented 4 years ago

I've not been able to replicate your problems using the same package versions you send me in the sessionInfo(). In this case I suggest you remove R and its libraries completely and reinstall R, followed by: install.packages("devtools") devtools::install_github("LUMC/dgeAnalysis", ref='develop') dgeAnalysis::startApp() As there might be an internal problem with one of your packages, causing your problems.

Another option is to use the Dockerfile in this repo to create a docker container yourself. I can also share one with you, if you prefer that option. If so, please send me your email, so I can send you a download link.