These are rough notes on how to compile Eigensoft 3 on Ubuntu Jaunty.

Update, Eigensoft 4 is available and should compile on more recent versions of Ubuntu:
http://www.hsph.harvard.edu/faculty/alkes-price/software/

Create a location to build the code:

Warning: /tmp is for temporary files, and any files & directories you create there will be remove upon some subsequent reboot.

cd /tmp;
mkdir EIGEN;
cd  EIGEN;

Get the Eigensoft source code:

wget  http://www.hsph.harvard.edu/faculty/alkes-price/files/EIG3.0.tar.gz;
tar xzvf EIG3.0.tar.gz;

Install required dependences:

sudo apt-get install f2c libg2c0 libatlas-base-dev liblapack-dev;

This symbolic link is needed as the Makefile links looks for the static version of the library and not the shared version (correct me if I’m wrong, it’s late at night and I could be mistaken):

sudo ln -s /usr/lib/libg2c.so.0 /usr/lib/libg2c.so;

Build the code:

cd /tmp/EIGEN;
cd src;

Create a backup copy of the Makefile:

cp Makefile  Makefile.org;

Edit the Makefile:

emacs -nw Makefile;

Change this line (line 24):

FF=g77

To read as:

FF=”gfortran -std-legacy”

This is needed as the g77 fortran compiler is not longer included with Ubuntu, but you can use the gfortan compiler instead, but you must run it in legacy mode.

Run make:

make eigenstrat;

This next step is essential, because binaries are included in the bin directory that appear to have been build against a 64-bit kernel and are probably artefact’s left over from when the author was testing his code. Also, running “make clean” does not remove the binaries in the bin directory, but does remove those build in the src directory.

make install;

And that should be it run the example.perl in the EIGENSTRAT directory and you should see output like this:

./example.perl
smartpca.perl -i example.geno  -a example.snp  -b example.ind  -k 2  -o example.pca  -p example.plot  -e example.eval  -l example.log  -m 5  -t 2  -s 6.0
smartpca -p example.pca.par >example.log
ploteig -i example.pca.evec -c 1:2  -p Case:Control  -x  -y  -o example.plot.xtxt
evec2pca.perl 2 example.pca.evec example.ind example.pca
smarteigenstrat.perl  -i example.geno  -a example.snp  -b example.ind  -p example.pca  -k 1  -o example.chisq  -l example.log
smarteigenstrat -p example.chisq.par >example.loggc.perl example.chisq example.chisq.GC

If you run into problems running and compiling the code, the README suggests running the following:

make pcatoy;

And, as per the README, contact your sys admin if it doesn’t work. ;)


20 Responses to “Compiling EIGENSOFT on Ubuntu Januty”  

  1. 1 gioby

    Nice tutorial, I would suggest to use make -B eigenstrat so make will recompile all the dependencies and ignore the old files left by the developer, and make -B pcatoy.

  2. 2 gioby

    By the way, I was able to build everything by using FF=”gfortran” and typing make -B install.
    When I have tried with the -std-legacy flag for the fortran compiler, I have got some errors, saying that my current gfortran version didn’t recognize such a flag.

    Ubuntu 9.04 with gfortran 4.3.3

  3. 3 Mick

    Thanks for the comments and suggestion Gioby. I’m glad you found this helpful. I’ll try and test on my Ubuntu 9.10 box and see if it behave the same (my original posting was on 9.04).

    Mick

  4. 4 Peter

    Well, i tried this as well, but i got no plot… Dont know why?
    Are there special libraries necessary for the plot?
    Thanks in advance
    Peter

  5. 5 Tiger

    Very useful guide, Mick, it was such a relief to see your post and hence get the program running on my laptop. I agree with gioby that FF = “gfortran” works fine but not the other way around.

  6. 6 Mick

    Peter, what version of Ubuntu (or other Linux disto) are you using?

    Recently I upgraded to Ubuntu 9.10 (Karmic) and it doesn’t have the libg2c0 and related libraries. This appears to because it was part of gcc3.x and gcc4 (which Karmic uses) uses gfortran instead. It looks like to use Eigensoft one will have to stick with an older distro, or install the libg2c0 and gcc3 from Ubuntu Jaunty.

    Anyone know if the Eigensoft author plans to move to gcc 4?

  7. 7 ross lazarus

    > anyone know if the Eigensoft author plans to move to gcc 4?

    I doubt that there are any plans – it’s legacy code – once published, not much pressure to maintain it. One of the many joys of pressure to publish vs benefits to your academic career of the hard yards of maintenance (which is usually zero). I’m a Galaxy developer for the record :)

    For doing ancestry PCA, there’s an interesting if quirky alternative called shellfish at http://www.stats.ox.ac.uk/~davison/software/shellfish/shellfish.php
    The error message at the end of that page is an ominous sign…but that seems to be what they’re using at the Welcome trust?

    At least it seems a little more up-to-date than eigensoft3 and the author does respond to email…

  8. 8 Peter

    Awesome tutorial, Mick!

  9. 9 Mick

    Cool! Thanks Peter. :)

  10. 10 Emily

    Thank you Mick for your helpful tutorial.
    I keep running into the same issue however, a segmentation fault when I try to “make eigenstrat” or “make pcatoy”

    The error is:
    collect2: ld terminated with signal 11 [Segmentation fault]
    /usr/bin/ld: i386:x86-64 architecture of input file `eigenstrat.o’ is incompatible with i386 output

    My naive understanding is that this is due to incompatibilities with a 64 bit OS.
    Do you have any suggestions?

    Thank you again.

  11. 11 Mick

    Try running “make clean”.

  12. 12 Emily

    Thank you so much! You have prevented my smashing an otherwise valuable computer.

  13. 13 Mick

    Hi Emily,

    I think what happened it that the zip file comes with precompiled binaries for 64-bit Linux. U have to run “make clean” to remove, then recompile.

    Cheers
    Mick

  14. 14 Ashvin

    I am using a windows 7 64 bit machine an also running linux ubuntu 10.04. I want to run EIGENSTRAT on it but when i type make pcatoy it gives me error could not find -lg2c. I tried installing it from debian but still not working. What should i do?

  15. 15 Mick

    @Ashiv are you installing on Windows 7, Ubuntu, or Debian?

    If your on Ubuntu 10.04, it’s probably not going to work, see my previous comment:
    http://timony.com/mickzblog/2009/07/08/compiling-eigensoft-on-ubuntu-januty/#comment-5606

    I may test it at some point in the future.

  16. 16 Brian

    Thanks for post, though not identical this helped me on OS X

    for those trying to compile this on Max OS 10.6, I found this helpful, but needed to do the following instead:

    download the gfortran package (for right os/xcode version) here:
    http://r.research.att.com/tools/
    in my case gfortran 4.2.4

    then in the makefile I had to change
    FF=gfortran -std=legacy (slightly different than here)

    AND change all the linker refs from g2c to gfortran (wherever it says -lg2c in the makefile change it to -lgfortran)

    then
    make clean (or make clobber) to remove old garbage
    make eigenstrat
    make install

    that seemed to work for me

  17. 17 Edmond

    Awesome guide , but can you explain how can I do this without an active internet connection ? I have a messed up speed of 64KB/S … thx in advance

  18. 18 Mick

    @Edmund: That might be tough. I can give you some pointers. What OS and which version are you using?

  19. 19 bli

    @Brian: thank you for your instructions for mac OSX: they helped me installing Eigensoft on Ubuntu 10.04 !

    The trick consisting in changing FF to FF=gfortran -std=legacy and changing -lg2c to -lgfortran allowed me to compile the programs (I also had to install gfortran: sudo apt-get install gfortran)

  20. 20 Mick

    If you want to compile Enigensoft you should try using Eigensoft 4, which is available at:

    http://www.hsph.harvard.edu/faculty/alkes-price/software/

    At some point I’ll see if I can do a write up about how to compile it.

Leave a Reply



Dark Sky Over KenmoreSunset over the Charles riverMisty day in BostonSunset over Donegal Bay.Er ...Bye bye Ireland

Recently Played Tunes

  • Rufus Wainwright Rufus Wainwright
    13 May 2012
    12:24 am

  • Sting Sting
    13 May 2012
    12:13 am

  • Sasha & John Digweed Sasha & John Digweed
    28 Apr 2012
    7:46 pm

Google Search

Google

Categories