Friday, January 29, 2010

Getting Bio::DB::Sam and samtools working on openSUSE 11.2

The makefile in the samtools package needs some minor modifications in order for this setup to work. Unpack the samtools source package and open Makefile in your favourite editor.
Change the CFLAGS line to read:

CFLAGS= -g -Wall -O2 -fPIC
Depending on your system architecture you may want to make additional changes there. The above change is likely to be necessary to get the Perl modules to compile.
Further down in the file change the libcurses implementation -lncurses:
LIBCURSES= -lncurses
This is required as SUSE uses as different curses implementation than samtools expects. Next make the samtools package by executing make when in the source directory. (The rest of this document assumes you're working in your favourite terminal application). If you compiled the source before or aren't sure issue a 'make clean' first.
make clean && make
If you want easier acces to the executables remember to copy samtools and razip to a folder that is included in your path (like ~/bin/ (just you) or /usr/bin/ (system wide)). Now the relevant Perl modules can be installed. Open a Perl shell:
perl -MCPAN -e shell
...and then install the relevant module.
install Bio::DB::Sam
If all goes well, the module should compile nicely. If you tried to compile the module before you may have to clean out the build directory first. (q to quit the Perl shell).

1 comment:

Jared Decker said...

I tried all day to get samtools installed. I am looking forward to giving this a try tomorrow!!!