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/Rtmpt0QV7a/TimiRGeN'...
## 
## RUNNING 'updatePackageObjects("/tmp/Rtmpt0QV7a/TimiRGeN", bump.Version=TRUE)'...
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/Clusters.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/EnrichWiki.rds: readRDS().. ok; updateObject(list, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/GenesofInterest.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/IDs_mouse_mRNA.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/IDs_mouse_miR.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/MAE_Prefix.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/MAE_mm.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/MiningMatrix.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/TargetScans_results.rds: readRDS().. ok; updateObject(matrix, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/corrmat.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/filt_df.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/filtered_genelist_c.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/filtered_genelist_s.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/gene_entrez_c.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/genelist_s.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/geneslist_c.rds: readRDS().. ok; updateObject(list, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/genetic_data.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/interactions.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/log2fc.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/miRDB_resuts.rds: readRDS().. ok; updateObject(matrix, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/miRTarBase_results.rds: readRDS().. ok; updateObject(matrix, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/net.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/wikimatrix.rds: readRDS().. ok; updateObject(data.frame, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/tests/testthat/wpdata.rds: readRDS().. ok; updateObject(MultiAssayExperiment, check=FALSE).. no-op ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/data/UUO_data.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/data/e_list_mouse.rda: load().. ok [1 object(s)]; updateObject(list, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/data/hs_mRNA.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/data/hs_miR.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/data/hs_probes.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/data/long_data.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/data/miRTarBase.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/data/mm_mRNA.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/data/mm_miR.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/data/w_list_mouse.rda: load().. ok [1 object(s)]; updateObject(list, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/inst/extdata/Int_data.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/inst/extdata/clusterdata.rda: load().. ok [1 object(s)]; updateObject(data.frame, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/inst/extdata/clusters.rda: load().. ok [1 object(s)]; updateObject(fclust, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/inst/extdata/hs_gmt.rda: load().. ok [1 object(s)]; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/Rtmpt0QV7a/TimiRGeN/inst/extdata/mfuzzdata.rda: load().. ok [1 object(s)]; updateObject(matrix, check=FALSE).. no-op; nothing to update ==> 0
## File /tmp/Rtmpt0QV7a/TimiRGeN/inst/extdata/mm_gmt.rda: load().. ok [1 object(s)]; updateObject(MultiAssayExperiment, check=FALSE).. object updated; saving file.. OK ==> 1
## File /tmp/Rtmpt0QV7a/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..f016af1 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..3328ba6 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..acaadc4 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..aef7ba2 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..9363297 100644
## Binary files a/tests/testthat/IDs_mouse_mRNA.rds and b/tests/testthat/IDs_mouse_mRNA.rds differ
## 
## [RELEASE_3_13 5f3c3cc] 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.2.1 (2022-06-23)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.5 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.16-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.16-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.24.0                 MultiAssayExperiment_1.24.0
## [3] updateObject_1.2.0          S4Vectors_0.36.0           
## [5] BiocGenerics_0.44.0         BiocStyle_2.26.0           
## 
## loaded via a namespace (and not attached):
##  [1] bitops_1.0-7                matrixStats_0.62.0         
##  [3] bit64_4.0.5                 HDO.db_0.99.1              
##  [5] httr_1.4.4                  GenomeInfoDb_1.34.0        
##  [7] tools_4.2.1                 bslib_0.4.0                
##  [9] utf8_1.2.2                  R6_2.5.1                   
## [11] DBI_1.1.3                   colorspace_2.0-3           
## [13] tidyselect_1.2.0            bit_4.0.4                  
## [15] compiler_4.2.1              cli_3.4.1                  
## [17] Biobase_2.58.0              DelayedArray_0.24.0        
## [19] bookdown_0.29               sass_0.4.2                 
## [21] scales_1.2.1                stringr_1.4.1              
## [23] digest_0.6.30               rmarkdown_2.17             
## [25] XVector_0.38.0              pkgconfig_2.0.3            
## [27] htmltools_0.5.3             MatrixGenerics_1.10.0      
## [29] fastmap_1.1.0               rlang_1.0.6                
## [31] RSQLite_2.2.18              jquerylib_0.1.4            
## [33] generics_0.1.3              jsonlite_1.8.3             
## [35] BiocParallel_1.32.0         GOSemSim_2.24.0            
## [37] dplyr_1.0.10                RCurl_1.98-1.9             
## [39] magrittr_2.0.3              GO.db_3.16.0               
## [41] GenomeInfoDbData_1.2.9      Matrix_1.5-1               
## [43] Rcpp_1.0.9                  munsell_0.5.0              
## [45] fansi_1.0.3                 lifecycle_1.0.3            
## [47] stringi_1.7.8               yaml_2.3.6                 
## [49] SummarizedExperiment_1.28.0 zlibbioc_1.44.0            
## [51] plyr_1.8.7                  qvalue_2.30.0              
## [53] grid_4.2.1                  blob_1.2.3                 
## [55] parallel_4.2.1              crayon_1.5.2               
## [57] lattice_0.20-45             Biostrings_2.66.0          
## [59] cowplot_1.1.1               splines_4.2.1              
## [61] KEGGREST_1.38.0             knitr_1.40                 
## [63] pillar_1.8.1                fgsea_1.24.0               
## [65] GenomicRanges_1.50.0        reshape2_1.4.4             
## [67] codetools_0.2-18            fastmatch_1.1-3            
## [69] glue_1.6.2                  evaluate_0.17              
## [71] data.table_1.14.4           BiocManager_1.30.19        
## [73] png_0.1-7                   vctrs_0.5.0                
## [75] gtable_0.3.1                assertthat_0.2.1           
## [77] cachem_1.0.6                ggplot2_3.3.6              
## [79] xfun_0.34                   BiocBaseUtils_1.0.0        
## [81] tibble_3.1.8                AnnotationDbi_1.60.0       
## [83] memoise_2.0.1               IRanges_2.32.0