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 in var(x) : is.atomic(y) is not TRUE #76

Open
Liviacmg opened this issue Sep 7, 2024 · 5 comments
Open

Error in var(x) : is.atomic(y) is not TRUE #76

Liviacmg opened this issue Sep 7, 2024 · 5 comments
Assignees

Comments

@Liviacmg
Copy link

Liviacmg commented Sep 7, 2024

I am trying to run this tutorial https://ycl6.github.io/16S-Demo/4_picrust2_tutorial.html and the following error occurs:

set.seed(123)
system.time({
aldex2_EC = aldex(p2EC, metadata$fecal_sample_type, mc.samples = 500, test = "t", effect = TRUE, denom = "iqlr", verbose = TRUE)
})
aldex.clr: generating Monte-Carlo instances and clr values
conditions vector supplied
operating in serial mode
removed rows with sums equal to zero
computing iqlr centering

Error in var(x) : is.atomic(y) is not TRUE
13.stop(simpleError(msg, call = if (p <- sys.parent(1L)) sys.call(p)))
12.stopifnot(is.atomic(y))
11.var(x)
10.var(x)
9.FUN(newX[, i], ...)
8.apply(reads.clr[these.rows, ], 2, function(x) {
var(x)
})
7.iqlr.features(reads, conds)
6.aldex.set.mode(reads, conds, denom)
5.aldex.clr.function(as.data.frame(reads), conds, mc.samples, denom,
verbose, useMC, summarizedExperiment = FALSE, gamma)
4.aldex.clr(reads = reads, conds = conditions, mc.samples = mc.samples,
denom = denom, verbose = verbose, useMC = FALSE, gamma = gamma)
3.aldex.clr(reads = reads, conds = conditions, mc.samples = mc.samples,
denom = denom, verbose = verbose, useMC = FALSE, gamma = gamma)
2.aldex(p2EC, metadata$fecal_sample_type, mc.samples = 500, test = "t",
effect = TRUE, denom = "iqlr", verbose = TRUE)
1.system.time({
aldex2_EC = aldex(p2EC, metadata$fecal_sample_type, mc.samples = 500,
test = "t", effect = TRUE, denom = "iqlr", verbose = TRUE)
})

Timing stopped at: 1.217 0.014 1.224

@ggloor ggloor self-assigned this Sep 9, 2024
@ggloor
Copy link
Owner

ggloor commented Sep 9, 2024

Hmmm, this is usually a mismatch in input files.

can you provide a little bit more information on the format of the input files, and perhaps the first couple of lines?

@Liviacmg
Copy link
Author

Liviacmg commented Sep 9, 2024

Hmmm, this is usually a mismatch in input files.

can you provide a little bit more information on the format of the input files, and perhaps the first couple of lines?

The input files are the picrust2 output files:

picrust2 = "/pathway/"

#Import PICRUSt2 results

p2_EC = paste0(picrust2, "/EC_metagenome_out/pred_metagenome_unstrat.tsv.gz")
p2_KO = paste0(picrust2, "/KO_metagenome_out/pred_metagenome_unstrat.tsv.gz")
p2_PW = paste0(picrust2, "/pathways_out/path_abun_unstrat.tsv.gz")

#Load picrust2 output files

p2EC = as.data.frame(fread(p2_EC))
rownames(p2EC) = p2EC$"function"
p2EC = as.matrix(p2EC[,-1])
p2EC = round(p2EC)

p2KO = as.data.frame(fread(p2_KO))
rownames(p2KO) = p2KO$"function"
p2KO = as.matrix(p2KO[,-1])
p2KO = round(p2KO)

p2PW = as.data.frame(fread(p2_PW))
rownames(p2PW) = p2PW$"pathway"
p2PW = as.matrix(p2PW[,-1])
p2PW = round(p2PW)

#Reading metadata file

metadata <- read_q2metadata("/pathway/sample-metadata-picrust.txt")
metadata <- metadata[order(metadata$SampleID),]
metadata$maternal_obesity,<- as.character(metadata$maternal_obesity,)

#EC

set.seed(123)
system.time({
aldex2_EC = aldex(p2EC, metadata$maternal_obesity, mc.samples = 500, test = "t", effect = TRUE, denom = "iqlr", verbose = TRUE)
})

#First lines of the files:

#p2EC:

