BWA (Burrows-Wheeler Aligner) installation quickie

Download the latest / required version of BWA:
http://sourceforge.net/projects/bio-bwa/files/bwa-0.7.12.tar.bz2/download

Unzip the downloaded file and navigate to the resulting directory:

  • tar -xvf bwa-0.7.12.tar.bz2
  • cd bwa-0.7.12

BWA doesn’t come with a ./configure file so we can just run

  • make

Which should compile everything nicely and result in a executable bwa binary file in the bwa-0.7.12 directory.  Once you have made this binary file all of the other files in the unzipped directory are no longer needed, they’re sole purpose  in life was to make that binary…

From here you can either run the binary from the bwa-0.7.12 directory. e.g.:

…/bwa-0.7.12/bwa aln…

or  move / copy the binary into /usr/bin/ if that’s your kind of thing.

 

9 thoughts on “BWA (Burrows-Wheeler Aligner) installation quickie

  1. Hi Graeme, thanks for this simple explanation.
    Everything goes smoothly for me until I try to do the ‘make’ command when I get this:

    gcc -c -g -Wall -Wno-unused-function -O2 -DHAVE_PTHREAD -DUSE_MALLOC_WRAPPERS utils.c -o utils.o
    utils.c:29:19: fatal error: stdio.h: No such file or directory
    #include
    ^
    compilation terminated.
    make: *** [utils.o] Error 1

    Do you have any idea why this is/how to fix it? This is for bwa.0.7.12.

    Thanks
    Laura

    • Hey Laura,
      I’m not in any way an expert but it looks like the error might have something to do with gcc, the C compiler that your computer is trying to use to make the BWA binary file.
      If you are using a newer version of MacOSX you might be able to update / install the gcc libraries you need by running:
      xcode-select –install
      or installing XCode: development tools from the mac store.
      If you are using another OS or if this doesn’t work let me know and I’ll have another think…
      Cheers!
      Graeme

    • Oh, and if you’re using Linux you could try:
      sudo apt-get install build-essential
      Let me know how you get along,
      Cheers

  2. Hi Graeme,

    Thank you so much for your help.
    I am on Linux, I vaguely read somewhere that compiling BWA requires zlib in order to compile which I think reflects what you have said. So I downloaded zlib 1.2.8 and can’t get that to ‘make’ either! But I executed the ‘sudo apt-get install build-essential’ command you said on zlib and I am not sure what it did but I think I selected to install it! I don’t know how to tell if this worked though.

    So I went to bwa and tried to ‘make’ again just to see but it was wishful thinking and I got the same error.

    Do you know if trying to get zlib is the right thing to do?

    Thanks again
    Laura

    p.s. I also did ‘make’ for zlib and ‘make check’ which I think worked but when I do ‘make install’ there is an error.

    • Heya,
      Hmm… Making sure that zlib is all there and accounted for sounds sensible…
      Maybe try:
      apt-get install zlib1g zlib1g-dev
      and
      apt-get install libc6-dev
      for good measure…
      If those don’t work we may be able to use a different C compiler… I’ll have a word with one of my sys admin friends…
      G

  3. Hej MrGraeme,

    I had the exact same error massage as Laura on my Mac OS X Yosemite. I tried “xcode-select –install” as you recommended and it worked. Thanks a lot! You saved my day 🙂

Leave a Reply

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