Skip to content

Install macs2

Tao Liu (τν) edited this page May 4, 2015 · 32 revisions

MACS2 can be found at PyPI website https://pypi.python.org/pypi/MACS2/ (more stable release) or at GitHub https://github.com/taoliu/MACS/ (developmental version)

Table of Contents

Typical Installation Instructions

Platform

A *nix system including Linux, Mac OSX and other *nix variants

Requirements

  • Python 2.7 (Note that Python 2.7.4 has a bug which causes error while reading compressed BAM file'. Fix it according to this report in MACS user group. This bug has been fixed in Python 2.7.5 which was released on 5/12/2013.')
  • Numpy, and Scipy (I recommend you install your own through rpm for Redhat variants or dpkg for Debian variant linux, or install from source code. Although if you are lucky, you can let pip to fix the dependancies. Check the next section.)
  • GCC compiler. As for Mac OSX users, it means you have to install Xcode then select 'install command line tools' within Xcode program. As a sidenote, current setup script for MACS2 needs GCC>=4.6 so that the optimization flag '-Ofast' can be accepted. If you have older version of GCC or saw an error complaining 'invalid option argument ‘-Ofast’', please manually download MACS2 source code and modify the 'setup.py' script to replace '-Ofast' with '-O3'.

Easy installation through PyPI

  • Follow this instruction to get pip if it's not available in your system. Note if you have already installed numpy and scipy system-wide, you can use 'virtualenv --system-site-packages' to let your virtual Python environment have access to system-wide numpy and scipy libraries so that you don't need to install them again.
  • Under command line, type
    $ pip install MACS2
    PyPI will install Numpy and Scipy automatically if they are absent.
  • To upgrade, type
    $ pip install -U MACS2
    . It will check currently installed MACS2, compare the version with the one on PyPI repository, download and install new version while necessary.
  • Sometimes, you don't want pip to fix dependencies. For example, you already have a workable Scipy and Numpy, and when 'pip install -U MACS2', pip downloads newest Scipy and Numpy but unable to compile and install them. This will fail the whole installation. You can pass '--no-deps' option to pip and let it skip all dependencies. Type
    $ pip install -U --no-deps MACS2 

Compile from source code

  • Download source code package from MACS2 page on PyPI then follow the instruction in INSTALL file.
  • Type
    $ python setup.py install --prefix=/X/Y
  • Fix environments PATH and PYTHONPATH while necessary.

Install MACS2/anything into your user space

To install MACS2 globally is not always a good option, especially while you don't have permission to write to '/usr/' or /usr/local/', or you find the required Python library, Numpy, is not available in the system. Here are several options. Please use this instruction as a general guidance to install any Linux/Unix software to your own user space for full control.

Manually install anything to your home directory

Normally, Linux/Unix users tend to install software to their home directory where they can fully control, such as '/home/foobar'. To do so with Python setup script, first, you need to setup PYTHONPATH and PATH, type:

$ export PYTHONPATH=$HOME/lib/python2.7/site-packages/:$PYTHONPATH
$ export PATH=$HOME/bin/:$PATH
then, install both Numpy and MACS2 by going to their source code directories:
$ python setup.py install --prefix=$HOME

The virtual environment

As a general recommendation to all people processing their own data on Linux/Unix and wondering how to control bioinformatics tools by themselves, the 'virtualenv' tool will help you. Google 'virtualenv' (https://virtualenv.pypa.io/en/latest/), there is a simple python script you can use, to make a virtual python environment isolated from the one for whole system and fully controlled by yourself. By activating it, your current environmental variables will be changed so that any software, not only python software, will be installed into this isolated environment. No need to ask administrators anymore. So you will have full control of installing, removing, updating tools. You may be able to find some good tutorial on virtualenv on the web.

Clone this wiki locally