Skip to content

Commit

Permalink
Merge pull request #48 from danielparton/master
Browse files Browse the repository at this point in the history
1.0.5 release
  • Loading branch information
danielparton committed Aug 24, 2015
2 parents e64168f + e0042f2 commit 73352ac
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/cli_docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The ``ensembler`` tool is operated via a number of subcommands, which should be
ensembler cluster
ensembler refine_implicit
ensembler solvate
ensembler refine_implicit
ensembler refine_explicit
ensembler package_models

Furthermore, the ``ensembler quickmodel`` subcommand allows the entire modeling
Expand Down
2 changes: 1 addition & 1 deletion docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Example using the quickmodel function

::

$ ensembler quickmodel --target_uniprot_entry_name EGFR_HUMAN --uniprot_domain_regex '^Protein kinase' --template_pdbids 4KB8,4AF3 --no-loopmodel
$ ensembler quickmodel --target_uniprot_entry_name EGFR_HUMAN --uniprot_domain_regex '^Protein kinase' --template_pdbids 1M14,4AF3 --no-loopmodel

Models human EGFR onto two templates selected via PDB IDs. The ``quickmodel`` function executes the entire modeling pipeline in one go, and is designed to work with only a few targets and templates. For generating larger numbers of models (such as entire protein families), the main pipeline functions should be used.

Expand Down
3 changes: 3 additions & 0 deletions ensembler/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ def __init__(self, manual_overrides_filepath=None):
else:
manual_overrides_yaml = {}

if type(manual_overrides_yaml) is not dict:
manual_overrides_yaml = {}

