Installing Cufflinks (RNA-Seq) on Ubuntu

So, you have a ton of hard-disks spinning with RNA Seq data you need to analyse? Excellent. But first you need some software to do that. This post follows the nature protocol described by Trapnell et el. described here (something freely accessible from nature publishing group – must be my lucky day today).

Boost Libraries

First, you will need boost libraries installed.  You might be tempted to do this via sudo apt-install libboost-all-dev, you lazy… That is a terrible idea in this instance. You may miss this little note of relevance: WARNING: Due to a serious issue with Boost Serlialization [sic] library introduced in version 1.56, Cufflinks currently can Boost Librariesonly be built with Boost version 1.55 or lower. The issue is expected to be fixed in the upcoming Boost v1.59.. Guess what version is installed by apt-get in Ubuntu 16.04 LTS? Yeah, 1.58. Bad luck bro.

Download the latest version of the boost libraries from sourceforge (sourceforge in 2016!, wait let me send a Fax with a complaint). Installing this is relatively straightforward nowadays. Here is what you should do ($ is the bash prompt, you don’t need that)

$ tar zxvf boost_1_61_0.tar.gz
$ cd boost_1_61_0
$ ./bootstrap.sh --prefix=/opt/boost_1_61_0
$ ./b2                                     
$ sudo ./b2 install

The prefix will define where to install the boost libraries. It is critical to define this, so all the installations are contained (and easily removed/updated). Also, you will need to add these to lines to ~/.profile.

export BOOST_ROOT=/opt/boost_1_61_0
export LD_LIBRARY_PATH=$BOOST_ROOT/lib:$LD_LIBRARY_PATH

Make sure to re-source the file after you make these changes (either reopen the terminal or source ~/.profile)

Bowtie2

Next in our install list, is bowtie2 – a short sequence aligner. Download the latest version from sourceforge (arrgghhh what is wrong with you bioinf people?!). Note that you need to download the source version (as we are going to build the binaries ourselves).

$ unzip bowtie2-2.2.9-source.zip
$ sudo apt-get install libtbb-dev
$ cd bowtie2-2.2.9
$ make WITH_TBB=1
$ cd ..
$ sudo mv bowtie2-2.2.9 /opt

The tbb library is a threading library which offers shorter running times on multi-core architectures. make WITH_TBB=1 will compile binaries which make use of this library. Some more detailed instructions can be found in the user manual.

TopHat

TopHat uses Bowtie for read alignment but adds the ability to align spliced juctions. Nowadays TopHat is superseded by (more efficient and accurate) HiSat2, but the protocol described by Trapnell et al. still uses this. Download the latest release of TopHat (presently version 2.1.1).

$ tar xzvf tophat-2.1.1.tar.gz
$ cd tophat-2.1.1
$ ./configure --prefix /opt/tophat-2.1.1 --with-boost=/opt/boost_1_61_0
$ make
$ sudo make install

Testing TopHat/Bowtie

Download the test data and execute the following commands:

$ tar zxvf test_data.tar.gz
$ cd test_data
$ tophat -r 20 test_ref reads_1.fq reads_2.fq

You should see the words Run complete: 00:00:00 elapsed if the test case ran successfully.

SAM tools

Cufflinks requires SAM tools to be installed (yet another dependency, and sourceforge once again). This requires some tinkering around to get it to work. Warning: Do not go for the latest version (from github) of SAMTools as this will not work with the current version of cufflinks. Version 0.1.19 works with cufflinks 2.2.1. Also, there is a note that htslib is now more accurate and efficient, please ignore.

$ tar xjvf samtools-0.1.19.tar.bz2
$ cd samtools-0.1.19
$ make
$ sudo mkdir -p /opt/samtools-0.1.19/bin /opt/samtools-0.1.19/include/bam /opt/samtools-0.1.19/lib
$ sudo cp libbam.a /opt/samtools-0.1.19/lib
$ sudo cp *.h /opt/samtools-0.1.19/include/bam

Cufflinks

First you need to install the Eigen library.  You may be again tempted to do this via apt-get install. This didn’t work for me (building cufflinks comet vomits on Eigen). My installation works with version Eigen v3.2.8. Safe to download from the Eigen repo and install it in the following manner.

