Skip to content
Janne H. Korhonen edited this page May 16, 2019 · 9 revisions

Python installation

You can install MOODS from PyPi using pip, or alternatively by compiling it directly from the source package if, for example, you don't have your pip configured or you just want a quick throwaway install.

Install from PyPi

The quickest way to install MOODS is using pip:

Option 1: Install to user directory

Install the module to your local Python library path:

pip install --user MOODS-python

Option 2: Install to user directory

Install the module for all users:

sudo pip install MOODS-python

Testing

Installing the MOODS package from PyPi installs the moods-dna.py script to your Python executable directory. Test it by running:

moods-dna.py --help

(Note that this assumes that the appropriate Python executable directory is in your path. For example, if you install the package with --user, you can do this with

PATH="$PATH:`python -m site --user-base`/bin"

if it doesn't work otherwise.)

Install from Source

Start by downloading and extracting the tar archive as usual:

tar xzvf MOODS-python-[version].tar.gz
cd MOODS-python-[version]/

Next, you'll need to compile the C++ extensions. You'll need a fairly recent C++ compiler, as the C++ parts use C++11 features, so make sure your compiler is new enough (tested on Linux with g++ 5.4.0 and on Max OS X with Clang/Apple LLVM 8.0.0).

Option 1: Compile in place

If you just want to use the MOODS basic functionality without installing the package (e.g. you just want to use the moods_dna.py script for basic analysis), you can compile the extension in place:

python setup.py build_ext --inplace

This builds the MOODS extensions and puts everything necessary under the MOODS/ directory. However, this does not install MOODS to Python library path (see below), so Python will not find the library unless MOODS/ directory is in the script path or you explicitly add it to sys.path. To use the example scripts under scripts/ directory, for instance, you can symlink the library there:

cd scripts/
ln -s ../MOODS/    

You can then test the functionality by running the moods_dna.py script with the example data:

python moods-dna.py -m example-data/matrices/*.{pfm,adm} -s example-data/seq/chr1-5k-55k.fa -p 0.0001
python moods-dna.py --help

Option 2: Install the Python module

For large-scale usage, you'll possibly want to install MOODS to Python library path. It's probably better to do this using pip, but if you really want to do this from the source distribution, you can of course do this.

To install MOODS locally to your own home directory, run:

python setup.py install --user

If you use virtualenv, then you can omit --user as usual.

For global install, assuming you have sudo rights, use:

sudo python setup.py install

Again, test the install by running the moods_dna.py script:

cd scripts/
python moods-dna.py -m example-data/matrices/*.{pfm,adm} -s example-data/seq/chr1-5k-55k.fa -p 0.0001
python moods-dna.py --help