4. Analysis modules
The MDAnalysis.analysis
module contains code to carry out specific
analysis functionality for MD trajectories.
It is based on the core functionality (i.e. trajectory
I/O, selections etc). The analysis modules can be used as examples for how to
use MDAnalysis but also as working code for research projects; typically all
contributed code has been used by the authors in their own work.
An analysis using the available modules
usually follows the same structure
Import the desired module, since analysis modules are not imported by default.
Initialize the analysis class instance from the previously imported module.
Run the analysis, optionally for specific trajectory slices.
Access the analysis from the
results
attribute
from MDAnalysis.analysis import ExampleAnalysisModule # (e.g. RMSD)
analysis_obj = ExampleAnalysisModule.AnalysisClass(universe, ...)
analysis_obj.run(start=start_frame, stop=stop_frame, step=step)
print(analysis_obj.results)
Please see the individual module documentation for any specific caveats and also read and cite the reference papers associated with these algorithms.
Additional dependencies
Some of the modules in MDAnalysis.analysis
require additional Python
packages to enable full functionality. For example,
MDAnalysis.analysis.encore
provides more options if scikit-learn is
installed. If you installed MDAnalysis with
pip (see Installing MDAnalysis)
these packages are not automatically installed.
Although, one can add the [analysis]
tag to the
pip command to force their installation. If you installed
MDAnalysis with conda then a
full set of dependencies is automatically installed.
Other modules require external programs. For instance, the
MDAnalysis.analysis.hole2.hole
module requires an installation of the
HOLE suite of programs. You will need to install these external dependencies
by following their installation instructions before you can use the
corresponding MDAnalysis module.
4.1. Building blocks for Analysis
The building block for the analysis modules is
MDAnalysis.analysis.base.AnalysisBase
.
To build your own analysis class start by reading the documentation.
4.2. Distances and contacts
- 4.2.1. Coordinate fitting and alignment —
MDAnalysis.analysis.align
- 4.2.2. Native contacts analysis —
MDAnalysis.analysis.contacts
- 4.2.3. Distance analysis —
MDAnalysis.analysis.distances
- 4.2.4. Calculating root mean square quantities —
MDAnalysis.analysis.rms
- 4.2.5. Calculating path similarity —
MDAnalysis.analysis.psa
- 4.2.6. ENCORE Ensemble Similarity Calculations —
MDAnalysis.analysis.encore
- 4.2.7. Bond-Angle-Torsion coordinates analysis —
MDAnalysis.analysis.bat
4.3. Hydrogen bonding
Deprecated modules:
4.4. Membranes and membrane proteins
4.5. Nucleic acids
4.6. Polymers
4.7. Structure
4.7.1. Macromolecules
4.7.2. Liquids
4.8. Volumetric analysis
4.9. Dimensionality Reduction
4.10. Legacy analysis modules
The MDAnalysis.analysis.legacy
module contains code that for a
range of reasons is not as well maintained and tested as the other
analysis modules. Use with care.