$ tar xjvf 3.2.8.tar.bz2
$ cd eigen-eigen-07105f7124f9
$ sudo mkdir /opt/eigen3
$ sudo cp -rv ./Eigen /opt/eigen3
$ export EIGEN_CPPFLAGS="-I/opt/eigen3"

The --with-eigen= configure option does not work (annoyingly) which is why you need to set EIGEN_CPPFLAGS to the Eigen3 location.

Download the latest version of Cufflinks (from github, finally). The current version is 2.2.1. Then:

$ tar xzvf cufflinks-2.2.1.tar.gz
$ cd cufflinks-2.2.1
$ ./configure --prefix=/opt/cufflinks-2.2.1 --with-boost=/opt/boost_1_61_0 --with-bam=/opt/samtools-0.1.19
$ make 
$ sudo make install

This will take a while. After it finishes you now need to set some more environment variables in your ~/.profile. BOOST_ROOT should have already been set in a previous step (somewhere above).

export BOOST_ROOT=/opt/boost_1_61_0
export SAMTOOLS=/opt/samtools-0.1.19
export LD_LIBRARY_PATH=$BOOST_ROOT/lib:$SAMTOOLS/lib:$LD_LIBRARY_PATH
export RNA_SEQ_TOOLS=/opt/bowtie2-2.2.9:/opt/tophat-2.1.1/bin:$SAMTOOLS/bin:/opt/cufflinks-2.2.1/bin
export PATH=.:$RNA_SEQ_TOOLS:$PATH

Remember you need to source ~/.profile after these changes.

Testing Cufflinks

Download the cufflinks test file. Now from the directory where you saved the file run cufflinks ./test_data.sam. This will create some console output and a file called transcripts.gtf (this should have some exons if you cat transcripts.gtf).

Hope you made it this far in considerable less time than myself.  It took me close to two days to set me up with cufflinks …


Posted

in

by

Tags:

Comments

