Using Conda
You should be using conda! It's amazing! That's all.
These are install instruction for linux (synergy) but you can install conda on Mac and Windows as well. Full instructions are here.
On synergy in your home directory download the installer script by typing:
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
Then type:
bash Miniconda3-latest-Linux-x86_64.sh
This will walk you through the license agreement (say yes) and ask you for an install location. The default: ~/miniconda3
is fine. Notice this is your home directory, which means you can install anything you like! When the install is done the installer will ask you:
Do you wish the installer to prepend the Miniconda3 install location to
PATH in your /home/<your_home_directory>/.bashrc ? [yes|no]
Say no then add the following line to your .bash_profile
using a text editor. Open the file (will be created if doesn't exist)
nano ~/.bash_profile
Note the .
, this is important. Add the following line at the end of the file then save and close.
export PATH=~/miniconda3/bin:$PATH
Now log out and log back in for the changes to take effect. Type conda list
to test the install. You'll see a list of things that conda has installed for you - mostly python packages. Type which python
to see that you now have your own python installed in your home directory.
To get access to many more bioinformatic programs, including R and Bioconductor add the following channels by typing:
conda config --add channels conda-forge
conda config --add channels defaults
conda config --add channels r
conda config --add channels bioconda
As an example let's install snpeff
- Figure out if it's available in conda by doing one of the following.
- Type
conda search snpeff
- Browse through bioconda
- Type
- Install it:
conda install snpeff
The program should now be available on your path for you to use.
The real power of conda is using environments to manage multiple versions of software and keep your analysis reproducible.
Every conda install starts with a root environment. When you type conda install
by default it will install into your root environment. However, let's say you want to try this new fancy software you read about in the latest Nature paper however the developers of said software are, for some bizarre reason, still using Python 2.7 but you have Python 3.6 installed. But the developers have made it available on conda so yay, and you try conda install cool_app
. Whoa, hold the phone, what's with all those errors?! You read the error message carefully and see that you have another great piece of software you've already installed with conda but it needs Python 3.6. No go. What to do? Use environments.
Instead you try creating a new environment:
conda create -n cool_app
Now let's activate it (watch what happens to your terminal prompt):
source activate cool_app
And try that install again:
conda install cool_app
Aah, much better! Now you run your stuff and everything is peachy. You got your answer and want to go and do something else now:
source deactivate
And now you're back in your root environment. You see any environment you've created with conda env list
and activate any of them with source activate [env]
.
Environments are essentially independent. This allows you to resolve incompatible dependencies that are so common in bioinformatics tools. The most common incompatibility you'll likely encounter is Python 2/3 and sometimes Blast/Blast+.
Environments are also useful for troubleshooting or trying out something experimental that you may later just want to delete. You can get rid of old environments with conda env remove -n [env]
.
There's lots more to conda environments so if you want to go further the best place to start is the documentation.