Last active
September 14, 2017 20:37
-
-
Save omsai/546efbb0336f844e283e80d559c0336c to your computer and use it in GitHub Desktop.
Install and run R package grantfigs201710 on SLURM cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#SBATCH -o sense-pat.out | |
set -e | |
# Globals | |
repo="grantfigs201710" | |
main() { | |
test -n "$SLURM_JOB_ID" && echo "Job $SLURM_JOB_ID" >> sense-pat.out | |
module purge | |
bootstrap | |
update | |
run | |
} | |
# Install R and Bioconductor installer. | |
bootstrap() { | |
conda install -y -c r r-essentials r-xml r-devtools | |
Rscript -e 'source("https://bioconductor.org/biocLite.R")' | |
} | |
# Update our package. | |
update() { | |
local github git | |
github="CoreLab/$repo" | |
module load git | |
if ! [[ -d "$repo" ]]; then | |
git clone git@github.uconn.edu:${github}.git | |
fi | |
( | |
# Old versions of git do not support --git-dir=$repo/.git | |
# --work-tree=$repo | |
cd $repo | |
git pull | |
R -q --vanilla <<EOF | |
devtools::install( | |
dependencies = c("Imports", "Suggests"), | |
repos = BiocInstaller::biocinstallRepos()) | |
EOF | |
) | |
} | |
# Run vignette. | |
run() { | |
R -q --vanilla <<EOF | |
setwd("$repo/vignettes") | |
library(BiocParallel) | |
register(MulticoreParam($SLURM_JOB_CPUS_PER_NODE)) | |
devtools::build_vignettes() | |
EOF | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment