Commit b7be963a by Robert McGibbon

Add checks for dependencies

parent 842fd016
"""pdbfixer Fixes problems in PDB files
"""pdbfixer: Fixes problems in PDB files
Protein Data Bank (PDB) files often have a number of problems that must be
fixed before they can be used in a molecular dynamics simulation. The details
vary depending on how the file was generated. Here are some of the most common
ones:
- If the structure was generated by X-ray crystallography, most or all of the
- hydrogen atoms will usually be missing.
- There may also be missing heavy atoms in flexible regions that could not be
clearly resolved from the electron density. This may include anything from a
few atoms at the end of a sidechain to entire loops.
- Many PDB files are also missing terminal atoms that should be present at the
ends of chains.
- The file may include nonstandard residues that were added for crystallography
purposes, but are not present in the naturally occurring molecule you want to
simulate.
- The file may include more than what you want to simulate. For example, there
may be salts, ligands, or other molecules that were added for experimental
purposes. Or the crystallographic unit cell may contain multiple copies of a
protein, but you only want to simulate a single copy.
- There may be multiple locations listed for some atoms.
- If you want to simulate the structure in explicit solvent, you will need to
add a water box surrounding it.
PDBFixer can fix all of these problems for you in a fully automated way. You
simply select a file, tell it which problems to fix, and it does everything else.
"""
from __future__ import print_function
import os
import sys
from os.path import relpath, join
from setuptools import setup, find_packages
DOCLINES = __doc__.split("\n")
......@@ -36,6 +62,42 @@ def find_package_data():
return files
def check_dependencies():
from distutils.version import StrictVersion
found_openmm = True
found_openmm_52_or_later = True
found_numpy = True
try:
from simtk import openmm
openmm_version = StrictVersion(openmm.Platform.getOpenMMVersion())
if openmm_version < StrictVersion('5.2'):
found_openmm_52_or_later = False
except ImportError as err:
found_openmm = False
try:
import numpy
except:
found_numpy = False
msg = None
bar = ('-' * 70) + "\n" + ('-' * 70)
if found_openmm:
if not found_openmm_52_or_later:
msg = [bar, '[Unmet Dependency] PDBFixer requires OpenMM version 5.2 or later. You have version %s.' % openmm_version, bar]
else:
msg = [bar, '[Unmet Dependency] PDBFixer requires the OpenMM python package. Refer to <http://openmm.org> for details and installation instructions.', bar]
if not found_numpy:
msg = [bar, '[Unmet Dependency] PDBFixer requires the numpy python package. Refer to <http://www.scipy.org/scipylib/download.html> for numpy installation instructions.', bar]
if msg is not None:
import textwrap
print()
print(os.linesep.join([line for e in msg for line in textwrap.wrap(e)]), file=sys.stderr)
#print('\n'.join(list(textwrap.wrap(e) for e in msg)))
setup(
name='pdbfixer',
author='Peter Eastman',
......@@ -50,4 +112,5 @@ setup(
package_data={'pdbfixer': find_package_data()},
zip_safe=False,
entry_points={'console_scripts': ['pdbfixer = pdbfixer.pdbfixer:main']})
\ No newline at end of file
check_dependencies()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment