Contents

1 Introduction

updateObject is an R package that provides a set of tools built around the updateObject() generic function to make it easy to work with old serialized S4 instances.

The package is primarily useful to package maintainers who want to update the serialized S4 instances included in their package.

2 Out-of-sync objects

Out-of-sync objects (a.k.a. outdated or old objects) are R objects that got serialized at some point and became out-of-sync later on when the authors/maintainers of an S4 class made some changes to the internals of the class.

A typical example of this situation is when some slots of an S4 class A get added, removed, or renamed. When this happens, any object of class A (a.k.a. A instance) that got serialized before this change (i.e. written to disk with saveRDS(), save(), or serialize()) becomes out-of-sync with the new class definition.

Note that this is also the case of any A derivative (i.e. any object that belongs to a class that extends A), as well as any object that contains an A instance or derivative. For example, if B extends A, then any serialized list of A or B objects is now an old object, and any S4 object of class C that has A or B objects in some of its slots now is also an old object.

An important thing to keep in mind is that, in fact, the exact parts of a serialized object x that are out-of-sync with their class definition can be deeply nested inside x.

3 The updateObject() generic function

updateObject() is the core function used in Bioconductor for updating old R objects. The function is an S4 generic currently defined in the BiocGenerics package and with dozens of methods defined across many Bioconductor packages. For example, the S4Vectors package defines updateObject() methods for Vector, SimpleList, DataFrame, and Hits objects, the SummarizedExperiment package defines methods for SummarizedExperiment, RangedSummarizedExperiment, and Assays objects, the MultiAssayExperiment package defines a method for MultiAssayExperiment objects, the QFeatures package a method for QFeatures objects, etc…

See ?BiocGenerics::updateObject in the BiocGenerics package for more information.

4 A tedious process

Serialized objects are typically (but not exclusively) found in R packages. To update all the serialized objects contained in a given package, one usually needs to perform the following steps:

In addition to the above steps, the package maintainer also needs to perform the usual steps required for updating a package and publishing its new version. In the case of a Bioconductor package, these steps are:

Performing all the above steps manually can be tedious and error prone, especially if the package contains many serialized objects, or if the entire procedure needs to be performed on a big collection of packages. The updateObject package provides a set of tools that intend to make this much easier.

5 updateBiocPackageRepoObjects()

updateBiocPackageRepoObjects() is the central function in the updateObject package. It takes care of updating the serialized objects contained in a given Bioconductor package by performing all the steps described in the previous section.

Let’s load updateObject:

library(updateObject)

and try updateBiocPackageRepoObjects() on the RELEASE_3_13 branch of the TimiRGeN package:

repopath <- file.path(tempdir(), "TimiRGeN")
updateBiocPackageRepoObjects(repopath, branch="RELEASE_3_13", use.https=TRUE)
## Cloning into '/tmp/RtmpoGcxbd/TimiRGeN'...
## 
## RUNNING 'updatePackageObjects("/tmp/RtmpoGcxbd/TimiRGeN", bump.Version=TRUE)'...
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/Clusters.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/EnrichWiki.rds: readRDS().. ok; updateObject(list, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/GenesofInterest.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/IDs_mouse_mRNA.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/IDs_mouse_miR.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/MAE_Prefix.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/MAE_mm.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/MiningMatrix.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/TargetScans_results.rds: readRDS().. ok; updateObject(matrix, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/corrmat.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/filt_df.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/filtered_genelist_c.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/filtered_genelist_s.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/gene_entrez_c.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/genelist_s.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/geneslist_c.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/genetic_data.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/interactions.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/log2fc.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/miRDB_resuts.rds: readRDS().. ok; updateObject(matrix, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/miRTarBase_results.rds: readRDS().. ok; updateObject(matrix, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/net.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/wikimatrix.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/tests/testthat/wpdata.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/data/UUO_data.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/data/e_list_mouse.rda: load().. ok [1 object(s)]; updateObject(list, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/data/hs_mRNA.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/data/hs_miR.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/data/hs_probes.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/data/long_data.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/data/miRTarBase.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/data/mm_mRNA.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/data/mm_miR.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/data/w_list_mouse.rda: load().. ok [1 object(s)]; updateObject(list, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/inst/extdata/Int_data.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/inst/extdata/clusterdata.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/inst/extdata/clusters.rda: load().. ok [1 object(s)]; updateObject(fclust, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/inst/extdata/hs_gmt.rda: load().. ok [1 object(s)]; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpoGcxbd/TimiRGeN/inst/extdata/mfuzzdata.rda: load().. ok [1 object(s)]; updateObject(matrix, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpoGcxbd/TimiRGeN/inst/extdata/mm_gmt.rda: load().. ok [1 object(s)]; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpoGcxbd/TimiRGeN/inst/extdata/w_list_human.rda: load().. ok [1 object(s)]; updateObject(list, check=FALSE).. no-op; nothing to update ==> 0
## diff --git a/DESCRIPTION b/DESCRIPTION
## index 6d23fae..0ad637d 100644
## --- a/DESCRIPTION
## +++ b/DESCRIPTION
## @@ -1,7 +1,7 @@
##  Package: TimiRGeN
##  Type: Package
##  Title: Time sensitive microRNA-mRNA integration, analysis and network generation tool
## -Version: 1.2.0
## +Version: 1.2.1
##  Authors@R: person(given = "Krutik", family = "Patel", role = c("aut", "cre"), email = "K.Patel5@newcastle.ac.uk")
##  Description:  TimiRGeN (Time Incorporated miR-mRNA Generation of Networks) is a novel R package which functionally analyses and integrates time course miRNA-mRNA differential expression data. This tool can generate small networks within R or export results into cytoscape or pathvisio for more detailed network construction and hypothesis generation. 
##                This tool is created for researchers that wish to dive deep into time series multi-omic datasets. TimiRGeN goes further than many other tools in terms of data reduction. Here, potentially hundreds of thousands of potential miRNA-mRNA interactions can be whittled down into a handful of high confidence  miRNA-mRNA interactions effecting a signalling pathway, across a time course.
## diff --git a/inst/extdata/hs_gmt.rda b/inst/extdata/hs_gmt.rda
## index 2bad1b8..1350375 100644
## Binary files a/inst/extdata/hs_gmt.rda and b/inst/extdata/hs_gmt.rda differ
## diff --git a/inst/extdata/mm_gmt.rda b/inst/extdata/mm_gmt.rda
## index 653fb4c..3001e34 100644
## Binary files a/inst/extdata/mm_gmt.rda and b/inst/extdata/mm_gmt.rda differ
## diff --git a/tests/testthat/Clusters.rds b/tests/testthat/Clusters.rds
## index 51c0113..82d784d 100644
## Binary files a/tests/testthat/Clusters.rds and b/tests/testthat/Clusters.rds differ
## diff --git a/tests/testthat/EnrichWiki.rds b/tests/testthat/EnrichWiki.rds
## index c936d04..11faa10 100644
## Binary files a/tests/testthat/EnrichWiki.rds and b/tests/testthat/EnrichWiki.rds differ
## diff --git a/tests/testthat/IDs_mouse_mRNA.rds b/tests/testthat/IDs_mouse_mRNA.rds
## index 9c88659..2551ef7 100644
## Binary files a/tests/testthat/IDs_mouse_mRNA.rds and b/tests/testthat/IDs_mouse_mRNA.rds differ
## 
## [RELEASE_3_13 9bc5207] Pass serialized S4 instances thru updateObject()
##  6 files changed, 1 insertion(+), 1 deletion(-)
##  rewrite inst/extdata/hs_gmt.rda (96%)
##  rewrite inst/extdata/mm_gmt.rda (100%)
##  rewrite tests/testthat/Clusters.rds (100%)
##  rewrite tests/testthat/EnrichWiki.rds (100%)
##  rewrite tests/testthat/IDs_mouse_mRNA.rds (100%)
## 
## UPDATE OBJECTS >> UPDATE DESCRIPTION FILE >> COMMIT SUCCESSFUL.

Important notes:

See ?updateBiocPackageRepoObjects for more information and more examples.

6 List of tools provided by the updateObject package

The package provides the following tools:

See individual man pages in the package for more information e.g. ?updatePackageObjects.

7 Session information

sessionInfo()
## R version 4.3.1 (2023-06-16)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.3 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.18-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [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       
## 
## time zone: America/New_York
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
## [1] DOSE_3.28.0                 MultiAssayExperiment_1.28.0
## [3] updateObject_1.6.0          S4Vectors_0.40.0           
## [5] BiocGenerics_0.48.0         BiocStyle_2.30.0           
## 
## loaded via a namespace (and not attached):
##   [1] DBI_1.1.3                     bitops_1.0-7                 
##   [3] rlang_1.1.1                   magrittr_2.0.3               
##   [5] matrixStats_1.0.0             compiler_4.3.1               
##   [7] RSQLite_2.3.1                 reshape2_1.4.4               
##   [9] png_0.1-8                     vctrs_0.6.4                  
##  [11] stringr_1.5.0                 pkgconfig_2.0.3              
##  [13] crayon_1.5.2                  HPO.db_0.99.2                
##  [15] fastmap_1.1.1                 dbplyr_2.3.4                 
##  [17] XVector_0.42.0                ellipsis_0.3.2               
##  [19] utf8_1.2.4                    HDO.db_0.99.1                
##  [21] promises_1.2.1                rmarkdown_2.25               
##  [23] purrr_1.0.2                   bit_4.0.5                    
##  [25] xfun_0.40                     zlibbioc_1.48.0              
##  [27] cachem_1.0.8                  GenomeInfoDb_1.38.0          
##  [29] jsonlite_1.8.7                blob_1.2.4                   
##  [31] later_1.3.1                   DelayedArray_0.28.0          
##  [33] MPO.db_0.99.7                 BiocParallel_1.36.0          
##  [35] interactiveDisplayBase_1.40.0 parallel_4.3.1               
##  [37] R6_2.5.1                      stringi_1.7.12               
##  [39] bslib_0.5.1                   GenomicRanges_1.54.0         
##  [41] jquerylib_0.1.4               GOSemSim_2.28.0              
##  [43] Rcpp_1.0.11                   bookdown_0.36                
##  [45] SummarizedExperiment_1.32.0   knitr_1.44                   
##  [47] IRanges_2.36.0                BiocBaseUtils_1.4.0          
##  [49] splines_4.3.1                 httpuv_1.6.12                
##  [51] Matrix_1.6-1.1                tidyselect_1.2.0             
##  [53] qvalue_2.34.0                 abind_1.4-5                  
##  [55] yaml_2.3.7                    codetools_0.2-19             
##  [57] curl_5.1.0                    plyr_1.8.9                   
##  [59] lattice_0.22-5                tibble_3.2.1                 
##  [61] Biobase_2.62.0                shiny_1.7.5.1                
##  [63] withr_2.5.1                   KEGGREST_1.42.0              
##  [65] evaluate_0.22                 BiocFileCache_2.10.0         
##  [67] Biostrings_2.70.0             pillar_1.9.0                 
##  [69] BiocManager_1.30.22           filelock_1.0.2               
##  [71] MatrixGenerics_1.14.0         generics_0.1.3               
##  [73] RCurl_1.98-1.12               BiocVersion_3.18.0           
##  [75] ggplot2_3.4.4                 munsell_0.5.0                
##  [77] scales_1.2.1                  xtable_1.8-4                 
##  [79] glue_1.6.2                    tools_4.3.1                  
##  [81] AnnotationHub_3.10.0          data.table_1.14.8            
##  [83] fgsea_1.28.0                  fastmatch_1.1-4              
##  [85] cowplot_1.1.1                 grid_4.3.1                   
##  [87] AnnotationDbi_1.64.0          colorspace_2.1-0             
##  [89] GenomeInfoDbData_1.2.11       cli_3.6.1                    
##  [91] rappdirs_0.3.3                fansi_1.0.5                  
##  [93] S4Arrays_1.2.0                dplyr_1.1.3                  
##  [95] gtable_0.3.4                  sass_0.4.7                   
##  [97] digest_0.6.33                 SparseArray_1.2.0            
##  [99] memoise_2.0.1                 htmltools_0.5.6.1            
## [101] lifecycle_1.0.3               httr_1.4.7                   
## [103] GO.db_3.18.0                  mime_0.12                    
## [105] bit64_4.0.5