Find and update objects
=======================

This document describes the procedure for finding and updating serialized
objects in the rda files located in a directory hierarchy. This procedure
consists of 4 STEPS, as described below.

Note that this procedure was developped and used to update all "old"
serialized SummarizedExperiment objects located in the data-experiment svn
repository. It should be easy to adapt to update other types of objects in
other locations.

Also note that the purpose of STEPS 1 & 2 & 3 below is to collect the list
of rda objects to update. Since this can take a long time, the 2 lists
obtained for the "old" serialized SummarizedExperiment objects located
in https://hedgehog.fhcrc.org/bioc-data/trunk/experiment/pkgs and
https://hedgehog.fhcrc.org/bioc-data/trunk/experiment/data_store were saved
to the pkgs_RDA_OBJECTS_TO_UPDATE and data_store_RDA_OBJECTS_TO_UPDATE
files, respectively, and these 2 files placed in this folder. So in case
these objects need to be updated again, these 2 files can be re-used to run
STEP 4 directly without the need to re-run STEPS 1 & 2 & 3.

STEP 1: Collect the rda files.

  cd <dir/you/want/to/search>
  find . -type d -name '.git' -prune -o -type f -print | \
      grep -Ei '\.(rda|RData)$' >RDA_FILES

STEP 2: Collect the rda objects.

  cd <dir/you/want/to/search>

  R="$HOME/bin/R-3.2"
  R_SCRIPT="scriptfile <- system.file('scripts', 'Find_and_update_objects', "
  R_SCRIPT="$R_SCRIPT 'collect_rda_objects.R', "
  R_SCRIPT="$R_SCRIPT package='SummarizedExperiment', mustWork=TRUE)"
  R_SCRIPT="$R_SCRIPT; source(scriptfile)"
  echo "$R_SCRIPT" | $R --vanilla >collect_rda_objects.log 2>&1 &

STEP 3: Collect the rda objects to update.

  cd <dir/you/want/to/search>

  R="$HOME/bin/R-3.2"
  R_SCRIPT="scriptfile <- system.file('scripts', 'Find_and_update_objects', "
  R_SCRIPT="$R_SCRIPT 'collect_rda_objects_to_update.R', "
  R_SCRIPT="$R_SCRIPT package='SummarizedExperiment', mustWork=TRUE)"
  R_SCRIPT="$R_SCRIPT; source(scriptfile)"
  echo "$R_SCRIPT" | $R --vanilla >collect_rda_objects_to_update.log 2>&1 &

STEP 4: Update rda objects.

  cd <dir/you/want/to/search>

  #To update the "old" serialized SummarizedExperiment objects located in 
  #  https://hedgehog.fhcrc.org/bioc-data/trunk/experiment/pkgs
  #replace the above command with
  #  svn co https://hedgehog.fhcrc.org/bioc-data/trunk/experiment/pkgs
  #  cp path/to/pkgs_RDA_OBJECTS_TO_UPDATE pkgs/RDA_OBJECTS_TO_UPDATE
  #  cd pkgs

  R="$HOME/bin/R-3.2"
  R_SCRIPT="scriptfile <- system.file('scripts', 'Find_and_update_objects', "
  R_SCRIPT="$R_SCRIPT 'update_rda_objects.R', "
  R_SCRIPT="$R_SCRIPT package='SummarizedExperiment', mustWork=TRUE)"
  R_SCRIPT="$R_SCRIPT; source(scriptfile)"
  echo "$R_SCRIPT" | $R --vanilla >update_rda_objects.log 2>&1 &

