BiocGenerics paste strange behavior (bug?)
0
0
Entering edit mode
@peter-langfelder-4469
Last seen 5 weeks ago
United States

Not sure if I'm missing something here or whether this is a bug. The paste generic defined in BiocGenerics seems to behave weirdly when 'lapply'd to a list of character vectors. A simple example follows:

Starting from a fresh R session:

library(BiocGenerics)
aa = list(letters[1:10], letters[11:20])
lapply(aa, paste, collapse = "")

The result is:

[[1]]
[1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"

[[2]]
 [1] "k" "l" "m" "n" "o" "p" "q" "r" "s" "t"

 

The expected result is to collapse both vectors into a single string, as base::paste does:

 

> lapply(aa, base::paste, collapse = "")
[[1]]
[1] "abcdefghij"

[[2]]
[1] "klmnopqrst"

> sessionInfo()
R version 3.4.1 Patched (2017-08-11 r73090)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Fedora 26 (Twenty Six)

Matrix products: default
BLAS: /usr/local/atlas/lib/libtatlas.so
LAPACK: /usr/local/lib64/R-3.4.1-patched-atlas-parallel/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] 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   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] BiocGenerics_0.22.0

loaded via a namespace (and not attached):
[1] compiler_3.4.1

 

FWIW, in R-3.2.2 and its corresponding version of BioConductor this used to work fine, though I am not sure that paste was already part of BiocGenerics. Here's an older sessionInfo output under which paste behaved as expected (with BiocGenerics 0.16.1):

 

R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Fedora 24 (Twenty Four)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] 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
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
 [1] org.Mm.eg.db_3.2.3         DESeq2_1.10.1
 [3] RcppArmadillo_0.7.200.2.0  Rcpp_0.12.6
 [5] SummarizedExperiment_1.0.2 GenomicRanges_1.22.4
 [7] GenomeInfoDb_1.6.3         anRichment_0.82-1
 [9] WGCNA_1.60-90              fastcluster_1.1.20
[11] dynamicTreeCut_1.63-1      GO.db_3.2.2
[13] AnnotationDbi_1.32.3       IRanges_2.4.8
[15] S4Vectors_0.8.11           Biobase_2.30.0
[17] BiocGenerics_0.16.1        preprocessCore_1.32.0
[19] sva_3.18.0                 genefilter_1.52.1
[21] mgcv_1.8-13                nlme_3.1-128
[23] sqldf_0.4-10               RSQLite_1.0.0
[25] DBI_0.4-1                  gsubfn_0.6-6
[27] proto_0.3-10               matrixStats_0.50.2
[29] doParallel_1.0.10          iterators_1.0.8
[31] foreach_1.4.3              reshape_0.8.5
[33] Hmisc_3.17-4               ggplot2_2.1.0
[35] Formula_1.2-1              survival_2.39-5
[37] lattice_0.20-33            impute_1.44.0
[39] cluster_2.0.4              class_7.3-14
[41] MASS_7.3-45

loaded via a namespace (and not attached):
 [1] splines_3.2.2        latticeExtra_0.6-28  fit.models_0.5-14
 [4] robustbase_0.92-7    chron_2.3-47         RColorBrewer_1.1-2
 [7] XVector_0.10.0       colorspace_1.2-6     Matrix_1.2-6
[10] plyr_1.8.4           pcaPP_1.9-72         XML_3.98-1.4
[13] zlibbioc_1.16.0      xtable_1.8-2         mvtnorm_1.0-5
[16] scales_0.4.0         BiocParallel_1.4.3   annotate_1.48.0
[19] nnet_7.3-12          foreign_0.8-66       data.table_1.9.6
[22] locfit_1.5-9.1       munsell_0.4.3        lambda.r_1.1.9
[25] futile.logger_1.4.3  grid_3.2.2           robust_0.4-18
[28] tcltk_3.2.2          gtable_0.2.0         codetools_0.2-14
[31] rrcov_1.4-3          gridExtra_2.2.1      futile.options_1.0.0
[34] geneplotter_1.48.0   rpart_4.1-10         acepack_1.3-3.3
[37] DEoptimR_1.0-8

 

biocgenerics • 1.2k views
ADD COMMENT
0
Entering edit mode

Hmm, I didn't see this under a very similar session

> aa = list(letters[1:10], letters[11:20])
> lapply(aa, paste, collapse = "")
[[1]]
[1] "abcdefghij"

[[2]]
[1] "klmnopqrst"

> sessionInfo()
R version 3.4.1 Patched (2017-08-11 r73096)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS

Matrix products: default
BLAS: /home/mtmorgan/bin/R-3-4-branch/lib/libRblas.so
LAPACK: /home/mtmorgan/bin/R-3-4-branch/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] 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   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] BiocGenerics_0.22.0

loaded via a namespace (and not attached):
[1] compiler_3.4.1

But re-installing BiocGenerics (via biocLite() or from the command line) recovers your behavior without any change in versions.

ADD REPLY

Login before adding your answer.

Traffic: 775 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6