Question: Installation Of Tophat -1.1.4
gravatar for Dayana Janakiraman
5.3 years ago by
Dayana Janakiraman30 wrote:

hi all, am installing tophat and for past 3 days am trying , i could not succeed in it.. the error bug which i get is:

checking for gawk... (cached) gawk
checking for ranlib... ranlib
checking for ar... ar
checking for perl... /usr/bin/perl
checking for bash... /bin/bash
checking for a Python interpreter with version >= 2.4... python
checking for python... /usr/local/bin/python
checking for python version... 2.7
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.7/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.7/site-  packages
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 <bam version.hpp="">. See for more documentation.

I have samtools, bowtie installed.and tried all other possible ways up to my knowledge as of:

  • setting new path variables,
  • changing CFLAG to CXXFLAG in tophat/config.h file
  • checked gcc utilities (it is 4.1.1 version) and
  • moved bowtie, bowtie-inspect, bowtie-build to /usr/local/bin and

still cannot solve out..some body please help me out.. thankzzz in advance...

installation tophat rna error • 9.3k views
ADD COMMENTlink modified 6 months ago by Xingyu Yang210 • written 5.3 years ago by Dayana Janakiraman30
gravatar for brentp
5.3 years ago by
Salt Lake City, UT
brentp21k wrote:

I finally found how to do this. Somewhat confusing instructions are here. You can see that tophat and cufflinks expect samtools (what they call bamlib) libraries and headers to be installed.

More simply,here is a shell script to install samtools stuffs properly so that tophat and cufflinks can use it:


sudo mkdir -p /usr/local/include/bam
sudo cp ${SAMTOOLS}/libbam.a /usr/local/lib/
sudo cp ${SAMTOOLS}/*.h /usr/local/include/bam
sudo cp ${SAMTOOLS}/samtools /usr/local/bin/

you may want to adjust your paths depending on where you have samtools and where the standard place for libraries on your system.

ADD COMMENTlink written 5.3 years ago by brentp21k
gravatar for brentp
5.3 years ago by
Salt Lake City, UT
brentp21k wrote:

I have had trouble building tophat in recent versions, even after doing as @neilfws suggests (and trying various --with-bam invocations).

They have downloads of both i386 and x64 binaries -- which work for me.

ADD COMMENTlink written 5.3 years ago by brentp21k

sounds very nice..

ADD REPLYlink written 5.3 years ago by Dayana Janakiraman30

thanksss brentp....

ADD REPLYlink written 5.3 years ago by Dayana Janakiraman30

+1 I also had trouble building. It's a shame that TopHat is so difficult to build. I build 100s of tar.gz packages every year without much difficulty but there are inevitably one or two like this one which I end-up forced to install in a black-box which was compiled by someone else.

ADD REPLYlink written 5.2 years ago by Aleksandr Levchuk3.0k

No matter how I try, It alway complain this stupid error. Have switched to RUM for RNA-seq

ADD REPLYlink written 23 months ago by ruansun198330

Had the same problem. I fixed it by modifying the read permissions on the files after I moved them to the directories as described by brentp.

chmod 755 /usr/local/lib/libbam.a

chmod 755 /usr/local/include/bam/*.h

ADD REPLYlink modified 22 months ago • written 22 months ago by djf0
gravatar for Neilfws
5.3 years ago by
Sydney, Australia
Neilfws45k wrote:

The problem, as the error message states, is that the installer cannot find the bam libraries.

This is probably because they are in a non-standard location (such as /usr/lib or /usr/local/lib). You mention that you had to move the bowtie executables to /usr/local/bin, so I suspect that you may have installed bowtie to a non-standard location. Moving the executables is not enough if the libs are in the wrong place.

As the error message suggests, you can specify $BAM_ROOT:

export BAM_ROOT=/path/to/bam/parent/directory

However, I think it might be best to start from scratch: remove what you have installed, unpack the downloaded tarballs, ensure that bowtie is correctly installed in a standard location and take it from there.

ADD COMMENTlink written 5.3 years ago by Neilfws45k

oh.ok.ok.then let me try it..and my fedora is 2.6.2..forgot of mentioning it..

ADD REPLYlink written 5.3 years ago by Dayana Janakiraman30
gravatar for Xingyu Yang
6 months ago by
Xingyu Yang210
Xingyu Yang210 wrote:

I understand this is a very old post. However, after following the top rated answer, I still get the same error.

Fix it by rename the XXX/include/bam/version.h to version.hpp.

The source code (bam.h) includes "version.hpp" rather than "version.h"

ADD COMMENTlink written 6 months ago by Xingyu Yang210

You should add this as a comment to the first answer :-)

ADD REPLYlink modified 6 months ago • written 6 months ago by Tky910
gravatar for Dayana Janakiraman
5.3 years ago by
Dayana Janakiraman30 wrote:

hi all. i got my tophat working with tophat 1.0.14.tar.gz and am proceeding with RNA-Seq analysis..thanks to all......with

ADD COMMENTlink written 5.3 years ago by Dayana Janakiraman30
gravatar for Yifang
5.1 years ago by
Yifang0 wrote:

Still struggle with the installation of tophat-1.2.0. I have tried everything suggested above, but still not through! Only one thing I was not sure is the PATH settings. Here is what I did: 1. bowtie was successfully installed in $HOME/Downloads/bowtie-0.12.7, and it was running correctly with my real data; 2. tarball of tophat-1.2.0 was downloaded and extracted in $HOME/Downloads/tophat-1.2.0. 3. samtools was also downloaded and installed in $HOME/Downlads/samtools-0.1.13. At least no complain was seen during installation. 4. the libraries needed was copied in other folders created by: cp $HOME/Downloads/samtools-0.1.8/libbam.a $HOME/software/bin/lib cp $HOME/Downloads/samtools-0.1.8/*.h $HOME/software/bin/include/bam

By the way, I have added following lines to my /etc/bash.bashrc: export PATH=$PATH:$HOME/Downloads/samtools-0.1.13 export PATH=$PATH:$HOME/Downloads/software/bin/lib:$HOME/software/bin/lib/include/bam

  1. Then I went to tophat-1.2.0 and issued: ./configure --prefix=$HOME/Downloads/tophat-1.2.0 --with-bam=$HOME/software/bin No complain. ...... config.status: creating config.h config.status: executing depfiles commands

-- tophat 1.2.0 Configuration Results -- C compiler: gcc -Wall -m64 -O3 -DNDEBUG C++ compiler: g++ -Wall -m64 -O3 -DNDEBUG -I/home/yifang/software/bin/include GCC version: gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5 Host System type: x86_64-unknown-linux-gnu Install prefix: /home/yifang/Downloads/tophat-1.2.0 Install eprefix: ${prefix}

See config.h for further configuration information. Email with questions and bug reports.

  1. but the error showed up when try to make by: :~/Downloads/tophat-1.2.0$ make ---------------------error message--------------------- make all-recursive make[1]: Entering directory /home/yifang/Downloads/tophat-1.2.0' Making all in src make[2]: Entering directory/home/yifang/Downloads/tophat-1.2.0/src' .. juncs_db.cpp:327: instantiated from here ./SeqAn-1.1/seqan/sequence/string_base.h:207: error: no matching function for call to ‘_setLength(seqan::String[?]&, int)’ make[2]: [juncs_db.o] Error 1 make[2]: Leaving directory /home/yifang/Downloads/tophat-1.2.0/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/home/yifang/Downloads/tophat-1.2.0' make: [all] Error 2

Believe is the setting problem. Please help me out this. Thanks a lot!

ADD COMMENTlink written 5.1 years ago by Yifang0

Please see this related question for the answer: While you're here, take a look around the various questions. This site is a bit different than a standard forum; you've asked your question in an answer field. When you have a new question, please click the 'Ask question' link in the top right of the page. Hope this helps.

ADD REPLYlink written 5.1 years ago by Brad Chapman8.9k
gravatar for jason.ross
22 months ago by
jason.ross0 wrote:

If anyone else has recently stumbled onto this thread due to the Tophat2 "checking for bamlib... configure: error" then my advice is, at this point in time, don't try and compile Tophat2 with the newest versions of samtools.

Here is my story. I hope this saves some other soul from hours of frustration.


So, I was trying to compile from source due to this error message when I run the binary:

Error: TopHat requires Samtools 0.1.7 or later

When I, in fact, have this version installed:

samtools --version
samtools 0.2.0-rc9-1-g1ff7535
Using htslib 0.2.0-rc9-4-gc8c5b31

So I try to compile from source and run into dramas with the configure script which is a bit brain damaged and has incorrect documentation. 

The documentation states:

Notes on compiling the package from source:
TopHat requires the Samtools package ( 
in order to generate and handle the compressed, binary alignment files (BAM).
The --with-bam=<bam_prefix> option of the configure script expects the
following subdirectories and files:

<bam_prefix>/include/bam/*.h (all the header files from Samtools)
<bam_prefix>/lib/libbam.a (obtained by compiling Samtools)

At the time of this writing the Samtools package does not have an
install routine the user will have to explicitly create the above 
directory structure (./include/bam/ and ./lib) and copy the required 
Samtools files as indicated (the header files and libbam.a)

However, after much trouble shooting and pain I finally realise I'm not at fault so I start reading the configure shell script. Somewhere around line 4000 I see these lines:

for i in `ls -d $ac_bam_path/include/bam-* 2>/dev/null`; do
                    echo $i
                    _version_tmp=`echo $i | sed "s#$ac_bam_path##" | sed 's/\/include\/bam-//' | sed 's/_/./'`


So, the script looks for directory names under the relative path "include/bam-*" and not "include/bam" as the documentation states. Then, it carves the bam version out of this user created directory name using sed. Why? This is so fragile! Using a user created directory name to work out the version is a recipe for disaster, plus telling the user to create a directory with no version name in the docs really obscures things?! Why not parse the output of 'samtools --version' from the "$ac_bam_path" folder to get the version number! :/

Okay, so I rename the folder and now I can run 'configure' without errors. So I type make and now I get compilation errors because the new versions of samtools have separate htslib libraries. So I copy the htslib header files into "/usr/local/include/bam-0.2.0-rc9-1-g1ff7535/htslib" and try again. This time I get a new error.

common.h: In member function ‘void GBamRecord::add_aux(const char*, char, int, uint8_t*)’:

common.h:372:10: error: ‘struct bam1_t’ has no member named ‘l_aux’
common.h: In member function ‘void GBamWriter::write(bam1_t*, int64_t)’:
common.h:598:35: error: ‘BAM_CORE_SIZE’ was not declared in this scope


It's taken two days to get to this point and now I'm giving up. Time to remove samtools 0.2.0 from the path and try with version 0.1.8 and the Tophat2 binary. Failing that, I will convert my workflow to STAR, which happily compiled and is aligning reads nicely.


ADD COMMENTlink modified 22 months ago • written 22 months ago by jason.ross0

An update... compiled from source samtools 0.1.19 is playing nicely with pre-compiled Tophat2 2.0.11. So, the moral is, don't use the git clone 0.2.0 version of samtools. It breaks Tophat version checking and the Tophat configure script and docs have an error.


ADD REPLYlink written 22 months ago by jason.ross0

I met the same problems just as you described. :\

ADD REPLYlink written 20 months ago by Fred07300
gravatar for jason.ross
22 months ago by
jason.ross0 wrote:

Arrrghhh... I'm really starting to despair :/

This time I got up to the bowtie-align part of proceedings and find that Tophat aborts. After more inspection of the run logs and some testing I find that fix_map_ordering is failing because there are no @SQ lines in the SAM header. Google to the rescue and I find a thread that seems to answer this puzzle.!topic/tuxedo-tools-users/vG5Rn0IgxoA

Apparently this time, it's a Bowtie2-inspect bug that causes an initial Tophat step to silently fail but then trip up later on the malformed SAM header. The fix is to hack the Tophat Python code and insert at the appropriate place:

if params.bowtie2:
    bowtie_header_cmd += ["-x"]


ADD COMMENTlink written 22 months ago by jason.ross0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 857 users visited in the last hour