Skip to content

Instantly share code, notes, and snippets.

@moldach
Forked from luispuerto/r_ubuntu.sh
Last active May 6, 2020 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moldach/bde0fddbb7ee67165ab174bd76ebf88e to your computer and use it in GitHub Desktop.
Save moldach/bde0fddbb7ee67165ab174bd76ebf88e to your computer and use it in GitHub Desktop.
Install R and RStudio on Ubuntu 19.10 with essential libraries for data science. Based on pachamaltese/r_ubuntu_17_10.sh (for Ubuntu 17.10). Note: You need to make sure the default library location - /usr/local/lib/R/site-packages - is writable .
!#/bin/bash
set -o nounset # To exit when your script tries to use undeclared variables.
set -o xtrace # To trace what gets exectued (debugging).
set -e # Abort script at first error, when a command exits with non-zero status (except in until or while loops, if-tests, list constructs)
set -o pipefail # Causes a pipeline to return the exit status of the last command in the pipe that returned a non-zero return value.
# Install multiple versions of python
# https://github.com/pyenv/pyenv
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment
# (base) mtg@mtg-ThinkPad-P53:~/.pyenv/versions$ CFLAGS=-I/home/mtg/anaconda3/bin/openssl/include LDFLAGS=-L/home/mtg/anaconda3/bin/openssl/lib pyenv install -v 3.5.0
# Update to R 4.0
sudo bash -c "echo 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/' >> /etc/apt/sources.list"
sudo apt-get update
sudo apt-get install r-base
# Install R
sudo apt update
sudo apt -y install gdebi libxml2-dev libssl-dev libcurl4-openssl-dev libopenblas-dev r-base r-base-dev
# Install RStudio
wget https://download1.rstudio.org/desktop/bionic/amd64/rstudio-1.2.5001-amd64.deb
sudo gdebi rstudio-1.2.5001-amd64.deb
# Install devtools
R --vanilla --no-save
install.packages("devtools")
# Install common packages
install.packages(c("devtools", "tidyverse","data.table","dtplyr","devtools","roxygen2", "vroom"), repos = "https://cran.rstudio.com/")
# Install TDD packages
install.packages("testthis")
# Export to HTML/Excel
install.packages(c("htmlTable","openxlsx"))
# Blog tools
install.packages(c("knitr","rmarkdown"))
quit()
sudo apt -y install python3-pip
sudo apt -y install python3-venv
sudo -H pip3 install markdown rpy2==2.9.3 pelican==3.7.1
# PDF extraction tools
sudo apt -y install libpoppler-cpp-dev default-jre default-jdk # r-cran-rjava ##not compatible with 4.0##
sudo R CMD javareconf
R --vanilla --no-save
install.packages(c("pdftools", "tabulizer"), repos = "https://cran.rstudio.com/")
quit()
# TTF/OTF fonts usage
sudo apt -y install libfreetype6-dev
R --vanilla --no-save
install.packages("showtext", repos = "https://cran.rstudio.com/")
quit()
# Cairo for graphic devices
sudo apt -y install libgtk2.0-dev libxt-dev libcairo2-dev
R --vanilla --no-save
install.packages("Cairo", repos = "https://cran.rstudio.com/")
quit()
# Texlive for Latex/knitr
sudo apt -y install texlive
sudo apt -y install texlive-latex-recommended texlive-pictures texlive-latex-extra
# Install Java 8, Sparklyr and Tensorflow
sudo apt update
#sudo update-java-alternatives -a # https://stackoverflow.com/questions/25246007/java-version-giving-me-a-no-such-file-or-directory/25246339
sudo apt -y install openjdk-8-jre
R --vanilla --no--save
# needs to be downloaded with install.packages
install.packages(c("sparklyr", "tensorflow"), repos = "https://cran.rstudio.com/")
library(tensorflow)
install_tensorflow(); yes # MIGHT INTERUPT SCRIPT?
library(sparklyr)
spark_install(version = "2.1.0")
quit()
# Git and GitKraken
sudo apt -y install git
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
eval "$(ssh-agent -s)" # start ssh in the background
ssh-add ~/.ssh/id_rsa # now add your key to Github https://help.github.com/en/enterprise/2.15/user/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
git config --global credential.helper store # make Github store username and password
sudo apt -y install curl
wget https://release.axocdn.com/linux/gitkraken-amd64.tar.gz
tar zxvf gitkraken-amd64.tar.gz
# Install Anaconda + CNVkit
sudo wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh
bash Anaconda3-2020.02-Linux-x86_64.sh
# Configure the sources where conda will find packages
conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge
conda create -n cnvkit cnvkit
# Install MoMI-G
sudo git clone https://github.com/MoMI-G/MoMI-G
cd MoMI-G
sudo apt -y install nodejs
#sudo apt -y install npm
#sudo npm install react-app-rewired --save-dev
sudo apt -y install curl
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt -y install yarn
#sudo yarn
#sudo yarn start
# Instalsudo apt install default-jdkl livecode
cd ~/bin
sudo apt -y install snapd
touch ~/.bash_aliases
echo "export PATH=\$PATH:/snap/bin/" >> ~/.bash_aliases
snap install ngrok
R --vanilla --no-save << EOF
remotes::install_github("rundel/livecode")
quit()
# Install OBS for twitch streaming
sudo apt -y install ffmpeg
sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt update
sudo apt -y install obs-studio
# Install NeoVim
sudo apt -y install neovim
# Install SpaceVim
curl -sLf https://spacevim.org/install.sh | bash
# Install Docker and Singularity
sudo apt -y install docker.io
sudo apt -y install singularity-container
# Dotfiles
## Install fortune | cowsay | lolcat
sudo apt -y install fortune-mod cowsay lolcat
echo "fortune | cowsay | lolcat" >> ~/.bashrc
# BioSyntax
wget https://github.com/bioSyntax/bioSyntax/releases/download/v1.0.0/bioSyntax-1.0.0.zip
unzip bioSyntax-1.0.0.zip # requires a bit more work to set up... follow the manual installation tips for `less`
# Install Samplot for visualizing SVs from BAM files
conda install -y --file https://raw.githubusercontent.com/ryanlayer/samplot/master/requirements.txt
git clone https://github.com/ryanlayer/samplot.git
#wget ftp://ftp.ensembl.org/pub/release-99/gff3/caenorhabditis_elegans/Caenorhabditis_elegans.WBcel235.99.gff3.gz
sudo apt -y install bedtools
#bedtools sort -i Caenorhabditis_elegans.WBcel235.99.gff3.gz | bgzip -c > Caenorhabditis_elegans.WBcel235.99.sorted.gff3.gz
#tabix Caenorhabditis_elegans.WBcel235.99.sorted.gff3.gz
#~/bin/samplot/src/samplot.py -n MADDOG -b 470.sorted.dedupped.bam -o samplot.png -c chrI -s 464950 -e 465071 -t DEL -T Caenorhabditis_elegans.WBcel235.99.sorted.gff3.gz
# Install VIPER
# first install java8. If you have 11 follow these instructions first: https://novicestuffs.wordpress.com/2017/04/25/how-to-uninstall-java-from-linux/
sudo apt install openjdk-8-jdk
sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-installer
sudo apt install oracle-java8-set-default
# since you need to switch between java8 and java11 alot see here: https://computingforgeeks.com/how-to-set-default-java-version-on-ubuntu-debian/
mkdir VIPER; cd VIPER
sudo apt -y install xvfb
wget https://github.com/MarWoes/viper/releases/download/v1.0.3/viper-v1.0.3.zip
unzip viper-v1.0.3.zip
curl -o viper-example.zip -L https://uni-muenster.sciebo.de/s/Qf6xIn2WDOyHhFN/download?path=%2F&files=
unzip viper-example.zip
# Install SVPV
## for GUI
cd ~/bin
wget ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/GraphicsMagick-LATEST.tar.gz
tar zxf GraphicsMagick-LATEST.tar.gz
git clone https://github.com/VCCRI/SVPV.git SVPV
sudo sh ./SVPV/set_up/Ubuntu_set_up.sh
# Install svviz2
wget http://tandem.bu.edu/trf/downloads/trf409.linux64
echo 'alias trf="~/bin/trf409.linux64"' >> ~/.bash_aliases
sudo chmod +x trf409.linux64
sudo snap install inkscape
sudo apt -y install python3-venv
sudo python3 -m venv svviz2
sudo pip3 install cython
sudo pip3 install genomeview # install genomeview-1.0.1 numpy-1.18.2 pysam-0.15.4
sudo pip3 install -U git+git://github.com/nspies/svviz2.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment