Skip to content

Commit 7274ee6

Browse files
authored
Add makeMetaDbs with fixes (#452)
1 parent 5c14c6e commit 7274ee6

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed

propagation/3.22/updateReposPkgs-bioc.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ WIN_CONTRIB="$REPOS_ROOT/bin/windows/contrib/$R_VERSION"
1717
MAC_BIG_SUR_x86_64_CONTRIB="$REPOS_ROOT/bin/macosx/big-sur-x86_64/contrib/$R_VERSION"
1818
MAC_BIG_SUR_arm64_CONTRIB="$REPOS_ROOT/bin/macosx/big-sur-arm64/contrib/$R_VERSION"
1919

20+
META_SRC="$SRC_CONTRIB/Meta"
21+
META_R_EXPR="source('/home/biocbuild/BBS/utils/makeMetaDbs.R')"
22+
MEAT_PATH="/home/biocbuild/bbs-$BIOC_VERSION-bioc/meat"
23+
2024
if [ ! -f "$PROPAGATION_DB_FILE" ]; then
2125
echo "ERROR: $PROPAGATION_DB_FILE not found. Did postrun.sh run?"
2226
exit 1
@@ -72,6 +76,13 @@ for i in `ls $MANUALS_SRC`; do
7276
mkdir -p $MANUALS_DEST/$pkg/man
7377
cp --update --verbose $MANUALS_SRC/$i $MANUALS_DEST/$pkg/man
7478
done
79+
echo ""
80+
echo "========================================================================"
81+
/bin/date
82+
echo "------------------------------------------------------------------------"
83+
84+
echo "Updating $META_SRC with aliases and cross refences dbs..."
85+
$Rscript -e "$META_R_EXPR; try(makeMetaDbs('$PROPAGATION_DB_FILE', '$MEAT_PATH', '$REPOS_ROOT', '$META_SRC'))"
7586

7687
echo "DONE."
7788
exit 0

propagation/3.22/updateReposPkgs-data-annotation.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ PROPAGATION_DB_FILE="$BBS_OUTGOING_DIR/../PROPAGATION_STATUS_DB.txt"
1414
REPOS_ROOT="$HOME/PACKAGES/$BIOC_VERSION/data/annotation"
1515
SRC_CONTRIB="$REPOS_ROOT/src/contrib"
1616

17+
META_SRC="$SRC_CONTRIB/Meta"
18+
META_R_EXPR="source('/home/biocbuild/BBS/utils/makeMetaDbs.R')"
19+
MEAT_PATH="/home/biocbuild/bbs-$BIOC_VERSION-data-annotation/meat"
20+
1721
if [ ! -f "$PROPAGATION_DB_FILE" ]; then
1822
echo "ERROR: $PROPAGATION_DB_FILE not found. Did postrun.sh run?"
1923
exit 1
@@ -58,6 +62,13 @@ for i in `ls $MANUALS_SRC`; do
5862
mkdir -p $MANUALS_DEST/$pkg/man
5963
cp --update --verbose $MANUALS_SRC/$i $MANUALS_DEST/$pkg/man
6064
done
65+
echo ""
66+
echo "========================================================================"
67+
/bin/date
68+
echo "------------------------------------------------------------------------"
69+
70+
echo "Updating $META_SRC with aliases and cross refences dbs..."
71+
$Rscript -e "$META_R_EXPR; try(makeMetaDbs('$PROPAGATION_DB_FILE', '$MEAT_PATH', '$REPOS_ROOT', '$META_SRC'))"
6172

6273
echo "DONE."
6374
exit 0

propagation/3.22/updateReposPkgs-data-experiment.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ PROPAGATION_DB_FILE="$BBS_OUTGOING_DIR/../PROPAGATION_STATUS_DB.txt"
1414
REPOS_ROOT="$HOME/PACKAGES/$BIOC_VERSION/data/experiment"
1515
SRC_CONTRIB="$REPOS_ROOT/src/contrib"
1616

17+
META_SRC="$SRC_CONTRIB/Meta"
18+
META_R_EXPR="source('/home/biocbuild/BBS/utils/makeMetaDbs.R')"
19+
MEAT_PATH="/home/biocbuild/bbs-$BIOC_VERSION-data-experiment/meat"
20+
1721
if [ ! -f "$PROPAGATION_DB_FILE" ]; then
1822
echo "ERROR: $PROPAGATION_DB_FILE not found. Did postrun.sh run?"
1923
exit 1
@@ -58,6 +62,13 @@ for i in `ls $MANUALS_SRC`; do
5862
mkdir -p $MANUALS_DEST/$pkg/man
5963
cp --update --verbose $MANUALS_SRC/$i $MANUALS_DEST/$pkg/man
6064
done
65+
echo ""
66+
echo "========================================================================"
67+
/bin/date
68+
echo "------------------------------------------------------------------------"
69+
70+
echo "Updating $META_SRC with aliases and cross refences dbs..."
71+
$Rscript -e "$META_R_EXPR; try(makeMetaDbs('$PROPAGATION_DB_FILE', '$MEAT_PATH', '$REPOS_ROOT', '$META_SRC'))"
6172

6273
echo "DONE."
6374
exit 0

utils/makeMetaDbs.R

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
makeMetaDbs <- function(db_filepath, meat_path, repos_root, meta_path) {
2+
3+
prop_status <- read.dcf(db_filepath)
4+
5+
pkgs <- c()
6+
for (i in 1:dim(prop_status)[2]) {
7+
pkg_type_stage <- strsplit(colnames(prop_status)[i], "#")[[1]]
8+
if ("source" %in% pkg_type_stage &&
9+
strsplit(prop_status[i], ",")[[1]][1] %in% c("YES", "UNNEEDED")) {
10+
pkgs <- c(pkgs, pkg_type_stage[1])
11+
}
12+
}
13+
14+
web_dir <- file.path(repos_root, "web", "packages")
15+
meta_dir <- file.path(meta_path)
16+
if (!dir.exists(meta_dir)) {
17+
dir.create(meta_dir, recursive = TRUE)
18+
}
19+
20+
pkg_paths <- file.path(meat_path, pkgs)
21+
for (pkg_path in pkg_paths) {
22+
tryCatch(
23+
biocViews::build_db_from_source(pkg_path, repos_root),
24+
error = function(e) {
25+
print(paste('Failed to build db for', pkg, '-', e))
26+
}
27+
)
28+
}
29+
30+
aliases_db_file <- file.path(meta_dir, "aliases.rds")
31+
meta_aliases_db <- biocViews::build_meta_aliases_db(web_dir, aliases_db_file)
32+
saveRDS(meta_aliases_db, aliases_db_file, version = 2)
33+
34+
rdxrefs_db_file <- file.path(meta_dir, "rdxrefs.rds")
35+
meta_rdxrefs_db <- biocViews::build_meta_rdxrefs_db(web_dir, rdxrefs_db_file)
36+
saveRDS(meta_rdxrefs_db, rdxrefs_db_file, version = 2)
37+
}

0 commit comments

Comments
 (0)