1. Setting up

1.1. Git

If Git is not already available on your machine you can try to install it via your distro’s package manager. For Debian/Ubuntu run sudo apt-get install git and for Fedora run sudo yum install git

Windows

  • https://git-for-windows.github.io/
  • Download the Git for Windows installer.
  • Run the installer

In any case, create also an account on GitHub - it will be useful for the hand-on exercises.

1.2. Jupyter

Jupyter notebook is an interactive web application that allows you to type and edit lines of code and see the output. The software requires Python installation, but currently supports interaction with over 40 languages.

Jupyter notebook examples

1.2.1. Installation

Jupyter install instructions

For new users, installation of Anaconda is highly recommended. Anaconda conveniently installs Python, the Jupyter Notebook, and other commonly used packages for scientific computing and data science.

Use the following installation steps:

  1. Download Anaconda. We recommend downloading Anaconda’s latest Python 3 version (currently Python 3.5).
  2. Install the version of Anaconda which you downloaded, following the instructions on the download page.

Install on UNIX machines:

First we will install Anaconda, a package manager for Python libraries.

  curl -OL https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda2-2.4.0-Linux-x86_64.sh
  bash Anaconda2-2.4.0-Linux-x86_64.sh

Install on Mac OS X:

First we will install Anaconda, a package manager for Python libraries.

  curl -OL http://repo.continuum.io/archive/Anaconda2-4.1.1-MacOSX-x86_64.sh
  bash Anaconda2-4.1.1-MacOSX-x86_64.sh -b

(If you are prompted, type Enter, then press Enter through the instructions. Be careful not to keep pressing Enter without reading otherwise you will end up saying No. You will need to type ‘Yes’ to continue with the installation.)

After Anaconda install has finished, type:

  source ~/.bashrc
  conda install jupyter
  conda install -c r r r-essentials

This will install packages allowing you to open either a new Python .ipynb or an R .ipynb.

Navigate to the directory on your computer with files you want to explore. Then type:

  jupyter notebook

This will open your browser with a list of files. Click on the “New” and bring down the pull-down menu. Under ‘Notebooks’, click on either R or Python language to start your new notebook!

You should see the files in the repository.

1.2.2. Using Jupyter notebooks:

The main keyboard command to remember is how to execute the code from a cell. Type code into a cell and then hit Shift-Enter.

If you’re in Python 2, type:

  print "Hello World!"

or for Python 3:

  print("Hello World!")

Then press Shift-Enter

For more instructions, the Help menu has a good tour and detailed information. Notebooks can be downloaded locally by going to the File menu, then selecting Download and choosing a file type to download.

1.2.3. References for learning Python

  • http://rosalind.info/problems/locations/
  • http://learnpythonthehardway.org/book/
  • http://www.learnpython.org/
  • http://www.pythontutor.com/visualize.html#mode=edit

1.3. R / RStudio

R is a programming language that is especially powerful for data exploration, visualization, and statistical analysis. To interact with R, we use RStudio.

Windows Install R by downloading and running the correct installer file from CRAN. Also, please install the RStudio IDE. Note that if you have separate user and admin accounts, you should run the installers as administrator (right-click on .exe file and select “Run as administrator” instead of double-clicking). Otherwise problems may occur later, for example when installing R packages.

Linux You can download the binary files for your distribution from CRAN. Or you can use your package manager (e.g. for Debian/Ubuntu run sudo apt-get install r-base and for Fedora run sudo yum install R). Also, please install the RStudio IDE.

1.3.1. Install the required packages

install.packages(c("dplyr", "tidyr", "vegan", "ggplot2"));

1.4. Install the R Kernel for Jupyter

Jupyter by default supports python, but this functionality can be expanded by using additional kernels. For our case, we will use also the R kernel. After launching R, run the following commands:

install.packages('devtools')
devtools::install_github('IRkernel/IRkernel')
IRkernel::installspec()  # to register the kernel in the current R installation

That’s it, all done! You have now all the tools in place!