andreasmock / MetaboDiff

29 stars 4 forks source link

error while using calculate_MS function #1

Open rajanikanthnmsu opened 6 years ago

rajanikanthnmsu commented 6 years ago

Hi Andreas Mock,

Thanks for the nice R package to perform basic Metabolomic analysis. I was able to get through most of the steps. However, i got an error while calculating the module significance in relating sample trait to the module. The following is the error and the session info. Could please see if there is bug in the function. I looked into it, but nothing was obvious.

met_example <- calculate_MS(met_example, group_factors = c("trmnt", "LQ"))

Error in $<-.data.frame(*tmp*, av_fold_change, value = c(0, -0.499286089069959, : replacement has 87 rows, data has 86

sessionInfo() R version 3.4.3 (2017-11-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages: [1] WGCNA_1.63 fastcluster_1.1.25 dynamicTreeCut_1.63-1 MetaboDiff_0.9.2
[5] forcats_0.3.0 stringr_1.3.0 dplyr_0.7.4 purrr_0.2.4
[9] readr_1.1.1 tidyr_0.8.0 tibble_1.4.2 ggplot2_2.2.1
[13] tidyverse_1.2.1 ComplexHeatmap_1.17.1 MultiAssayExperiment_1.4.9 SummarizedExperiment_1.8.1 [17] DelayedArray_0.4.1 matrixStats_0.53.1 Biobase_2.38.0 GenomicRanges_1.30.3
[21] GenomeInfoDb_1.14.0 IRanges_2.12.0 S4Vectors_0.16.0 BiocGenerics_0.24.0
[25] devtools_1.13.5 BiocInstaller_1.28.0

loaded via a namespace (and not attached): [1] readxl_1.1.0 backports_1.1.2 circlize_0.4.4 Hmisc_4.1-1
[5] plyr_1.8.4 lazyeval_0.2.1 shinydashboard_0.7.0 splines_3.4.3
[9] robust_0.4-18 digest_0.6.15 foreach_1.4.4 htmltools_0.3.6
[13] GO.db_3.5.0 magrittr_1.5 checkmate_1.8.5 memoise_1.1.0
[17] fit.models_0.5-14 cluster_2.0.6 doParallel_1.0.11 limma_3.34.9
[21] annotate_1.56.2 modelr_0.1.2 colorspace_1.3-2 blob_1.1.1
[25] rvest_0.3.2 rrcov_1.4-4 haven_1.1.1 crayon_1.3.4
[29] RCurl_1.95-4.10 jsonlite_1.5 genefilter_1.60.0 bindr_0.1.1
[33] impute_1.52.0 ape_5.1 survival_2.41-3 iterators_1.0.9
[37] glue_1.2.0 gtable_0.2.0 zlibbioc_1.24.0 XVector_0.18.0
[41] GetoptLong_0.1.7 shape_1.4.4 DEoptimR_1.0-8 scales_0.5.0
[45] vsn_3.46.0 mvtnorm_1.0-7 DBI_0.8 Rcpp_0.12.16
[49] xtable_1.8-2 htmlTable_1.11.2 foreign_0.8-69 bit_1.1-12
[53] preprocessCore_1.40.0 Formula_1.2-2 tsne_0.1-3 htmlwidgets_1.0
[57] httr_1.3.1 RColorBrewer_1.1-2 acepack_1.4.1 XML_3.98-1.10
[61] pkgconfig_2.0.1 nnet_7.3-12 labeling_0.3 rlang_0.2.0
[65] reshape2_1.4.3 AnnotationDbi_1.40.0 munsell_0.4.3 cellranger_1.1.0
[69] tools_3.4.3 cli_1.0.0 RSQLite_2.1.0 broom_0.4.4
[73] yaml_2.1.18 knitr_1.20 bit64_0.9-7 robustbase_0.92-8
[77] bindrcpp_0.2.2 nlme_3.1-131 mime_0.5 xml2_1.2.0
[81] compiler_3.4.3 rstudioapi_0.7 curl_3.2 affyio_1.48.0
[85] pcaPP_1.9-73 stringi_1.1.7 lattice_0.20-35 Matrix_1.2-12
[89] psych_1.8.4 pillar_1.2.1 GlobalOptions_0.1.0 data.table_1.10.4-3
[93] cowplot_0.9.3 bitops_1.0-6 httpuv_1.3.6.2 R6_2.2.2
[97] latticeExtra_0.6-28 affy_1.56.0 gridExtra_2.3 codetools_0.2-15
[101] MASS_7.3-47 assertthat_0.2.0 rjson_0.2.20 withr_2.1.2
[105] mnormt_1.5-5 GenomeInfoDbData_1.0.0 hms_0.4.2 rpart_4.1-11
[109] git2r_0.21.0 shiny_1.0.5 lubridate_1.7.4 base64enc_0.1-3

Thank you.

Raj

ManjotVirdee commented 5 years ago

Hello Raj,

I have encountered the same error you have. After looking into the calculate_MS() function code I implemented my solution from the 'na_heatmap()' issue; which in this case goes as follows:

trace(calculate_MS, edit=TRUE) # change line 10 from: for (x in 1:nrow(df)) { # to: for (x in 1:nrow(res_df)) {

I am reasonably certain that this solves the problem, but my data does not differentiate between subgroups. Good luck Raj,

Best, M. Virdee

andreasmock commented 5 years ago

Dear Manjot, Dear Raj,

I was not able to reproduce your error. Did you also have the same error when running the example code?

calculate_MS(met_example, group_factors = c("tumor_normal","random_gender"))

Best, Andreas

RDastgh1 commented 4 years ago

I have the same error in certain datasets, it is solved by editing the calculate_MS() function as Raj suggested. I do not have that error when using the example code, I assume because there are fewer significant modules.