Usage

MDT is simply a Python extension module, and as such can be used in combination with other Python modules, such as MODELLER or the Python standard library.

Running pre-built binaries

The easiest way to use MDT is to install the pre-built binary RPM for your variety of Linux (this will first require you to install the Modeller RPM). Then you should simply be able to run an MDT script foo.py just like any regular Python script with a command similar to:

python foo.py

In the Sali lab, MDT is built as part of the nightly build system at the same time as MODELLER. Thus you can set up your system to run MDT scripts by running:

module load modeller

Using with Anaconda Python

There is an MDT package available for Anaconda Python for Mac and Linux. To install it, simply run:

conda install -c salilab mdt

Using a Homebrew package

If you are using a Mac with homebrew you can get MDT by running in a terminal window:

brew tap salilab/salilab; brew install mdt

If you don’t already have Modeller installed, you can get it by running brew install modeller before you install MDT.

Add –with-python3 to the end of each brew install command if you also want to use Python 3.

Compilation from source code

The MDT source code can be downloaded from GitHub.

Install dependent packages needed for MDT: MODELLER, glib, SWIG, pkg-config, and HDF5:

  • MODELLER 9.13 or later is required.
  • glib 2.4 or later is required. It is available as pre-built packages for most modern Linux distributions; there is also a MacPorts package for Mac users.
  • SWIG 1.3.39 or later is required.
  • Unfortunately HDF5 only works if you use the exact same version that is used by MODELLER. See the MODELLER ChangeLog for the version to use.

To compile, run scons in the same directory (and optionally scons test) to build (and test) MDT. This will produce a script bin/mdtpy.sh which can be used to run an MDT Python script foo.py:

bin/mdtpy.sh python foo.py

Note

If you didn’t use the RPM or Debian package to install Modeller then you will need to tell MDT where it can find Modeller. To do this, create a file called config.py, and in it set the modeller Python variable to the directory where you have MODELLER installed (on a Mac, this would look like modeller=”/Library/modeller-XXX” where XXX is the Modeller version).

If you installed any of the prerequisites in non-standard locations (i.e. not /usr/include for glib and HDF5, and not /usr/bin for pkg-config or SWIG) you will also need to tell scons where to find them. Add similar lines to config.py to set path for pkg-config and SWIG and includepath for glib and HDF5 (e.g. path=”/opt/local/bin” and includepath=”/opt/local/include” on a Mac).

If you want to install MDT, run scons install. You can additionally specify a prefix option (or set it in config.py) to install in a different directory. For example, scons prefix=/foo install will install MDT in the /foo directory.

Example MDT script

Generally speaking, to use MDT, you should

  1. Create a Library object.
  2. Read any necessary additional files into the library, such as the definitions of chemical bonds (see Chemical bonds for an example), or atom tuples.
  3. Define one or more features, which are classes in the mdt.features module.
  4. Create one or more Table objects, using a selection of the features you added to the Library, to hold the frequency tables themselves.
  5. Collect statistics into the table using methods such as Table.add_alignment().
  6. Post process (e.g. smoothing, normalizing), plot the data, or write the table to a file.

A simple example, which simply collects the distribution of residue types in a PDB file, is shown below:

import modeller
import mdt
import mdt.features

# Setup of Modeller and MDT system
env = modeller.environ()
mlib = mdt.Library(env)

# Creation of feature types
restyp = mdt.features.ResidueType(mlib)

# Create a 1D table of residue type
table = mdt.Table(mlib, features=restyp)

# Read in a PDB file and make an alignment of just this one structure
mdl = modeller.model(env, file='5fd1')
aln = modeller.alignment(env)
aln.append_model(mdl, align_codes='5fd1', atom_files='5fd1')

# Collect MDT statistics for this alignment
table.add_alignment(aln)

# Print out the MDT by treating it as a Python list
print "Distribution of residue types:"
print [bin for bin in table]

For more applied examples, see Sample studies with MDT.