Open Don86 opened 3 years ago
Hi, I can confirm the issue on linux, which is quite a relief as this is now reproducible and not operating system specific. Yours, Steffen
R version 4.0.3 (2020-10-10)
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=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=de_DE.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=de_DE.UTF-8 LC_NAME=de_DE.UTF-8
[9] LC_ADDRESS=de_DE.UTF-8 LC_TELEPHONE=de_DE.UTF-8
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=de_DE.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RMassBankData_1.26.0 RMassBank_2.99.4 Rcpp_1.0.4.6
[4] pacman_0.5.1
loaded via a namespace (and not attached):
[1] gtools_3.8.2 tidyselect_1.0.0 purrr_0.3.4
[4] rJava_0.9-13 lattice_0.20-41 colorspace_1.4-1
[7] vctrs_0.3.2 stats4_4.0.3 yaml_2.2.1
[10] fingerprint_3.5.7 vsn_3.56.0 XML_3.99-0.3
[13] rlang_0.4.7 pillar_1.4.4 glue_1.4.0
[16] MSnbase_2.15.7 mzR_2.23.1 BiocParallel_1.22.0
[19] affy_1.66.0 BiocGenerics_0.34.0 affyio_1.58.0
[22] foreach_1.5.0 lifecycle_0.2.0 plyr_1.8.6
[25] mzID_1.26.0 ProtGenerics_1.20.0 zlibbioc_1.34.0
[28] munsell_0.5.0 pcaMethods_1.80.0 gtable_0.3.0
[31] rcdklibs_2.3 caTools_1.18.0 codetools_0.2-16
[34] Biobase_2.48.0 IRanges_2.22.1 doParallel_1.0.15
[37] parallel_4.0.3 itertools_0.1-3 preprocessCore_1.50.0
[40] KernSmooth_2.23-17 scales_1.1.0 BiocManager_1.30.10
[43] gdata_2.18.0 limma_3.44.1 rcdk_3.5.0
[46] S4Vectors_0.26.0 gplots_3.0.3 impute_1.62.0
[49] rjson_0.2.20 ggplot2_3.3.0 png_0.1-7
[52] digest_0.6.25 dplyr_0.8.5 ncdf4_1.17
[55] grid_4.0.3 bitops_1.0-6 magrittr_1.5
[58] tibble_3.0.1 crayon_1.3.4 pkgconfig_2.0.3
[61] MASS_7.3-53 ellipsis_0.3.0 assertthat_0.2.1
[64] httr_1.4.1 iterators_1.0.12 R6_2.4.1
[67] MALDIquant_1.19.3 compiler_4.0.3
The traceback()
is
> filtered <- selectPeaks(w, good=TRUE, bad=FALSE, cleaned=TRUE)
Error in eval(f, o, enclos) & !is.na(eval(f, o, enclos)) :
operations are possible only for numeric, logical or complex types
In addition: Warning message:
In is.na(eval(f, o, enclos)) :
is.na() applied to non-(list or vector) of type 'environment'
> traceback()
8: `[.data.frame`(o, eval(f, o, enclos) & !is.na(eval(f, o, enclos)),
, drop = FALSE)
7: o[eval(f, o, enclos) & !is.na(eval(f, o, enclos)), , drop = FALSE]
6: .local(o, ...)
5: selectPeaks(o@aggregated, ..., enclos)
4: selectPeaks(o@aggregated, ..., enclos)
3: .local(o, ...)
2: selectPeaks(w, good = TRUE, bad = FALSE, cleaned = TRUE)
1: selectPeaks(w, good = TRUE, bad = FALSE, cleaned = TRUE)
and seems to come from https://github.com/MassBank/RMassBank/blob/00101559ae3ab1c841c8026366216abde278d07b/R/AggregateMethods.R#L78
o
looks OK:
Browse[3]> o[1:3,1:3]
mzFound intensity good
1_3_Chlorophenyl_piperazin_2818_pos.mzML.7 70.06518 29053.22 TRUE
1_3_Chlorophenyl_piperazin_2818_pos.mzML.18 110.99966 12117.51 TRUE
1_3_Chlorophenyl_piperazin_2818_pos.mzML.19 117.05731 19145.07 TRUE
filter
is an environment with
Browse[3]> ls(filter)
[1] "fn_ls" "RMassBank.env" "w"
Browse[3]> filter$fn_ls
[1] "/usr/local/lib/R/site-library/RMassBankData/spectra/1_3_Chlorophenyl_piperazin_2818_pos.mzML"
[2] "/usr/local/lib/R/site-library/RMassBankData/spectra/1_3_Trifluoromethylphenyl_piperazin_2819_pos.mzML"
...
Browse[3]> ls(filter$RMassBank.env)
[1] "export.invalid" "export.molfiles"
[3] "ReadAnnotation" "strictMsMsSpectraSelection"
...
Browse[3]> filter$w
Object of class "msmsWorkspace"
with files:
- 1_3_Chlorophenyl_piperazin_2818_pos.mzML
- 1_3_Trifluoromethylphenyl_piperazin_2819_pos.mzML
- 2818 foundOK: TRUE
- 2819 foundOK: TRUE
...
enclos
contains the msmsWorkspace
:
Browse[3]> enclos$o
Object of class "msmsWorkspace"
with files:
- 1_3_Chlorophenyl_piperazin_2818_pos.mzML
- 1_3_Trifluoromethylphenyl_piperazin_2819_pos.mzML
- 2818 foundOK: TRUE
- 2819 foundOK: TRUE
Peaks found:
- 2818 peaks: 114 57 67 74 108 145 164 116 115 137 167 211 327 181
- 2819 peaks: 94 64 64 100 157 248 286 116 96 149 199 306 450 228
...
@meowcat , I am a bit lost about the intended code logic here (I need to learn about substitute()
and friends ...) but hope to have provided some hints about the issue.
Yours, Steffen
Hi all,
Error in eval(f, o, enclos) & !is.na(eval(f, o, enclos)) : operations are possible only for numeric, logical or complex types
IMHO, this links to a data conversion problem. The message says operations are possible only for numeric, logical or complex types
. Thus, could it be that some of the data is provided as charater or factor or what else, but not as numeric, logical or complex?
I had often the observation that R gets more strict with wrong data types due to better error handling or conditional tests.
Best, Tobias
Running the workflow and the example dataset from here: https://bioconductor.org/packages/release/bioc/vignettes/RMassBank/inst/doc/RMassBank.html completes, but unable to run
selectPeaks()
afterward. Full code:Error message:
sessionInfo: