Skip to content

Commit

Permalink
Merge pull request #1065 from choderalab/modeller-cleanup
Browse files Browse the repository at this point in the history
Clean up Modeller Feature, Cut 0.23.3
  • Loading branch information
Lnaden authored Aug 10, 2018
2 parents c2a0ee3 + fe858a9 commit 998d289
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 16 deletions.
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ install:
- source devtools/travis-ci/install.sh
- export PYTHONUNBUFFERED=true
# Add org channel
- conda config --add channels omnia --add channels conda-forge --add channels salilab
- conda config --add channels omnia --add channels conda-forge
# Add omnia dev channels
- if [ $DEVOMNIA ]; then conda config --add channels omnia/label/dev; fi
# Update everything
Expand All @@ -34,10 +34,8 @@ script:
- conda create --quiet --yes -n test python=$python
# Activate the test environment
- source activate test
# Install extras for OpenEye and testing
- conda install --yes --quiet pip nose nose-timer coverage
# Install extras for Modeller
- conda install --yes modeller
# Install extras for OpenEye, Modeller and testing
- conda install --yes --quiet pip nose nose-timer coverage modeller
# Install OpenEye toolkit
- pip install $OPENEYE_CHANNEL openeye-toolkits && python -c "import openeye; print(openeye.__version__)"
# Build the recipe
Expand Down
10 changes: 5 additions & 5 deletions Yank/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ def add_missing_atoms(value):
# Write the final structure
PDBFile.writeFile(fixer.topology, fixer.positions, open(output_file_path, 'w'))


def apply_modeller(input_file_path, output_file_path, directives):
"""
Apply Salilab Modeller to make changes to the specified molecule.
Expand All @@ -969,14 +970,13 @@ def apply_modeller(input_file_path, output_file_path, directives):
Dict containing directives for modeller.
"""

try:
import modeller
except ImportError:
if not utils.is_modeller_installed():
raise ImportError('Modeller and license must be installed to use this feature.')
import modeller

directives = copy.deepcopy(directives)

# Silence unecessart output to the log files
# Silence unnecessary output to the log files
modeller.log.none()

# Create modeller environment and point it to the PDB file
Expand All @@ -994,7 +994,6 @@ def apply_modeller(input_file_path, output_file_path, directives):
model_original_numbering = modeller.model(env, file=atom_file_name)
alignment.append_model(model, atom_files=atom_file_name, align_codes=atom_file_name)


def apply_mutations_modeller(value):
# Extract chain id
chain_id = None
Expand Down Expand Up @@ -1033,6 +1032,7 @@ def apply_mutations_modeller(value):
model.res_num_from(model_original_numbering, alignment)
model.write(file=output_file_path)


def read_csv_lines(file_path, lines):
"""Return a list of CSV records.
Expand Down
6 changes: 4 additions & 2 deletions Yank/tests/test_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,8 @@ def test_pdbfixer_mutations():
break
assert has_mut_residue


@unittest.skipIf(not utils.is_modeller_installed(), "This test requires Salilab Modeller")
def test_modeller_mutations():
"""Test that modeller can apply mutations correctly."""
mol_id = 'Abl'
Expand All @@ -1334,8 +1336,8 @@ def test_modeller_mutations():

# Now we set the strip_protons options and repeat
exp_builder._db.molecules[mol_id]['modeller'] = {
'apply_mutations' : {
'chain_id' : 'A',
'apply_mutations': {
'chain_id': 'A',
'mutations': 'T85I',
}
}
Expand Down
21 changes: 21 additions & 0 deletions Yank/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,27 @@ def _compute_net_charge(residue):
return tot_charge


def is_modeller_installed():
"""
Check if a Salilab Modeller tool is installed and Licensed.
If Modeller is not installed and licensed, returns False.
Returns
-------
installed : bool
True if all tools in ``oetools`` are installed and licensed, False otherwise.
"""
try:
import modeller
except:
# This has to be broad because we cant trap the ModellerError invalid license
# since the act of even trying to import Modeller triggers it,
# and its NOT an import error which is raised.
return False
return True


# -----------------
# OpenEye functions
# -----------------
Expand Down
5 changes: 3 additions & 2 deletions docs/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ This section features and improvements of note in each release.
The full release history can be viewed `at the GitHub yank releases page <https://github.com/choderalab/yank/releases>`_.

0.23.3 Adds support for single mutations using Modeller
------------------------------------
- - Adds an optional ``modeller` directive to the ``molecules`` section of the YAML file
-------------------------------------------------------
- Adds an optional ``modeller` directive to the ``molecules`` section of the YAML file
through `Modeller <https://salilab.org/modeller/>`_, a tool for comparative modeling of protein structures.
- The following options are accessible through the ``modeller`` directive. `(docs) <http://getyank.org/latest/yamlpages/molecules.html#modeller>`__

- ``apply_mutations``: Specify protein single mutations (e.g., T315I). `(docs) <http://getyank.org/latest/yamlpages/molecules.html#modeller_mutations>`_


Expand Down
3 changes: 3 additions & 0 deletions docs/yamlpages/molecules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ PDBFixer is applied after ``strip_protons`` if both are requested.
Specifies whether modeller should be used to model in mutations.
Can only be used on proteins, on files with ``.pdb`` file extensions.

This feature requires the Modeller from the Sali Lab, which can be fetched from
Omnia's Conda channel. You will need to provide your own license however.

Mutations
^^^^^^^^^

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

########################
VERSION = "0.23.3" # Primary base version of the build
DEVBUILD = 0 # Dev build status, Either None or Integer
ISRELEASED = False # Are we releasing this as a full cut?
DEVBUILD = None # Dev build status, Either None or Integer
ISRELEASED = True # Are we releasing this as a full cut?
__version__ = VERSION
########################
CLASSIFIERS = """\
Expand Down

0 comments on commit 998d289

Please sign in to comment.