MDTools for Python
Classes for the analysis and modification of protein structure and dynamics data.Introduction
What is Python?
For our purposes, Python is an extensible object-oriented scripting language with high-level data structures and a large selection of built-in libraries. For a more complete answer, consult the executive summary from the Python Language Home Page.What is MDTools for Python?
MDTools is a Python module which provides a set of classes useful for the analysis and modification of protein structures. Current capabilities include reading psf files, reading and writing (X-PLOR style) pdb and dcd files, calculating phi-psi angles and other properties for arbitrary selections of residues, and parsing output from NAMD into an easy-to-manipulate data object. MDTools also features online help.Why MDTools?
I wanted a modern interactive/scripting language which could be used to perform some of the simple calcuations and manipulations often necessary when setting up and analyzing molecular dynamics simulations. The closest example was the X-PLOR scripting language, which is a decade old. Although C++ libraries existed, writing compiled code for simple manipulations would be inefficient. Additional inspiration came from Andrew Dalke's pdblang written in Perl.Why Python?
I chose Python because it is a legible, cross-platform, interactive programming language. Unlike TCL, Python has high-level data structures and libraries which would allow everything to be done in Python. Python's object-oriented features also allow a simple and elegant class hierarchy to be used.Documentation
Getting Started
To load the MDTool module, use the command import md.Python 1.3 (Wed Oct 25 1995) [GCC NeXT DevKit-based CPP 3.1] Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import md MDTools 0.62 Exp (1996/05/17) by James Phillips. md.help() for more info.
Help System
As noted in the above startup message, online help is available for all classes and many functions. The main module and classes are documented using Python's__doc__
string system. The help([name])
function provides an extended interface to this system, including help strings for several functions and concepts. The help()
function also works on objects by determining the class of an object and returning the help for that class. Therefore, if you have a molecule mol
, help(mol)
will return the documentation for the Molecule
class.
In order to avoid data duplication data and methods from a superclass are not included in the documentation for a subclass. However, the help()
function preceeds the documentation for a subclass with the documentation for its superclass. Therefore, md.help('Atom')
returns information about the data members x
, y
, and z
even though these are defined in HomoCoord
(see below).
Class Structure
Inheritance is essential to the design of MDTools. The volume of source code is rather evenly distributed among the different levels of the class hierarcy, with the root classes being the most complex in most cases. An understanding of the class structure will aid your use of MDTools because of the common methods many classes inherit.- HomoCoord - homogeneous coordinate (x,y,z,W)
- Vector - magnitude and direction in space (W is 0)
- Coord - position in space (W is 1)
- Atom - atomic properties plus links to residue, segment, and molecule
- AtomGroup - collection of atoms, uses frames, calculates physical averages
- ASel - generated from an AtomGroup by a selection function
- Residue - residue properties plus links to segment and molecule
- ResidueGroup - collection of residues
- RSel - generated from a ResidueGroup by a selection function
- Segment - segment properties plus link to molecule
- SegmentGroup - collection of segments
- Molecule - pdb and psf file handling ability
- Trans - (homogeneous) coordinate transformation
- DCD - dcd file reading ability
- DCDWrite - writing ability (deals with fixed atoms)
- Data - fancy data structure for columns of numbers, does simple calculations, generates plots
- NAMDOutput - reads NAMD output, converts timestep to time
Demo
An introductory demo of the structure and power of MDTools is here.Methods and Functions
A brief outline of the MDTools methods and functions is here. For more current and complete information, consult the online help.Distribution
The MDTools module is in an early beta stage and development has been suspended for several years. For more information, please email jim@ks.uiuc.edu. Two archives are available for download:MDTools for Python is written by James Christopher Phillips of the Theoretical Biophysics Group at the University of Illinois. The group is a National Institutes of Health Resource for Concurrent Biological Computing and is a member of the National Science Foundation Grand Challenge Application Group in Structural Biology. J.C.P. is supported by the United States Department of Energy Computational Science Graduate Fellowship Program. MDTools for Python and related documentation Copyright (c) 1995-96 by University of Illinois Board of Trustees and others. Distribution is encouraged as long as proper credit is given.