Skip to content
Permalink
Newer
Older
100755 57 lines (46 sloc) 1.35 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
apt-get -y install python-pip python-dev
Aug 15, 2016
31
pip install --upgrade ${pip_pkgs[@]}
32
}
33
34
r_install_packages() {
35
local pkgs=\"$(sprintf "\",%s\"" "${r_pkgs[@]}")\"
36
R --quiet -vanilla -e <<EOF
37
source("https://bioconductor.org/biocLite.R")
38
biocLite(c(${pkgs:3})
39
EOF
40
}
41
42
main () {
43
ubuntu_update
44
ubuntu_install_r_cran
45
46
python_install_packages
47
48
# Install R libraries in the user home directory so that updating
49
# the libraries later on does not triggering the "unwritable
50
# directory" warning.
51
export r_pkgs
52
export -f r_install packages
53
su cgi_user -c "bash -c r_install_packages"
54
unset r_pkgs r_install_packages
55
}
56
57
main
You can’t perform that action at this time.