Compiling Jody Hey’s Multilocus HKA on OSX

No Comments
Posted 09 Mar 2009 in molecular evolution, OSX hacks, population genomics

The Hudson, Kreitman, Aguade (HKA) test is one of the most widely used tools for testing the neutral theory of molecular evolution, combining information from both polymorphism and divergence among closely related species. The HKA test classically was applied to two loci, but can be extended to multiple loci as well, using software such as Jody Hey‘s Multilocus HKA program.

Unfortunately the source code for this software has a couple of Windows-specific features that make it difficult to compile on OS X. To get it compile on OS X (and linux) our sysadmin Nick Gresham has developed the following solution:

1) change the following .h and .c filenames in the source code distribution to lowercase:

$ mv HKAEXP.C hkaexp.c
$ mv HKAFUNCS.H hkafuncs.h
$ mv HKADIST.C hkadist.c
$ mv HKAEXTRN.H hkaextrn.h
$ mv HKAPRAM1.C hkapram1.c
$ mv HKA.C hka.c
$ mv HKASIMB.C hkasimb.c
$ mv HKAFILE.C hkafile.c
$ mv SETS192.H sets192.h
$ mv HKAPREP.H hkaprep.h

2) change line 44 of hkafile.c to the following:

double gamma(double x);

3) create a Makefile with the following commands and make.

CC = gcc
CFLAGS = -O2
ALL_CFLAGS = -I. $(CFLAGS)
LDFLAGS = -lm

all: hka

hka: hkadist.o hkaexp.o hkafile.o hkapram1.o hkasimb.o hka.o

.c.o:

$(CC) $(ALL_CFLAGS) -c $< -o $@

clean:

-rm *.o *~ core hka

Notes: This solution works on a 2.4 Ghz Intel Core 2 Duo Macbook running Mac OS 10.5.6 using i686-apple-darwin9-gcc-4.0.1. Tabs in the makefile have been faked using the indentation function in the wordpress editor.


Add Your Comment