self.target = TargetManualOverrides(manual_overrides_yaml)
self.template = TemplateManualOverrides(manual_overrides_yaml)
self.refinement = RefinementManualOverrides(manual_overrides_yaml)
Expand Down
15 changes: 7 additions & 8 deletions ensembler/refinement.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def refine_implicit_md(
if (sim_length / timestep) < nsteps_per_iteration:
nsteps_per_iteration = int(sim_length / timestep)

niterations = int((sim_length / timestep) / nsteps_per_iteration)

models_dir = os.path.abspath(ensembler.core.default_project_dirnames.models)

targets, templates_resolved_seq = ensembler.core.get_targets_and_templates()
Expand All @@ -85,8 +87,6 @@ def refine_implicit_md(
kB = unit.MOLAR_GAS_CONSTANT_R
kT = kB * temperature

niterations = int((sim_length / timestep) / nsteps_per_iteration)

def simulate_implicit_md():

logger.debug("Reading model...")
Expand Down Expand Up @@ -719,10 +719,10 @@ def refine_explicit_md(
rigidWater = True, # rigid water
removeCMMotion = False, # remove center-of-mass motion
sim_length=100.0 * unit.picoseconds,
timestep=2.0 * unit.femtoseconds, # timestep
temperature=300.0 * unit.kelvin, # simulation temperature
pressure=1.0 * unit.atmospheres, # simulation pressure
collision_rate=20.0 / unit.picoseconds, # Langevin collision rate
timestep=2.0 * unit.femtoseconds, # timestep
temperature=300.0 * unit.kelvin, # simulation temperature
pressure=1.0 * unit.atmospheres, # simulation pressure
collision_rate=20.0 / unit.picoseconds, # Langevin collision rate
barostat_period=50,
minimization_tolerance=10.0 * unit.kilojoules_per_mole / unit.nanometer,
minimization_steps=20,
Expand All @@ -744,6 +744,7 @@ def refine_explicit_md(
if (sim_length / timestep) < nsteps_per_iteration:
nsteps_per_iteration = int(sim_length / timestep)

niterations = int((sim_length / timestep) / nsteps_per_iteration)

if process_only_these_templates:
selected_template_indices = [i for i, seq in enumerate(templates_resolved_seq) if seq.id in process_only_these_templates]
Expand All @@ -764,8 +765,6 @@ def refine_explicit_md(
kB = unit.MOLAR_GAS_CONSTANT_R
kT = kB * temperature

niterations = int((sim_length / timestep) / nsteps_per_iteration)

def solvate_pdb(pdb, target_nwaters, water_model=water_model):
"""
Solvate the contents of a PDB file, ensuring it has exactly 'target_nwaters' waters.
Expand Down
32 changes: 32 additions & 0 deletions ensembler/tests/test_tools.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,46 @@
import os
from ensembler.tools.inspect import LoopmodelLogs
from ensembler.tools.mktraj import MkTrajImplicitStart
from ensembler.tools.quick_model import QuickModel
from ensembler.core import default_project_dirnames
from simtk import unit
from ensembler.utils import enter_temp_dir
from ensembler.tests.integrationtest_utils import integrationtest_context
from nose.plugins.attrib import attr


@attr('unit')
def test_loopmodel_logs():
with integrationtest_context(set_up_project_stage='templates_modeled_loops'):
loopmodel_logs = LoopmodelLogs()
loopmodel_logs.add_missing_resis_data()


@attr('unit')
def test_mktraj_implicit_start():
with integrationtest_context(set_up_project_stage='refined_explicit'):
MkTrajImplicitStart(targetid='EGFR_HUMAN_D0', loglevel='debug')


@attr('network')
@attr('slow')
def test_quick_model():
uniprot_entry_name = 'EGFR_HUMAN'
uniprot_domain_regex = '^Protein kinase'
pdbids = ['4AF3']
chainids = {
'4AF3': ['A']
}
with enter_temp_dir():
QuickModel(
target_uniprot_entry_name=uniprot_entry_name,
uniprot_domain_regex=uniprot_domain_regex,
pdbids=pdbids,
chainids=chainids,
loopmodel=False,
sim_length=2.0*unit.femtoseconds,
)
assert os.path.exists(os.path.join(
default_project_dirnames.models,
'EGFR_HUMAN_D0', 'AURKB_HUMAN_D0_4AF3_A', 'explicit-refined.pdb.gz'
))
17 changes: 12 additions & 5 deletions ensembler/tools/quick_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
import ensembler.modeling
import ensembler.refinement
import ensembler.packaging
from ensembler.core import get_templates_resolved_seq
from simtk import unit


class QuickModel(object):
def __init__(self, targetid=None, templateids=None, target_uniprot_entry_name=None,
uniprot_domain_regex=None, pdbids=None, chainids=None, template_uniprot_query=None,
template_seqid_cutoff=None, loopmodel=True, package_for_fah=False, nfahclones=None,
structure_dirs=None, sim_length=100*unit.picoseconds):
structure_dirs=None, sim_length=100*unit.picoseconds
):
"""
Run this after having set up targets and templates with the appropriate ensembler commands.
Expand Down Expand Up @@ -53,14 +55,19 @@ def __init__(self, targetid=None, templateids=None, target_uniprot_entry_name=No

if not self.targetid:
if not self.target_uniprot_entry_name or not self.uniprot_domain_regex:
raise Exception('If no targetid is passed, must specify target_uniprot_entry_name and uniprot_domain_regex.')
raise Exception(
'If no targetid is passed, must specify target_uniprot_entry_name and '
'uniprot_domain_regex.'
)
uniprot_query_string = 'mnemonic:%s' % self.target_uniprot_entry_name
gather_targets_obj = ensembler.initproject.GatherTargetsFromUniProt(uniprot_query_string, uniprot_domain_regex=self.uniprot_domain_regex)
gather_targets_obj = ensembler.initproject.GatherTargetsFromUniProt(
uniprot_query_string, uniprot_domain_regex=self.uniprot_domain_regex
)
self.targetid = gather_targets_obj.targets[0].id

existing_templates = False
if os.path.exists(os.path.join(ensembler.core.default_project_dirnames.templates, 'templates-resolved-seq.fa')):
all_templates_resolved_seq, all_templates_full_seq = ensembler.core.get_templates()
all_templates_resolved_seq = get_templates_resolved_seq()
if len(all_templates_resolved_seq) > 0:
existing_templates = True

Expand All @@ -69,7 +76,7 @@ def __init__(self, targetid=None, templateids=None, target_uniprot_entry_name=No
raise Exception('No existing templates found.')
elif self.pdbids:
ensembler.initproject.gather_templates_from_pdb(self.pdbids, self.uniprot_domain_regex, chainids=self.chainids, structure_dirs=self.structure_dirs)
templates_resolved_seq, templates_full_seq = ensembler.core.get_templates()
templates_resolved_seq = get_templates_resolved_seq()
self.templateids = [t.id for t in templates_resolved_seq]
elif self.template_uniprot_query:
ensembler.initproject.gather_templates_from_uniprot(self.template_uniprot_query, self.uniprot_domain_regex, structure_dirs=self.structure_dirs)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from setuptools import setup

##########################
VERSION = "1.0.4"
ISRELEASED = False
VERSION = "1.0.5"
ISRELEASED = True
__version__ = VERSION
##########################

Expand Down

0 comments on commit 73352ac

Please sign in to comment.