Skip to content
Permalink
Newer
Older
100755 56 lines (45 sloc) 1.3 KB
Aug 15, 2016
1
#!/bin/bash
2
3
r_pkgs=( DESeq2 grDevices genefilter biomaRt ggplot2 gplots RColorBrewer )
4
pip_pkgs=( biopython )
5
6
if [[ $(id -u) -ne 0 ]]; then
7
echo "Error: run this script as the root user, not EUID $(id -u)."
8
exit 1
9
fi
10
11
set -e # Make most errors fatal.
12
13
ubuntu_update () {
14
apt-get update
15
apt-get -y upgrade
16
}
17
18
ubuntu_install_r_cran () {
19
cat <<EOF > /etc/apt/sources.list.d/cgi-r-cran.list
20
# Newest R version from CRAN per
21
# https://cran.r-project.org/bin/linux/ubuntu/
22
deb https://cran.fhcrc.org/bin/linux/ubuntu $(lsb_release -cs)/
23
EOF
24
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
25
apt-get update
26
apt-get -y install r-base-dev
27
}
28
29
python_install_packages() {
30
pip install --upgrade ${pip_pkgs[@]}
31
}
32
33
r_install_packages() {
34
local pkgs=\"$(sprintf "\",%s\"" "${r_pkgs[@]}")\"
35
R --quiet -vanilla -e <<EOF
36
source("https://bioconductor.org/biocLite.R")
37
biocLite(c(${pkgs:3})
38
EOF
39
}
40
41
main () {
42
ubuntu_update
43
ubuntu_install_r_cran
44
45
python_install_packages
46
47
# Install R libraries in the user home directory so that updating
48
# the libraries later on does not triggering the "unwritable
49
# directory" warning.
50
export r_pkgs
51
export -f r_install packages
52
su cgi_user -c "bash -c r_install_packages"
53
unset r_pkgs r_install_packages
54
}
55
56
main
You can’t perform that action at this time.