Alternative content
It's been a while since I last installed BLAT and when I went to the download directory at UCSC: http://users.soe.ucsc.edu/~kent/src/ I found that the latest blast is now version 35 and that the code to download was: blatSrc35.zip. However, you can also get pre-compiled binaries at: http://hgdownload.cse.ucsc.edu/admin/exe/ and that there was a linux x86_64 executable for my architecture available at: http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/blat/. Though YYMV, BLAT can be a little bit of a tricky beast to get going, so I decided to download the source code and compile that.
I will be compiling this code as 'root' as a system tool in /usr/local/src
, so do not scream at me for that.
First I created an /usr/local/src/blat directory and I copied the blatSrc35.zip file into that.
Next I used
unzip blatSrc35.zip
to unpack the archive. This gives a directory blatSrc now move into that directory.
#cd blatSrc
before you begin read the README file that comes with the source code.
One thing about building blat is that you need to set the MACHTYPE variable so that the BLAT sources know what type of machine you are compiling the software on.
on most *nix machines, typing
echo $MACHTYPE
will return the machine architecture type.
On my CentOS 6 based system this gave:
x86_64-redhat-linux-gnu
However, what BLAT requires is the 'short value' (ie the first part of the MACHTYPE). To correct this, in the bash shell type (change this to the correct MACHTYPE for your system)
MACHTYPE=x86_64
export MACHTYPE
now running the command:
echo $MACHTYPE
should give the correct short form of the MACHTYPE:
x86_64
now create the directory lib/$MACHTYPE in the source tree. ie:
mkdir lib/$MACHTYPE
For my machine, lib/x86_64 already existed, so I did not have to do this, but this is not the case for all architectures.
The BLAT code assumes that you are compiling BLAT as a non-privileged (ie non-root) user. As a result, you must create the directory for the executables to go into:
mkdir ~/bin/$MACHTYPE
If you are installing as a normal user, edit your .bashrc to add the following (change the x86_64 to be your MACHTYPE):
export PATH=~/bin/x86_64::$PATH
For me, though, this was not good enough. I wanted the executables in /usr/local/bin where all my other code goes. As a result I did some hackery...
There is a master make template in the inc
directory called common.mk
and I edited this file with the command:
vi inc/common.mk
I replaced the line
BINDIR=${HOME}/bin/${MACHTYPE}
with
BINDIR=/usr/local/bin
saved and quit (as this is in my path, I do not need to do anything else)
All the preparation is now done and you can create the blat executables by going into the toplevel of the blat source tree (for me it was /usr/local/src/blat/blatSrc
, but change to wherever you unpacked blat into).
Now simply run the command:
make
to compile the code.
Blat installed cleanly and the executables were all neatly placed in /usr/local/bin/x86_64, just like I wanted.
now simply running the command:
blat
on the command line gives me information on blat and sample usage.
Blat is installed and it's installed properly in my system code tree!!!
Comments
Get the code. The best way to do this now for Unix users is via Git following the instructions at: http://genome.ucsc.edu/admin/git.html
Or, fetch the entire source in a single file:
rsync -azvP rsync://hgdownload.soe.ucsc.edu/genome/admin/jksrc.zip ./
or: wget --timestamping http://hgdownload.soe.ucsc.edu/admin/jksrc.zip