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/RtmpSn8vjH/TimiRGeN'...
## 
## RUNNING 'updatePackageObjects("/tmp/RtmpSn8vjH/TimiRGeN", bump.Version=TRUE)'...
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/Clusters.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/EnrichWiki.rds: readRDS().. ok; updateObject(list, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/GenesofInterest.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/IDs_mouse_mRNA.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/IDs_mouse_miR.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/MAE_Prefix.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/MAE_mm.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/MiningMatrix.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/TargetScans_results.rds: readRDS().. ok; updateObject(matrix, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/corrmat.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/filt_df.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/filtered_genelist_c.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/filtered_genelist_s.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/gene_entrez_c.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/genelist_s.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/geneslist_c.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/genetic_data.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/interactions.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/log2fc.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/miRDB_resuts.rds: readRDS().. ok; updateObject(matrix, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/miRTarBase_results.rds: readRDS().. ok; updateObject(matrix, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/net.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/wikimatrix.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/tests/testthat/wpdata.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/data/UUO_data.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/data/e_list_mouse.rda: load().. ok [1 object(s)]; updateObject(list, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/data/hs_mRNA.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/data/hs_miR.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/data/hs_probes.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/data/long_data.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/data/miRTarBase.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/data/mm_mRNA.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/data/mm_miR.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/data/w_list_mouse.rda: load().. ok [1 object(s)]; updateObject(list, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/inst/extdata/Int_data.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/inst/extdata/clusterdata.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/inst/extdata/clusters.rda: load().. ok [1 object(s)]; updateObject(fclust, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/inst/extdata/hs_gmt.rda: load().. ok [1 object(s)]; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpSn8vjH/TimiRGeN/inst/extdata/mfuzzdata.rda: load().. ok [1 object(s)]; updateObject(matrix, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpSn8vjH/TimiRGeN/inst/extdata/mm_gmt.rda: load().. ok [1 object(s)]; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpSn8vjH/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..ed1966b 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..9fde9b7 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..a118e2e 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..0fdd70d 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..616f07d 100644
## Binary files a/tests/testthat/IDs_mouse_mRNA.rds and b/tests/testthat/IDs_mouse_mRNA.rds differ
## 
## [RELEASE_3_13 be44bd0] Pass serialized S4 instances thru updateObject()
##  6 files changed, 1 insertion(+), 1 deletion(-)
##  rewrite inst/extdata/hs_gmt.rda (97%)
##  rewrite inst/extdata/mm_gmt.rda (99%)
##  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.0 RC (2023-04-13 r84269)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.2 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.17-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.26.0                 MultiAssayExperiment_1.26.0
## [3] updateObject_1.4.0          S4Vectors_0.38.0           
## [5] BiocGenerics_0.46.0         BiocStyle_2.28.0           
## 
## loaded via a namespace (and not attached):
##  [1] tidyselect_1.2.0            dplyr_1.1.2                
##  [3] HDO.db_0.99.1               blob_1.2.4                 
##  [5] Biostrings_2.68.0           bitops_1.0-7               
##  [7] fastmap_1.1.1               RCurl_1.98-1.12            
##  [9] digest_0.6.31               lifecycle_1.0.3            
## [11] KEGGREST_1.40.0             RSQLite_2.3.1              
## [13] magrittr_2.0.3              compiler_4.3.0             
## [15] rlang_1.1.0                 sass_0.4.5                 
## [17] tools_4.3.0                 utf8_1.2.3                 
## [19] yaml_2.3.7                  data.table_1.14.8          
## [21] knitr_1.42                  bit_4.0.5                  
## [23] DelayedArray_0.26.0         plyr_1.8.8                 
## [25] BiocParallel_1.34.0         grid_4.3.0                 
## [27] fansi_1.0.4                 GOSemSim_2.26.0            
## [29] colorspace_2.1-0            GO.db_3.17.0               
## [31] ggplot2_3.4.2               scales_1.2.1               
## [33] SummarizedExperiment_1.30.0 cli_3.6.1                  
## [35] rmarkdown_2.21              crayon_1.5.2               
## [37] generics_0.1.3              httr_1.4.5                 
## [39] reshape2_1.4.4              BiocBaseUtils_1.2.0        
## [41] DBI_1.1.3                   qvalue_2.32.0              
## [43] cachem_1.0.7                stringr_1.5.0              
## [45] splines_4.3.0               zlibbioc_1.46.0            
## [47] parallel_4.3.0              AnnotationDbi_1.62.0       
## [49] BiocManager_1.30.20         XVector_0.40.0             
## [51] matrixStats_0.63.0          vctrs_0.6.2                
## [53] Matrix_1.5-4                jsonlite_1.8.4             
## [55] bookdown_0.33               IRanges_2.34.0             
## [57] bit64_4.0.5                 jquerylib_0.1.4            
## [59] glue_1.6.2                  codetools_0.2-19           
## [61] cowplot_1.1.1               stringi_1.7.12             
## [63] gtable_0.3.3                GenomeInfoDb_1.36.0        
## [65] GenomicRanges_1.52.0        munsell_0.5.0              
## [67] tibble_3.2.1                pillar_1.9.0               
## [69] htmltools_0.5.5             fgsea_1.26.0               
## [71] GenomeInfoDbData_1.2.10     R6_2.5.1                   
## [73] evaluate_0.20               lattice_0.21-8             
## [75] Biobase_2.60.0              png_0.1-8                  
## [77] memoise_2.0.1               bslib_0.4.2                
## [79] Rcpp_1.0.10                 fastmatch_1.1-3            
## [81] xfun_0.39                   MatrixGenerics_1.12.0      
## [83] pkgconfig_2.0.3