SRR1556302 SRR1556810 SRR1556811 SRR1556812 SRR1556813 SRR1556814
EC:1.1.1.1 1045 6592 2477 2972 2065 2894
EC:1.1.1.100 1809 6671 5951 6826 4398 6364

#metadata

SampleID maternal_obesity
#q2:types categorical
SRR1556302 Obese
SRR1556810 Obese
SRR1556811 Non-Obese
SRR1556812 Non-Obese

Both input files have matching rows and columns:

ncol(p2EC)
[1] 79
nrow(metadata)
[1] 79

@Liviacmg
Copy link
Author

When I run the script in my local machine it works, but when I try to run the exactly same scipt on a remote server it returns this error, even with different inputs.

@ggloor
Copy link
Owner

ggloor commented Sep 19, 2024

could you inspect the results of sessionInfo() from each machine after a clean start of the R session? my guess is that one of them has more recent R packages than the other.

@Liviacmg
Copy link
Author

Liviacmg commented Sep 20, 2024

the sessionInfo() from the one that does not work:

R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0

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

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

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

other attached packages:
[1] cowplot_1.1.3 egg_0.4.5 gridExtra_2.3 qiime2R_0.99.6 lubridate_1.9.3
[6] forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2 readr_2.1.5
[11] tidyr_1.3.1 tibble_3.2.1 ggplot2_3.5.1 tidyverse_2.0.0 ALDEx2_1.36.0
[16] latticeExtra_0.6-30 lattice_0.22-6 zCompositions_1.5.0-4 truncnorm_1.0-9 NADA_1.6-1.1
[21] survival_3.7-0 MASS_7.3-61 phyloseq_1.48.0 data.table_1.16.0 R.utils_2.12.3
[26] R.oo_1.26.0 R.methodsS3_1.8.2

loaded via a namespace (and not attached):
[1] RColorBrewer_1.1-3 rstudioapi_0.15.0 jsonlite_1.8.8
[4] magrittr_2.0.3 rmarkdown_2.25 zlibbioc_1.46.0
[7] vctrs_0.6.5 multtest_2.56.0 RCurl_1.98-1.14
[10] base64enc_0.1-3 htmltools_0.5.7 S4Arrays_1.4.1
[13] Rhdf5lib_1.22.1 SparseArray_1.4.8 Formula_1.2-5
[16] rhdf5_2.44.0 htmlwidgets_1.6.4 plyr_1.8.9
[19] igraph_2.0.1.1 lifecycle_1.0.4 iterators_1.0.14
[22] pkgconfig_2.0.3 Matrix_1.6-5 R6_2.5.1
[25] fastmap_1.1.1 GenomeInfoDbData_1.2.10 MatrixGenerics_1.16.0
[28] digest_0.6.34 colorspace_2.1-0 S4Vectors_0.38.2
[31] Hmisc_5.1-1 GenomicRanges_1.52.1 vegan_2.6-4
[34] RcppZiggurat_0.1.6 fansi_1.0.6 timechange_0.3.0
[37] abind_1.4-5 mgcv_1.9-1 compiler_4.4.1
[40] withr_3.0.0 htmlTable_2.4.2 backports_1.4.1
[43] BiocParallel_1.34.2 DelayedArray_0.30.1 biomformat_1.28.0
[46] permute_0.9-7 tools_4.4.1 foreign_0.8-86
[49] ape_5.7-1 nnet_7.3-19 glue_1.7.0
[52] quadprog_1.5-8 nlme_3.1-165 rhdf5filters_1.12.1
[55] grid_4.4.1 checkmate_2.3.1 cluster_2.1.6
[58] reshape2_1.4.4 ade4_1.7-22 generics_0.1.3
[61] gtable_0.3.5 tzdb_0.4.0 hms_1.1.3
[64] utf8_1.2.4 XVector_0.40.0 BiocGenerics_0.46.0
[67] foreach_1.5.2 pillar_1.9.0 splines_4.4.1
[70] deldir_2.0-4 directlabels_2024.1.21 tidyselect_1.2.0
[73] Biostrings_2.68.1 knitr_1.45 IRanges_2.34.1
[76] SummarizedExperiment_1.30.2 stats4_4.4.1 xfun_0.41
[79] Biobase_2.60.0 matrixStats_1.2.0 DT_0.31
[82] stringi_1.8.3 yaml_2.3.8 evaluate_0.23
[85] codetools_0.2-19 interp_1.1-6 cli_3.6.3
[88] RcppParallel_5.1.9 rpart_4.1.23 munsell_0.5.1
[91] Rcpp_1.0.12 GenomeInfoDb_1.36.4 png_0.1-7
[94] parallel_4.4.1 Rfast_2.1.0 jpeg_0.1-10
[97] bitops_1.0-7 scales_1.3.0 crayon_1.5.2
[100] rlang_1.1.4

