Hi all!

I am using bwa 7.12 to map reads to reference genome. I was analysing exome when after 40 min of running the error appeared:

[gzclose] buffer error

I've red that I should upgrade the zlib package for actual bwa version, but I have no clue how to do that (to make it compatible with bwa).

In addition, I didn’t have this problem before upgrading my Ubuntu to 16.4 version. Could this upgrade mess with my bwa configurations? 

Any help would be much appreciated. 

To be more specific I've tried:

    $ wget http://downloads.sourceforge.net/project/bio-bwa/bwa-0.7.12.tar.bz2
    $ tar xvjf bwa-0.7.12.tar.bz2
    $ cd bwa-0.7.12
    $ sed -e's#INCLUDES=#INCLUDES=-Izlib-1.2.11/ #' -e's#-lz#zlib-1.2.11/libz.a#' Makefile > Makefile.zlib
    $ wget http://zlib.net/zlib-1.2.11.tar.gz
    $ tar xvzf zlib-1.2.11.tar.gz
    $ cd zlib-1.2.11
    $ ./configure
    $ make
    $ cd ..
    $ make -f Makefile.zlib

but it didn't work...

Best,

Agata
First, I would suggest you check your fastq files are not truncated or corrupted. 

If you bwa is from Ubuntu repositories, then the error is probably not related to an old zlib, as Ubuntu Xenial zlib is 1.2.8, and the error you reported is linked to zlib older than 1.2.4. Anyway, you may install a newer bwa:

    wget https://sourceforge.net/projects/bio-bwa/files/bwa-0.7.15.tar.bz2
    tar -xvjf bwa-0.7.15.tar.bz2
    cd bwa-0.7.15/
    make

Then add this folder to the PATH.
