Book Image

Bioinformatics with Python Cookbook

By : Tiago R Antao, Tiago Antao
Book Image

Bioinformatics with Python Cookbook

By: Tiago R Antao, Tiago Antao

Overview of this book

Table of Contents (16 chapters)
Bioinformatics with Python Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Installing the required software with Docker


Docker is the most widely used framework that implements operating system-level virtualization. This technology allows you to have an independent container: a layer that is lighter than a virtual machine, but still allows you to compartmentalize software. This mostly isolates all processes, making it feel like each container is a virtual machine.

Docker works quite well at both extremes of the development spectrum: it's an expedient way to set up the content of this book for learning purposes and may be your platform to deploy your applications in complex environments. This recipe is an alternative to the previous recipe. However, for long-term development environments, something along the lines of the previous recipe is probably your best route, although it can entail a more laborious initial setup.

Getting ready

If you are on Linux, the first thing you have to do is to install Docker. The safest solution is to get the latest version from https://www.docker.com/. While your Linux distribution may have a Docker package, it may be too old and buggy (remember the "advancing at breakneck speed" thingy?).

If you are on Windows or Mac, do not despair; boot2docker (http://boot2docker.io/) is here to save you. Boot2docker will install VirtualBox and Docker for you, which allows you to run Docker containers in a virtual machine. Note that a fairly recent computer (well, not that recent, as the technology was introduced in 2006) is necessary to run our 64-bit virtual machine. If you have any problems, reboot your machine and make sure that on the BIOS, VT-X or AMD-V is enabled. At the very least, you will need 6 GB of memory, preferably more.

Note that this will require a very large download from the Internet, so be sure that you have a big network pipe. Also, be ready to wait for a long time.

How to do it…

These are the steps to be followed:

  1. Use the following command on the Linux shell or in boot2docker:

    docker build -t bio https://raw.githubusercontent.com/tiagoantao/bioinf-python/master/docker/2/Dockerfile
    
    • If you want the Python 3 version, replace the 2 with 3 versions on the URL. After a fairly long wait, all should be ready.

    • Note that on Linux, you will either require to have root privileges or be added to the Docker Unix group.

  2. Now, you are ready to run the container, as follows:

    docker run -ti -p 9875:9875 -v YOUR_DIRECTORY:/data bio
    
  3. Replace YOUR_DIRECTORY with a directory on your operating system. This will be shared between your host operating system and the Docker container. YOUR_DIRECTORY will be seen in the container on /data and vice versa.

    • The -p 9875:9875 will expose the container TCP port 9875 on the host computer port 9875.

  4. If you are using boot2docker, the final configuration step will be to run the following command in the command line of your operating system, not in boot2docker:

    VBoxManage controlvm boot2docker-vm natpf1 "name,tcp,127.0.0.1,9875,,9875"
    

    Note

    On Windows, this binary will probably be in C:\Program Files\Oracle\VirtualBox.

    On a native Docker installation, you do not need to do anything.

  5. If you now start your browser pointing at http://localhost:9875, you should be able to get the IPython Notebook server running. Just choose the Welcome notebook to start!

See also

  • Docker is the most widely used containerization software and has seen enormous growth in usage in recent times. You can read more about it at https://www.docker.com/.

  • You will find a paper on arXiv, which introduces Docker with a focus on reproducible research at http://arxiv.org/abs/1410.0846.