How do I get my computer ready for Bioinformatics 2111?
I just got a new Apple laptop, so I get to do a fresh start. By the time I get through 4 years with a machine, I’ve generally installed and tweaked so much bioinformatics software and supporting libraries (and probably installed some of it via obsolete tools) that I literally can not tell students how to exactly replicate the working environment I have. As always, xckd knows how it is:
So I am going to keep track of as much setup of the new computer as possible. If you have never done any of the things below to your computer, then you are probably going to need to do them to get it ready for class.
Make sure you have Admin privileges
Do you have admin access to your own computer? How do you tell? On a Mac, go into System Preferences > Users and Groups. If you don’t see the group “Admin” under your name as current user, you might have a problem following some of the steps below. Someone who already has Admin privileges will have to select “Allow user to administer this computer” to give you Admin privileges.
We want XCode because it provides some tools that software developers need, like standard compilers. Even if you’re only ever going to install scientific software packages and not write your own, you need these — new packages often need to be compiled, and they often have dependencies on standard code libraries (repositories that developers can use so they don’t have to rewrite the same function that someone else has already perfected).
Download XCode from the App Store. Then, open the XCode icon and accept the license (it will then install its own components automatically, including the stuff you need, like gcc and make). You’ll be able to keep XCode updated via the App Store from now on.
Download installers and package managers
There’s a class of software out there that basically makes it easier to install other software. The package managers that matter for us most in this class are homebrew and pip. You can install the homebrew package manager by typing the following (all on one line) at the UNIX command line. Don’t know how to access that? We’ll show you how.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install python 3
By default, your Apple computer might still be running python 2.7. The python developers make both v. 2 and v. 3 available and are maintaining both of them simultaneously so as not to break legacy applications that rely on v2. But you want to be learning v3, because eventually v2 will go away. To get Python 3 installed on your computer, type:
brew install python
The default version that homebrew will install is the latest version of python 3. To run python, you type:
If you ever need to upgrade to a newer version of python (you will) you just need to type:
brew upgrade python
Homebrew will get you the correct version and clean up all the old files, too.
To make a python script, you include the following line at the very top of every script that you expect the python interpreter to run, and you also make the script executable (we’ll show you how):
Install some packages with pip3
The pip3 package manager, which is another useful one for us, will be included with the python package. Use pip3 to install some useful python packages. You want to use pip3 rather than just pip to be sure these install with awareness of python3.
pip3 install scipy pip3 install biopython pip3 install jupyter
Now you’ve got some extensions for python that are specific for science (bioinformatics software with python components will often need for you to have scipy and numpy) and the Jupyter system that will let you interactively work on code in your web browser.
Start the Jupyter notebook server
Jupyter is an environment that lets you enter and test code in a web browser environment (among many other things). In the course, we’re going to use it for coding practice worksheets and in-class assignments. In order to run Jupyter, make a directory that you want to put all your stuff in — so maybe in your home directory you create a directory called “Notebooks” by typing:
at the command line. Then change your working directory so that you are “in” the Notebooks directory, by typing:
Finally, start jupyter by typing:
Your web browser should pop open with a new window that says Jupyter at the top, and if you had any files in the Notebooks directory, they would be listed there.
But what if I have Windows?
But what if I have Linux?
Installation of python and its modules and running Jupyter won’t be too much different than on the Apple computer. The package managers available are different, but if you’re an experienced enough Linux user that you chose that as your default OS, you won’t have any trouble!