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/RtmpN9JqNK/TimiRGeN'...
## 
## RUNNING 'updatePackageObjects("/tmp/RtmpN9JqNK/TimiRGeN", bump.Version=TRUE)'...
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/Clusters.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/EnrichWiki.rds: readRDS().. ok; updateObject(list, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/GenesofInterest.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/IDs_mouse_mRNA.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/IDs_mouse_miR.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/MAE_Prefix.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/MAE_mm.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/MiningMatrix.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/TargetScans_results.rds: readRDS().. ok; updateObject(matrix, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/corrmat.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/filt_df.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/filtered_genelist_c.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/filtered_genelist_s.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/gene_entrez_c.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/genelist_s.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/geneslist_c.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/genetic_data.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/interactions.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/log2fc.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/miRDB_resuts.rds: readRDS().. ok; updateObject(matrix, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/miRTarBase_results.rds: readRDS().. ok; updateObject(matrix, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/net.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/wikimatrix.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/tests/testthat/wpdata.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/data/UUO_data.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/data/e_list_mouse.rda: load().. ok [1 object(s)]; updateObject(list, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/data/hs_mRNA.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/data/hs_miR.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/data/hs_probes.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/data/long_data.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/data/miRTarBase.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/data/mm_mRNA.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/data/mm_miR.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/data/w_list_mouse.rda: load().. ok [1 object(s)]; updateObject(list, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/inst/extdata/Int_data.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/inst/extdata/clusterdata.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/inst/extdata/clusters.rda: load().. ok [1 object(s)]; updateObject(fclust, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/inst/extdata/hs_gmt.rda: load().. ok [1 object(s)]; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpN9JqNK/TimiRGeN/inst/extdata/mfuzzdata.rda: load().. ok [1 object(s)]; updateObject(matrix, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/RtmpN9JqNK/TimiRGeN/inst/extdata/mm_gmt.rda: load().. ok [1 object(s)]; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/RtmpN9JqNK/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..a67c53b 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..eb8cf37 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..94c0984 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..7b4435c 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..920622b 100644
## Binary files a/tests/testthat/IDs_mouse_mRNA.rds and b/tests/testthat/IDs_mouse_mRNA.rds differ
## 
## [RELEASE_3_13 4fd9c07] 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 (98%)
##  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.2.0 RC (2022-04-19 r82224)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.4 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.15-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.15-bioc/R/lib/libRlapack.so
## 
## 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       
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
## [1] DOSE_3.22.0                 MultiAssayExperiment_1.22.0
## [3] updateObject_1.0.0          S4Vectors_0.34.0           
## [5] BiocGenerics_0.42.0         BiocStyle_2.24.0           
## 
## loaded via a namespace (and not attached):
##  [1] bitops_1.0-7                matrixStats_0.62.0         
##  [3] bit64_4.0.5                 httr_1.4.2                 
##  [5] GenomeInfoDb_1.32.0         tools_4.2.0                
##  [7] bslib_0.3.1                 utf8_1.2.2                 
##  [9] R6_2.5.1                    DBI_1.1.2                  
## [11] colorspace_2.0-3            tidyselect_1.1.2           
## [13] gridExtra_2.3               bit_4.0.4                  
## [15] compiler_4.2.0              cli_3.3.0                  
## [17] Biobase_2.56.0              DelayedArray_0.22.0        
## [19] bookdown_0.26               sass_0.4.1                 
## [21] scales_1.2.0                stringr_1.4.0              
## [23] digest_0.6.29               rmarkdown_2.14             
## [25] XVector_0.36.0              pkgconfig_2.0.3            
## [27] htmltools_0.5.2             MatrixGenerics_1.8.0       
## [29] fastmap_1.1.0               rlang_1.0.2                
## [31] RSQLite_2.2.12              jquerylib_0.1.4            
## [33] generics_0.1.2              jsonlite_1.8.0             
## [35] BiocParallel_1.30.0         GOSemSim_2.22.0            
## [37] dplyr_1.0.8                 RCurl_1.98-1.6             
## [39] magrittr_2.0.3              GO.db_3.15.0               
## [41] GenomeInfoDbData_1.2.8      Matrix_1.4-1               
## [43] Rcpp_1.0.8.3                munsell_0.5.0              
## [45] fansi_1.0.3                 lifecycle_1.0.1            
## [47] stringi_1.7.6               yaml_2.3.5                 
## [49] SummarizedExperiment_1.26.0 zlibbioc_1.42.0            
## [51] plyr_1.8.7                  qvalue_2.28.0              
## [53] grid_4.2.0                  blob_1.2.3                 
## [55] parallel_4.2.0              DO.db_2.9                  
## [57] crayon_1.5.1                lattice_0.20-45            
## [59] splines_4.2.0               Biostrings_2.64.0          
## [61] KEGGREST_1.36.0             knitr_1.38                 
## [63] pillar_1.7.0                fgsea_1.22.0               
## [65] GenomicRanges_1.48.0        reshape2_1.4.4             
## [67] fastmatch_1.1-3             glue_1.6.2                 
## [69] evaluate_0.15               data.table_1.14.2          
## [71] BiocManager_1.30.17         png_0.1-7                  
## [73] vctrs_0.4.1                 gtable_0.3.0               
## [75] purrr_0.3.4                 assertthat_0.2.1           
## [77] cachem_1.0.6                ggplot2_3.3.5              
## [79] xfun_0.30                   tibble_3.1.6               
## [81] AnnotationDbi_1.58.0        memoise_2.0.1              
## [83] IRanges_2.30.0              ellipsis_0.3.2