From dfd44257f48630d050209967de5bf5bf83be59d0 Mon Sep 17 00:00:00 2001 From: "Daniel L. Parton" Date: Fri, 21 Aug 2015 17:13:07 -0400 Subject: [PATCH 1/4] Minor --- ensembler/refinement.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ensembler/refinement.py b/ensembler/refinement.py index c262a59..2121d48 100644 --- a/ensembler/refinement.py +++ b/ensembler/refinement.py @@ -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() @@ -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...") @@ -714,10 +714,10 @@ def refine_explicit_md( ff='amber99sbildn', water_model='tip3p', 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, @@ -739,6 +739,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] @@ -761,8 +762,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. From 009eee82b75a9d93b2fa38005541823d9da5968e Mon Sep 17 00:00:00 2001 From: "Daniel L. Parton" Date: Mon, 24 Aug 2015 11:33:37 -0400 Subject: [PATCH 2/4] Minor --- docs/cli_docs.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cli_docs.rst b/docs/cli_docs.rst index 8cdc552..5c5ed56 100644 --- a/docs/cli_docs.rst +++ b/docs/cli_docs.rst @@ -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 From 5c3b483d49866d90096d7b9b9a7c2d7875a8c5f3 Mon Sep 17 00:00:00 2001 From: "Daniel L. Parton" Date: Mon, 24 Aug 2015 15:06:04 -0400 Subject: [PATCH 3/4] Fixes for quickmodel and ManualOverrides --- docs/examples.rst | 2 +- ensembler/core.py | 3 +++ ensembler/tests/test_tools.py | 32 ++++++++++++++++++++++++++++++++ ensembler/tools/quick_model.py | 17 ++++++++++++----- 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/docs/examples.rst b/docs/examples.rst index 6959963..1d2bd33 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -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. diff --git a/ensembler/core.py b/ensembler/core.py index 878a8ba..9258342 100644 --- a/ensembler/core.py +++ b/ensembler/core.py @@ -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) diff --git a/ensembler/tests/test_tools.py b/ensembler/tests/test_tools.py index c6d8c01..a2d2d2f 100644 --- a/ensembler/tests/test_tools.py +++ b/ensembler/tests/test_tools.py @@ -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' + )) diff --git a/ensembler/tools/quick_model.py b/ensembler/tools/quick_model.py index 9892380..671783b 100644 --- a/ensembler/tools/quick_model.py +++ b/ensembler/tools/quick_model.py @@ -6,6 +6,7 @@ import ensembler.modeling import ensembler.refinement import ensembler.packaging +from ensembler.core import get_templates_resolved_seq from simtk import unit @@ -13,7 +14,8 @@ 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. @@ -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 @@ -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) From e0042f22d90805eadee8b7cf3530fdc361b6f8e6 Mon Sep 17 00:00:00 2001 From: "Daniel L. Parton" Date: Mon, 24 Aug 2015 15:06:25 -0400 Subject: [PATCH 4/4] 1.0.5 release --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 59baf05..d948e80 100644 --- a/setup.py +++ b/setup.py @@ -3,8 +3,8 @@ from setuptools import setup ########################## -VERSION = "1.0.4" -ISRELEASED = False +VERSION = "1.0.5" +ISRELEASED = True __version__ = VERSION ##########################