S4Vectors, strange metadata behavior
1
0
Entering edit mode
@hauken_heyken-13992
Last seen 2.1 years ago
Bergen

Is this internal logic intentional? makes no sense to me.

# Goal: insert b or bmeta in index 1 of a
# Will fail if metadata is of type GRangesList and length > 1.

library(GenomicRanges)
b <- bmeta <- GRanges("1", IRanges(c(1, 3), width = 1), "+")
bmeta$ref <- GRangesList(GRanges("1", IRanges(c(1, 3), width = 1), "+"))

# This will not crash
a <- GRangesList(GRanges())
a[[1]] <- b
# This not will crash
a <- GRangesList(GRanges())
a[[1]] <- bmeta[1]
a[[1]] <- bmeta
# This will crash
a <- GRangesList(GRanges())
a[[1]] <- bmeta

sessionInfo( )
R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 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               LC_TIME=nb_NO.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=nb_NO.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=nb_NO.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=nb_NO.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] ORFquant_1.02.0             rmarkdown_2.11              reshape2_1.4.4             
 [4] multitaper_1.0-15           knitr_1.36                  gridExtra_2.3              
 [7] ggplot2_3.3.5               GenomicFiles_1.28.0         BiocParallel_1.28.0        
[10] doMC_1.3.7                  iterators_1.0.13            foreach_1.5.1              
[13] devtools_2.4.2              usethis_2.0.1               cowplot_1.1.1              
[16] BSgenome_1.61.0             rtracklayer_1.54.0          GenomicFeatures_1.46.1     
[19] AnnotationDbi_1.56.0        uORFomePipe_0.2.0           data.table_1.14.2          
[22] DBI_1.1.1                   RiboCrypt_1.1.1             ORFik_1.15.6               
[25] GenomicAlignments_1.30.0    Rsamtools_2.10.0            Biostrings_2.62.0          
[28] XVector_0.33.0              SummarizedExperiment_1.23.5 Biobase_2.53.0             
[31] MatrixGenerics_1.5.4        matrixStats_0.61.0          GenomicRanges_1.46.0       
[34] GenomeInfoDb_1.30.0         IRanges_2.28.0              S4Vectors_0.32.2           
[37] BiocGenerics_0.40.0        

loaded via a namespace (and not attached):
  [1] readxl_1.3.1             backports_1.2.1          BiocFileCache_2.1.1     
  [4] plyr_1.8.6               lazyeval_0.2.2           splines_4.1.0           
  [7] digest_0.6.28            h2o_3.32.1.3             htmltools_0.5.2         
 [10] fansi_0.5.0              magrittr_2.0.1           memoise_2.0.0           
 [13] remotes_2.4.1            openxlsx_4.2.4           annotate_1.71.0         
 [16] R.utils_2.11.0           prettyunits_1.1.1        colorspace_2.0-2        
 [19] blob_1.2.2               rappdirs_0.3.3           xfun_0.26               
 [22] haven_2.4.3              dplyr_1.0.7              callr_3.7.0             
 [25] crayon_1.4.1             RCurl_1.98-1.5           jsonlite_1.7.2          
 [28] genefilter_1.75.1        VariantAnnotation_1.38.0 survival_3.2-13         
 [31] glue_1.4.2               gtable_0.3.0             zlibbioc_1.39.0         
 [34] DelayedArray_0.19.4      pkgbuild_1.2.0           car_3.0-11              
 [37] biomartr_0.9.2           abind_1.4-5              scales_1.1.1            
 [40] futile.options_1.0.1     GGally_2.1.2             rstatix_0.7.0           
 [43] Rcpp_1.0.7               viridisLite_0.4.0        xtable_1.8-4            
 [46] progress_1.2.2           foreign_0.8-81           bit_4.0.4               
 [49] htmlwidgets_1.5.3        httr_1.4.2               RColorBrewer_1.1-2      
 [52] ellipsis_0.3.2           pkgconfig_2.0.3          reshape_0.8.8           
 [55] XML_3.99-0.8             R.methodsS3_1.8.1        dbplyr_2.1.1            
 [58] locfit_1.5-9.4           utf8_1.2.2               tidyselect_1.1.1        
 [61] rlang_0.4.11             munsell_0.5.0            cellranger_1.1.0        
 [64] tools_4.1.0              cachem_1.0.6             cli_3.0.1               
 [67] generics_0.1.0           RSQLite_2.2.8            broom_0.7.9             
 [70] evaluate_0.14            stringr_1.4.0            fastmap_1.1.0           
 [73] yaml_2.2.1               processx_3.5.2           fs_1.5.0                
 [76] bit64_4.0.5              zip_2.2.0                purrr_0.3.4             
 [79] lemon_0.4.5              KEGGREST_1.33.0          formatR_1.11            
 [82] R.oo_1.24.0              xml2_1.3.2               biomaRt_2.49.4          
 [85] compiler_4.1.0           rstudioapi_0.13          plotly_4.10.0           
 [88] filelock_1.0.2           curl_4.3.2               png_0.1-7               
 [91] testthat_3.1.0           ggsignif_0.6.3           tibble_3.1.5            
 [94] geneplotter_1.71.0       stringi_1.7.5            ps_1.6.0                
 [97] futile.logger_1.4.3      desc_1.4.0               forcats_0.5.1           
[100] lattice_0.20-45          Matrix_1.3-4             vctrs_0.3.8             
[103] pillar_1.6.3             lifecycle_1.0.1          BiocManager_1.30.16     
[106] bitops_1.0-7             R6_2.5.1                 BiocIO_1.4.0            
[109] rio_0.5.27               codetools_0.2-18         sessioninfo_1.1.1       
[112] lambda.r_1.2.4           pkgload_1.2.3            assertthat_0.2.1        
[115] rprojroot_2.0.2          DESeq2_1.33.5            rjson_0.2.20            
[118] withr_2.4.2              GenomeInfoDbData_1.2.7   hms_1.1.0               
[121] fst_0.9.4                VennDiagram_1.6.20       tidyr_1.1.4             
[124] carData_3.0-4            ggpubr_0.4.0             restfulr_0.0.13
GRangesList S4Vectors • 1.1k views
ADD COMMENT
2
Entering edit mode
@herve-pages-1542
Last seen 9 hours ago
Seattle, WA, United States

It's obviously a bug and I don't see any crash. Fixed in S4Vectors 0.32.3 (release) and 0.33.4 (devel).

Also a better place to report bugs is to open an issue on GitHub.

Cheers,

H.

ADD COMMENT
0
Entering edit mode

Thanks, Herve, I was not sure this was S4Vectors fault or not, so put it here instead.

Btw, something is still wrong on devel, so had to downgrade to S4Vectors 0.32.3 (release), which did work.

Happened with my package ORFik that uses DataFrames inside some clases, got this error. with S4Vectors 0.33.4 (devel):

> df <- ORFik::ORFik.template.experiment()

Error in new("DataFrame") : 
  trying to generate an object from a virtual class ("DataFrame")

This error is not there using release. Looks like the DataFrame constructor has a bug in devel ?

ADD REPLY
0
Entering edit mode

DataFrame got replaced with DFrame 2 years ago. Earlier this week it became a virtual class in devel. Many packages are impacted by this change in devel and I'm working on them.

For the record, the DataFrame -> DFrame migration was announced in a Developer Forum in Sept 2019. See the slides here.

Sorry for the inconvenience.

H.

ADD REPLY

Login before adding your answer.

Traffic: 570 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