the sessionInfo() from the one that works:

R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Brazil.utf8 LC_CTYPE=Portuguese_Brazil.utf8
[3] LC_MONETARY=Portuguese_Brazil.utf8 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.utf8

time zone: America/Sao_Paulo
tzcode source: internal

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

other attached packages:
[1] cowplot_1.1.3 egg_0.4.5 gridExtra_2.3 qiime2R_0.99.6
[5] lubridate_1.9.3 forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4
[9] purrr_1.0.2 readr_2.1.5 tidyr_1.3.1 tibble_3.2.1
[13] ggplot2_3.5.1 tidyverse_2.0.0 ALDEx2_1.36.0 latticeExtra_0.6-30
[17] lattice_0.22-6 zCompositions_1.5.0-4 truncnorm_1.0-9 NADA_1.6-1.1
[21] survival_3.6-4 MASS_7.3-60.2 data.table_1.16.0 phyloseq_1.48.0

loaded via a namespace (and not attached):
[1] RColorBrewer_1.1-3 rstudioapi_0.16.0 jsonlite_1.8.8
[4] magrittr_2.0.3 rmarkdown_2.28 zlibbioc_1.50.0
[7] vctrs_0.6.5 multtest_2.60.0 base64enc_0.1-3
[10] htmltools_0.5.8.1 S4Arrays_1.4.1 Rhdf5lib_1.26.0
[13] SparseArray_1.4.8 Formula_1.2-5 rhdf5_2.48.0
[16] htmlwidgets_1.6.4 plyr_1.8.9 igraph_2.0.3
[19] lifecycle_1.0.4 iterators_1.0.14 pkgconfig_2.0.3
[22] Matrix_1.7-0 R6_2.5.1 fastmap_1.2.0
[25] GenomeInfoDbData_1.2.12 MatrixGenerics_1.16.0 digest_0.6.37
[28] colorspace_2.1-1 S4Vectors_0.42.1 Hmisc_5.1-3
[31] GenomicRanges_1.56.1 vegan_2.6-8 RcppZiggurat_0.1.6
[34] fansi_1.0.6 timechange_0.3.0 httr_1.4.7
[37] abind_1.4-8 mgcv_1.9-1 compiler_4.4.1
[40] withr_3.0.1 htmlTable_2.4.3 backports_1.5.0
[43] BiocParallel_1.38.0 DelayedArray_0.30.1 biomformat_1.32.0
[46] permute_0.9-7 tools_4.4.1 foreign_0.8-86
[49] ape_5.8 nnet_7.3-19 glue_1.7.0
[52] quadprog_1.5-8 nlme_3.1-164 rhdf5filters_1.16.0
[55] grid_4.4.1 checkmate_2.3.2 cluster_2.1.6
[58] reshape2_1.4.4 ade4_1.7-22 generics_0.1.3
[61] gtable_0.3.5 tzdb_0.4.0 hms_1.1.3
[64] utf8_1.2.4 XVector_0.44.0 BiocGenerics_0.50.0
[67] foreach_1.5.2 pillar_1.9.0 splines_4.4.1
[70] deldir_2.0-4 directlabels_2024.1.21 tidyselect_1.2.1
[73] Biostrings_2.72.1 knitr_1.48 IRanges_2.38.1
[76] SummarizedExperiment_1.34.0 stats4_4.4.1 xfun_0.47
[79] Biobase_2.64.0 matrixStats_1.4.1 DT_0.33
[82] stringi_1.8.4 UCSC.utils_1.0.0 yaml_2.3.10
[85] evaluate_1.0.0 codetools_0.2-20 interp_1.1-6
[88] BiocManager_1.30.25 cli_3.6.3 RcppParallel_5.1.9
[91] rpart_4.1.23 munsell_0.5.1 Rcpp_1.0.13
[94] GenomeInfoDb_1.40.1 png_0.1-8 parallel_4.4.1
[97] Rfast_2.1.0 jpeg_0.1-10 scales_1.3.0
[100] crayon_1.5.3 rlang_1.1.4

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

2 participants