14 responses to “Installing Cufflinks (RNA-Seq) on Ubuntu”

  1. Peter Maguire Avatar
    Peter Maguire

    So first of all, love your informative and humorous write up. I found it incredibly useful in installing Cufflinks and its dependencies, which I found to be more troublesome than expected. Quick question, when installing Eigen where is the ./Eigen directory being copied to?

    Line in questions:
    > sudo cp -rv ./Eigen .

    Thanks for the clarification and for taking the time to do this post!

    1. jp Avatar
      jp

      Hi Peter – pleased to meet you.

      My bad of course, there is a bug in the tutorial! Fixed it. Eigen should be copied to /opt/eigen3 dir.

  2. Nathalie Avatar
    Nathalie

    Hi
    First thank you so much for this page!!!!

    I am getting this error message
    checking for bamlib… configure: error: We could not detect the bam libraries (version or higher). If you have a staged bam library (still not installed) please specify $BAM_ROOT in your environment and do not give a PATH to –with-bam option. If you are sure you have bam installed, then check your version number looking in . See http://randspringer.de/bam for more documentation.

    I tried to put the files under usr/ and usr/local and not specify the with-bam but I still get this message. Any idea? How can I test if my samtools is installed and why cufflinks doesnt see my bam?

    Thanks

    1. Nathalie Avatar
      Nathalie

      Fixed it!!! I used samtools .18 instead of .19 but most important i think i used sudo ./configure.

      Also had to move the eigen3 folder into the usr/include otherwise it couldnt find it.

      But seems to be working now. Thank you so much for this page!!!

  3. NJ Avatar
    NJ

    Hi
    I have issue when I install Tophat:

    $ tar xzvf tophat-2.1.1.tar.gz

    $ cd tophat-2.1.1

    $ ./configure –prefix /opt/tophat-2.1.1 –with-boost=/opt/boost_1_61_0

    after I type “./configure –prefix /opt/tophat-2.1.1 –with-boost=/opt/boost_1_61_0”, I see

    checking for boostlib >= 1.38.0… configure: error: We could not detect the boost libraries (version 1.38 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to –with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation.

    Then I type

    dpkg -s libboost-dev | grep ‘Version’

    Version: 1.58.0.1ubuntu1

    **Why the version is still 1.58 but not 1.61?

    **How do I know I already successfully install boost 1.61?

    How to solve “configure: error: We could not detect the boost libraries (version 1.38 or higher).” problem? Thanks!!**

    1. jp Avatar
      jp

      Do you need that specific version of boost? Can you just “`sudo apt-get install libboost-all-dev“`

  4. Abdel Avatar
    Abdel

    Hi,
    thank you for this detailed guide.

    it seems that the instructions for 15.04 are valid for 16.04 as well:
    http://installion.co.uk/ubuntu/vivid/multiverse/c/cufflinks/install/index.html

    Best regards,
    AG

  5. yogesh Avatar
    yogesh

    I am not able to install Cufflink… it shoes error :

    checking for bamlib… configure: error: We could not detect the bam libraries (version or higher). If you have a staged bam library (still not installed) please specify $BAM_ROOT in your environment and do not give a PATH to –with-bam option. If you are sure you have bam installed, then check your version number looking in . See http://randspringer.de/bam for more documentation.

    1. Kirt Avatar
      Kirt

      I am having the same problem. Did you ever get it figured out?

    2. Peter Waltman Avatar
      Peter Waltman

      Is there a reason that you need a specially compiled version of cufflinks (as opposed to using the pre-compiled version)? I found that there are multiple bugs in the compile scripts, e.g. the configure.ac file doesn’t include the script for eigen (i.e. it needs to have this line “m4_include([ax_check_eigen.m4])” listed at the beginning. Otherwise, the “–with-eigen” option doesn’t work.

      Similarly, the m4 script for processing the sam libraries is written with the expectation that they are a) in /usr/lib or /usr/local/lib; and b) that they are in a directory with the format “bam-“. And from this format, it will get the version number of the bamlibs that you have installed. Otherwise, it “thinks” that the version number is 0, and throws the error that you are reporting. My “fix” was to hardcode in the version number of the version of samtool that I’m using. However, I found that compilation crashes nearly immediately b/c it still can’t find the eigen libs/tools.

      At this point, I’m about to give up on cufflinks, in favor of more recent tools that are still being actively maintained, that are described in this write-up: http://www.nature.com/nprot/journal/v11/n9/full/nprot.2016.095.html

  6. Vassil Avatar
    Vassil

    Hi,

    Many thanks for the details tutorial. Is there any reason why one should not simply install tophat, bowtie2, and samtools (and bedtools if necessary) using sudo apt-get install? For cufflinks I used the ready binaries provided on github and then moved them to /usr/local/bin. Ran the test_data and it looked fine. Would that potentially cause any problems in the future? Thanks

  7. Rachel Avatar
    Rachel

    Hi,
    I am getting the following error after I use the “make” command for installing cufflinks

    Makefile:1418: recipe for target ‘abundances.o’ failed
    make[2]: *** [abundances.o] Error 1
    make[2]: Leaving directory ‘/software/cufflinks-2.2.1/src’
    Makefile:258: recipe for target ‘all-recursive’ failed
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory ‘/software/cufflinks-2.2.1’
    Makefile:196: recipe for target ‘all’ failed
    make: *** [all] Error 2

    Any help will be appreciated. Thanks!

  8. Johana Avatar
    Johana

    And so!!! thank you so much! you save me 24 hours!! After fighting hard with the shell, It worked in ubuntu 17.10!
    I would like to add some tips:
    1. Try to do all steps as sudo, it solved all my “We could not detect…..” dennied permission….” and similars!!!
    2. I don’t know if this tips is 2 or 3…. My main headache was Eigen!!! “fatal error: Eigen/Dense: No such file or directory” I saw it for many hours!!!

    I solved by fixing mkdir and coping eigen to /usr/include, appear to be that The eigen3 header files should go in a subdirectory /usr/include/eigen3 e.g.
    /usr/include/eigen3/Eigen/Array
    /usr/include/eigen3/Eigen/Cholesky
    /usr/include/eigen3/Eigen/CholmodSupport
    /usr/include/eigen3/Eigen/Core
    /usr/include/eigen3/Eigen/Dense
    /usr/include/eigen3/Eigen/Eigen

    and solved! I made a link inside /usr/local/include to /usr/include/eigen3/Eigen executing sudo ln -s /usr/include/eigen3/Eigen /usr/local/include/Eigen

    3. Cufflinks!!!!! didn’t install yet!!
    I had fixed my prefix=/opt to istall all dependecies and I had to change all to /usr/include!!

    And Eureka!! Finally!

  9. jp Avatar
    jp

    WordPress with Twenty-Sixteen Theme

Leave a Reply

Your email address will not be published. Required fields are marked *