diff --git a/CHANGELOG b/CHANGELOG index 9c9ba86de73c69b98b8e46e93abced278a4a3f8a..b50334fa756a8c72a1005cf265e55e83c92f4ed9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -19,5 +19,6 @@ Changes in Release 0.2 Changes in Release 0.3 (to be released) ------------------------------------------------------------------------------- * merged argcheck into the helper module + * rawmodel renamed to modelling and including high-level modelling functions .. LocalWords: Changelog reStructuredText changelog txt diff --git a/CMakeLists.txt b/CMakeLists.txt index f27f785ad39750a293650c4fd3756513882cbcff..36e9b1a4dba4ded53351822a37f79793773b272e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,7 +103,7 @@ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ## e.g. add_subdirectory(src), subdirs have their own CMakeLists.txt add_subdirectory(config) add_subdirectory(core) -add_subdirectory(rawmodel) +add_subdirectory(modelling) add_subdirectory(sidechain) add_subdirectory(loop) add_subdirectory(pipeline) diff --git a/actions/doc/index_dev.rst b/actions/doc/index_dev.rst index d392fe26c5cdeeb53cf9c59a4f41102ffbad345f..d88a707502036ca6c2bec6cac0fedc3c43997b3e 100644 --- a/actions/doc/index_dev.rst +++ b/actions/doc/index_dev.rst @@ -363,4 +363,4 @@ Unit Test Actions API .. LocalWords: userlevel RunExitStatusTest testExit ost testutils RunTests .. LocalWords: stdout stderr testcode nobytecode testsetup actiontest os .. LocalWords: getcwd pardir builtin testoutput NORMALIZE WHITESPACE API -.. LocalWords: rawmodel autoclass +.. LocalWords: autoclass diff --git a/actions/pm-build-rawmodel b/actions/pm-build-rawmodel index 464dd16478609c0e6c0c9308a0d7af66597fadb5..a6d8f2c1a923c068c24992c4b06ef350018b5289 100755 --- a/actions/pm-build-rawmodel +++ b/actions/pm-build-rawmodel @@ -1,6 +1,6 @@ import os, argparse from ost import io -from promod3 import rawmodel +from promod3 import modelling from promod3.core import helper ### CHANGELOG - START @@ -67,7 +67,7 @@ aln = io.LoadAlignment(opts.alignment_file) # how can we do multi-whatever things? aln.AttachView(1, tpl.CreateFullView()) -result = rawmodel.BuildRawModel(aln) +result = modelling.BuildRawModel(aln) io.SavePDB(result.model, opts.model_file) if not os.path.isfile(opts.model_file): helper.MsgErrorAndExit("Failed to write model file '%s'." % opts.model_file, 5) diff --git a/doc/contributing.rst b/doc/contributing.rst index 451b6f71d6bafd0a13e82b3c60326996f0e00fff..d47ca142290efe00b4d684007be96134e5c6c7ef 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -517,7 +517,7 @@ top level :file:`CMakeLists.txt`: ## e.g. add_subdirectory(src), subdirs have their own CMakeLists.txt add_subdirectory(config) add_subdirectory(core) - add_subdirectory(rawmodel) + add_subdirectory(modelling) add_subdirectory(sidechains) add_subdirectory(loop) add_subdirectory(scripts) @@ -830,7 +830,7 @@ contributions to web pages using |project|. .. LocalWords: unittest TestCase nameattr testcode staticmethod builtin cp .. LocalWords: SomethingTests testFileExistsFalse testutils RunTests DQMEAN .. LocalWords: pre API inline CMake hh ProMod Bienchen OST OPENSTRUCTURE os -.. LocalWords: mol alg conop QMEAN KIC eigen eigenvectors Lapack rawmodel +.. LocalWords: mol alg conop QMEAN KIC eigen eigenvectors Lapack .. LocalWords: OpenStructure ost pylint chmod sys pyc dont bytecode args .. LocalWords: AwesomeActionTests ActionTestCase kwargs testExit getcwd .. LocalWords: RunExitStatusTest DoAwesomeActionTests pardir mainattr alot diff --git a/doc/developers.rst b/doc/developers.rst index dff318493e4df8f418a3531be599552144cdf76f..c467ed1e1c2106b5608a2bda54c884355a394c30 100644 --- a/doc/developers.rst +++ b/doc/developers.rst @@ -13,7 +13,7 @@ Contents: core/setcompoundschemlib core/index pipeline/index - rawmodel/index + modelling/index loop/index sidechain/index actions/index_dev diff --git a/doc/gettingstarted.rst b/doc/gettingstarted.rst index 070ac0fe7077a82739beed73c7701da5b0c8e80a..696d3827d343aadf28d13eae1f96e50d40994ceb 100644 --- a/doc/gettingstarted.rst +++ b/doc/gettingstarted.rst @@ -41,7 +41,7 @@ Modelling pipeline Commonly, your input is a template structure and an alignment of the template to the desired target sequence. The modelling steps then are: -- Build a raw model from the template (see :func:`~promod3.rawmodel.BuildRawModel` function) +- Build a raw model from the template (see :func:`~promod3.modelling.BuildRawModel` function) - Perform loop modelling to close all gaps (see :mod:`~promod3.loop` module) - Reconstruct sidechains (see :mod:`~promod3.sidechain` module) - Minimize energy of final model using molecular mechanics diff --git a/loop/pymod/__init__.py b/loop/pymod/__init__.py index c95bece03c32f396312f582bb41090a8395dc441..afe579e83590151f262e2038e0f19760271cb54b 100644 --- a/loop/pymod/__init__.py +++ b/loop/pymod/__init__.py @@ -5,21 +5,21 @@ from _loop import * # not the best style, but as long as we only have a single function in # __init__.py lets ignore this flaw... if there are more general functions # coming up, start sth like a 'base.py' and import here properly -def SetupBackboneScorer(raw_model): +def SetupBackboneScorer(mhandle): '''Get a scorer for medling with backbones. This one is already tailored towards a certain modelling job. - :param raw_model: The raw model this scorer should be dedicated to. - :type raw_model: :class:`~promod3.rawmodel.ModellingHandle` + :param mhandle: The modelling handle this scorer should be dedicated to. + :type mhandle: :class:`~promod3.modelling.ModellingHandle` :return: A scorer instance. :rtype: :class:`~promod3.loop.BackboneLoopScorer` ''' scorer = LoadBackboneLoopScorer() seqres = list() - for s in raw_model.seqres: + for s in mhandle.seqres: seqres.append(s.GetString()) scorer.Initialize(seqres) - scorer.SetEnvironment(raw_model.model) + scorer.SetEnvironment(mhandle.model) return scorer diff --git a/loop/pymod/export_monte_carlo.cc b/loop/pymod/export_monte_carlo.cc index 2938c72095c75678507638f763ac625b190fac1c..ce4a3f239af7cd1418b588169850f3d77a61a9a4 100644 --- a/loop/pymod/export_monte_carlo.cc +++ b/loop/pymod/export_monte_carlo.cc @@ -8,7 +8,6 @@ #include <promod3/loop/monte_carlo_scorer.hh> #include <promod3/loop/monte_carlo_sampler.hh> #include <promod3/loop/monte_carlo_closer.hh> -#include <promod3/rawmodel/gap.hh> using namespace promod3; using namespace promod3::loop; diff --git a/loop/src/CMakeLists.txt b/loop/src/CMakeLists.txt index ce925776db40a329053cc7a8476e2d25c764bc31..eb2d6980cc17ca01139ec2890a713b91924a21d5 100644 --- a/loop/src/CMakeLists.txt +++ b/loop/src/CMakeLists.txt @@ -47,5 +47,5 @@ backbone_relaxer.cc ) module(NAME loop HEADERS ${LOOP_HEADERS} SOURCES ${LOOP_SOURCES} DEPENDS_ON - promod3_core promod3_rawmodel promod3_sidechain LINK ${OST_LIBRARIES} ${BOOST_LIBRARIES} ${LAPACK_LIBRARIES}) + promod3_core promod3_modelling promod3_sidechain LINK ${OST_LIBRARIES} ${BOOST_LIBRARIES} ${LAPACK_LIBRARIES}) diff --git a/loop/src/backbone_loop_score.hh b/loop/src/backbone_loop_score.hh index 56ce6db25540478cece62c657dfd7d6d8c985e25..af6a4dc615862fd04a0dfdb22c39bee1eebca255 100644 --- a/loop/src/backbone_loop_score.hh +++ b/loop/src/backbone_loop_score.hh @@ -6,7 +6,7 @@ #include <ost/geom/vecmat3_op.hh> #include <ost/mol/view_op.hh> #include <promod3/loop/backbone.hh> -#include <promod3/rawmodel/gap.hh> +#include <promod3/modelling/gap.hh> #include <promod3/loop/dynamic_spatial_organizer.hh> #include <boost/shared_ptr.hpp> diff --git a/loop/src/loop_candidate.hh b/loop/src/loop_candidate.hh index da784743c6db685626e1472e05764862fdbcf940..273ede5e4c871703be4748d61ac288937f4c716f 100644 --- a/loop/src/loop_candidate.hh +++ b/loop/src/loop_candidate.hh @@ -3,7 +3,7 @@ #include <promod3/loop/backbone.hh> #include <promod3/loop/frag_db.hh> -#include <promod3/rawmodel/gap.hh> +#include <promod3/modelling/gap.hh> #include <promod3/loop/monte_carlo.hh> #include <promod3/loop/flame.hh> #include <promod3/loop/backbone_loop_score.hh> diff --git a/loop/src/monte_carlo_sampler.hh b/loop/src/monte_carlo_sampler.hh index dcfa4754b93571ceb22fe371122c8f2bf69ad223..196f3dc150ad32a2030c92be1646116842772149 100644 --- a/loop/src/monte_carlo_sampler.hh +++ b/loop/src/monte_carlo_sampler.hh @@ -11,7 +11,7 @@ #include <ost/mol/residue_handle.hh> #include <ost/mol/atom_handle.hh> -#include <promod3/rawmodel/gap.hh> +#include <promod3/modelling/gap.hh> #include <promod3/loop/backbone.hh> #include <promod3/loop/torsion_sampler.hh> #include <promod3/core/message.hh> diff --git a/loop/src/monte_carlo_scorer.hh b/loop/src/monte_carlo_scorer.hh index f46e1ae448886134a8e34ae16524815d077eee9f..0785fe3e379a96c799f06288567a0f2918a8cece 100644 --- a/loop/src/monte_carlo_scorer.hh +++ b/loop/src/monte_carlo_scorer.hh @@ -6,7 +6,7 @@ #include <ost/mol/mol.hh> -#include <promod3/rawmodel/gap.hh> +#include <promod3/modelling/gap.hh> #include <promod3/loop/backbone_loop_score.hh> diff --git a/rawmodel/CMakeLists.txt b/modelling/CMakeLists.txt similarity index 100% rename from rawmodel/CMakeLists.txt rename to modelling/CMakeLists.txt diff --git a/modelling/doc/CMakeLists.txt b/modelling/doc/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..082558a145d3b78516c4146f8f7d29b6296825a8 --- /dev/null +++ b/modelling/doc/CMakeLists.txt @@ -0,0 +1,5 @@ +set(MODELLING_RST +index.rst +) + +add_doc_source(NAME modelling RST ${MODELLING_RST}) diff --git a/rawmodel/doc/index.rst b/modelling/doc/index.rst similarity index 94% rename from rawmodel/doc/index.rst rename to modelling/doc/index.rst index b36f700adecd7c3c7b588e66a53a7be6ac5e22b9..390a66d7e02c2b27924119c6dbc3e4f62d259d64 100644 --- a/rawmodel/doc/index.rst +++ b/modelling/doc/index.rst @@ -1,10 +1,10 @@ -:mod:`~promod3.rawmodel` - Protein Modelling +:mod:`~promod3.modelling` - Protein Modelling ================================================================================ -.. module:: promod3.rawmodel +.. module:: promod3.modelling :synopsis: Protein Modelling -.. currentmodule:: promod3.rawmodel +.. currentmodule:: promod3.modelling High-level functionality for protein modelling. Commonly, your input is a template structure and an alignment of the template to @@ -48,32 +48,32 @@ Modelling API The returned :class:`ModellingHandle` stores the obtained raw model as well as information about insertions and deletions in the gaps list. - .. testcode:: rawmodel + .. testcode:: modelling :hide: import os import tempfile from ost import io - from promod3 import rawmodel + from promod3 import modelling - aln = io.LoadAlignment('../tests/rawmodel/data/raw-modeling/seq.fasta') - template_structure = io.LoadPDB('../tests/rawmodel/data/raw-modeling/gly.pdb', + aln = io.LoadAlignment('../tests/modelling/data/seq.fasta') + template_structure = io.LoadPDB('../tests/modelling/data/gly.pdb', restrict_chains='A') aln.AttachView(1, template_structure.Select('peptide=true')) - result = rawmodel.BuildRawModel(aln) + result = modelling.BuildRawModel(aln) (fh, fn) = tempfile.mkstemp(suffix='.pdb') io.SavePDB(result.model, fn) os.remove(fn) - .. doctest:: rawmodel + .. doctest:: modelling from ost import io - from promod3 import rawmodel + from promod3 import modelling aln = io.LoadAlignment('seq.fasta') template_structure = io.LoadPDB('gly.pdb', restrict_chains='A') aln.AttachView(1, template_structure.Select('peptide=true')) - result = rawmodel.BuildRawModel(aln) + result = modelling.BuildRawModel(aln) io.SavePDB(result.model, 'model.pdb') :param alignment: Single alignment handle for raw model. @@ -135,7 +135,7 @@ Modelling Handle class .. class:: ModellingHandle Handles the result for structure model building and provides high-level methods - to turn an initial raw model (see :func:`~promod3.rawmodel.BuildRawModel`) + to turn an initial raw model (see :func:`~promod3.modelling.BuildRawModel`) into a complete protein model by removing any existing gaps. .. attribute:: model @@ -336,7 +336,7 @@ False if no new extension possible. :rtype: :class:`bool` .. LocalWords: currentmodule promod aln AttachView BuildRawModel pdb calpha -.. LocalWords: ModellingHandle StructuralGapList rawmodel Modelling os ost +.. LocalWords: ModellingHandle StructuralGapList modelling Modelling os ost .. LocalWords: testcode tempfile io LoadAlignment LoadPDB fh fn doctest API .. LocalWords: modelling phosphoserine param exc RuntimeError automethod .. LocalWords: CloseSmallDeletions diff --git a/modelling/pymod/CMakeLists.txt b/modelling/pymod/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c8e12608ed7d9727474d4495f5b458108a4d007 --- /dev/null +++ b/modelling/pymod/CMakeLists.txt @@ -0,0 +1,16 @@ +set(MODELLING_CPP +wrap_modelling.cc +export_model.cc +export_gap.cc +export_gap_extender.cc +) + +set(MODELLING_PYMOD + __init__.py + _closegaps.py +) + +pymod(NAME modelling + CPP ${MODELLING_CPP} + PY ${MODELLING_PYMOD} + DEPENDS_ON core_pymod) diff --git a/modelling/pymod/__init__.py b/modelling/pymod/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f71871e700309441916cfa62a9df3ed5a7adc878 --- /dev/null +++ b/modelling/pymod/__init__.py @@ -0,0 +1,5 @@ +""" +Initialise the modelling module. +""" +from _modelling import * +from _closegaps import * diff --git a/rawmodel/pymod/_closegaps.py b/modelling/pymod/_closegaps.py similarity index 92% rename from rawmodel/pymod/_closegaps.py rename to modelling/pymod/_closegaps.py index 6792787e65fc88a6c898d9b0d5e3781b4c1d4129..f32d39f994c07330306d063881693e0451457f7e 100644 --- a/rawmodel/pymod/_closegaps.py +++ b/modelling/pymod/_closegaps.py @@ -5,7 +5,7 @@ as argument. import ost #pylint: disable=no-name-in-module -from . import _rawmodel as rawmodel +from . import _modelling as modelling from promod3 import loop def CloseSmallDeletions(mhandle, scorer, extension_steps=9, clash_thresh=1.0, @@ -23,31 +23,31 @@ def CloseSmallDeletions(mhandle, scorer, extension_steps=9, clash_thresh=1.0, .. testcode:: closesmalldel :hide: - from promod3 import rawmodel + from promod3 import modelling from promod3 import loop - tpl = ost.io.LoadPDB('../tests/rawmodel/data/raw-modeling/gly.pdb') + tpl = ost.io.LoadPDB('../tests/modelling/data/gly.pdb') aln = ost.seq.CreateAlignment(ost.seq.CreateSequence('trg', 'GGG-GGG'), ost.seq.CreateSequence('tpl', 'GGGAGGG')) aln.AttachView(1, tpl.CreateFullView()) - mhandle = rawmodel.BuildRawModel(aln) + mhandle = modelling.BuildRawModel(aln) assert len(mhandle.gaps) == 1 scorer = loop.SetupBackboneScorer(mhandle) - rawmodel.CloseSmallDeletions(mhandle, scorer) + modelling.CloseSmallDeletions(mhandle, scorer) assert len(mhandle.gaps) == 0 .. doctest:: closesmalldel import ost - from promod3 import rawmodel + from promod3 import modelling from promod3 import loop tpl = ost.io.LoadPDB('gly.pdb') aln = ost.io.LoadAlignment('seq.fasta') aln.AttachView(1, tpl.CreateFullView()) - mhandle = rawmodel.BuildRawModel(aln) + mhandle = modelling.BuildRawModel(aln) scorer = loop.SetupBackboneScorer(mhandle) - rawmodel.CloseSmallDeletions(mhandle, scorer) + modelling.CloseSmallDeletions(mhandle, scorer) :param mhandle: Modelling handle on which to apply change. :type mhandle: :class:`ModellingHandle` @@ -96,7 +96,7 @@ def CloseSmallDeletions(mhandle, scorer, extension_steps=9, clash_thresh=1.0, # the gap, we get the backbone to be stretched. If no more extension # is possible, break out. On first successful relaxation for an # extension, we successfully stop. - extender = rawmodel.GapExtender(current_gap) + extender = modelling.GapExtender(current_gap) for _ in range(extension_steps): if not extender.Extend(): break @@ -141,7 +141,7 @@ def CloseSmallDeletions(mhandle, scorer, extension_steps=9, clash_thresh=1.0, scorer.SetEnvironment(\ bb_list, current_gap.before.GetNumber().GetNum()) - rawmodel.ClearGaps(mhandle, current_gap) + modelling.ClearGaps(mhandle, current_gap) success = True break @@ -164,29 +164,29 @@ def MergeGapsByDistance(mhandle, distance): .. testcode:: mergegapsbydist :hide: - from promod3 import rawmodel + from promod3 import modelling - tpl = ost.io.LoadPDB('../tests/rawmodel/data/raw-modeling/1mcg.pdb') + tpl = ost.io.LoadPDB('../tests/modelling/data/1mcg.pdb') aln = ost.seq.CreateAlignment(ost.seq.CreateSequence('trg', 'DDFAGDTKNLGHN'), ost.seq.CreateSequence('tpl', 'NN----A----LF')) aln.AttachView(1, tpl.CreateFullView()) - mhandle = rawmodel.BuildRawModel(aln) + mhandle = modelling.BuildRawModel(aln) assert len(mhandle.gaps) == 2 - rawmodel.MergeGapsByDistance(mhandle, 0) + modelling.MergeGapsByDistance(mhandle, 0) assert len(mhandle.gaps) == 1 .. doctest:: mergegapsbydist import ost - from promod3 import rawmodel + from promod3 import modelling tpl = ost.io.LoadPDB('1mcg.pdb') aln = ost.io.LoadAlignment('1mcg_aln.fasta') aln.AttachView(1, tpl.CreateFullView()) - mhandle = rawmodel.BuildRawModel(aln) - rawmodel.MergeGapsByDistance(mhandle, 0) + mhandle = modelling.BuildRawModel(aln) + modelling.MergeGapsByDistance(mhandle, 0) :param mhandle: Modelling handle on which to apply change. :type mhandle: :class:`ModellingHandle` @@ -223,7 +223,7 @@ def MergeGapsByDistance(mhandle, distance): - current_gap.after.GetNumber().GetNum() if dist <= distance: # gaps are close enough, combine! combine! - rawmodel.MergeGaps(mhandle, i) + modelling.MergeGaps(mhandle, i) ost.LogVerbose("Merged gap %s and %s into %s" % \ (current_gap, next_gap, mhandle.gaps[i])) try_again = True @@ -241,36 +241,36 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db, .. testcode:: fillloopsbydb :hide: - from promod3 import rawmodel + from promod3 import modelling from promod3 import loop - tpl = ost.io.LoadPDB('../tests/rawmodel/data/raw-modeling/2dbs.pdb') + tpl = ost.io.LoadPDB('../tests/modelling/data/2dbs.pdb') aln = ost.seq.CreateAlignment( ost.seq.CreateSequence('trg', 'TLNGFTVPAGNTLV--LNPDKGATVTMA'), ost.seq.CreateSequence('tpl', 'NGGTLLIPNGTYHFLGIQMKSNVHIRVE')) aln.AttachView(1, tpl.CreateFullView()) - mhandle = rawmodel.BuildRawModel(aln) + mhandle = modelling.BuildRawModel(aln) assert len(mhandle.gaps) == 1 scorer = loop.SetupBackboneScorer(mhandle) - rawmodel.FillLoopsByDatabase(mhandle, scorer, loop.LoadFragDB(), + modelling.FillLoopsByDatabase(mhandle, scorer, loop.LoadFragDB(), loop.LoadStructureDB(), loop.LoadTorsionSamplerCoil()) assert len(mhandle.gaps) == 0 .. doctest:: fillloopsbydb - from promod3 import rawmodel + from promod3 import modelling from promod3 import loop tpl = io.LoadPDB('2dbs.pdb') aln = ost.io.LoadAlignment('2dbs.fasta') aln.AttachView(1, tpl.CreateFullView()) - mhandle = rawmodel.BuildRawModel(aln) + mhandle = modelling.BuildRawModel(aln) scorer = loop.SetupBackboneScorer(mhandle) - scorer = rawmodel.FillLoopsByDatabase(mhandle, scorer, loop.LoadFragDB(), + scorer = modelling.FillLoopsByDatabase(mhandle, scorer, loop.LoadFragDB(), loop.LoadStructureDB(), loop.LoadTorsionSamplerCoil()) @@ -355,7 +355,7 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db, # get info on current gap actual_gap = mhandle.gaps[gap_idx].Copy() actual_length = actual_gap.length - actual_extender = rawmodel.GapExtender(actual_gap) + actual_extender = modelling.GapExtender(actual_gap) min_before_resnum = 100000000000 max_after_resnum = -100000000000 actual_candidates = list() @@ -481,7 +481,7 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db, actual_chain_idx) ost.LogVerbose("Resolved %s by filling %s" % \ (str(actual_gap), str(actual_extended_gaps[idx_a]))) - next_gap = rawmodel.ClearGaps(mhandle, actual_extended_gaps[idx_a]) + next_gap = modelling.ClearGaps(mhandle, actual_extended_gaps[idx_a]) if next_gap == -1: break else: @@ -491,11 +491,12 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db, gap_idx += 1 return scorer -__all__ = ['CloseSmallDeletions', 'MergeGapsByDistance', - 'FillLoopsByDatabase'] +# these methods will be exported into module +__all__ = ('CloseSmallDeletions', 'MergeGapsByDistance', + 'FillLoopsByDatabase',) # LocalWords: modeling stereochemically param idx init -# LocalWords: py ost pylint rawmodel promod CloseSmallDeletions testcode +# LocalWords: py ost pylint modelling promod CloseSmallDeletions testcode # LocalWords: fillloopsbydb tpl aln trg TLNGFTVPAGNTLV LNPDKGATVTMA mhandle # LocalWords: NGGTLLIPNGTYHFLGIQMKSNVHIRVE AttachView CreateFullView len # LocalWords: BuildRawModel SetupBackboneScorer FillLoopsByDatabase doctest diff --git a/rawmodel/pymod/export_gap.cc b/modelling/pymod/export_gap.cc similarity index 90% rename from rawmodel/pymod/export_gap.cc rename to modelling/pymod/export_gap.cc index 27192da45454ebfe32df110bf01a2c0a721d78fd..71df386bb20358c183d20ab9abb458cf55513e89 100644 --- a/rawmodel/pymod/export_gap.cc +++ b/modelling/pymod/export_gap.cc @@ -1,13 +1,13 @@ #include <boost/python.hpp> #include <boost/python/suite/indexing/vector_indexing_suite.hpp> -#include <promod3/rawmodel/gap.hh> +#include <promod3/modelling/gap.hh> using namespace ost; using namespace boost::python; -using namespace promod3::rawmodel; +using namespace promod3::modelling; namespace{ - promod3::rawmodel::StructuralGap WrapGetItem(promod3::rawmodel::StructuralGapList& l, int i){ + promod3::modelling::StructuralGap WrapGetItem(promod3::modelling::StructuralGapList& l, int i){ return l.at(i); } } diff --git a/rawmodel/pymod/export_gap_extender.cc b/modelling/pymod/export_gap_extender.cc similarity index 91% rename from rawmodel/pymod/export_gap_extender.cc rename to modelling/pymod/export_gap_extender.cc index 3f9e144855653b199d52d9525f8f3be6325e05b7..ee56ba8a16655e7aee2713b65278da4d26881b33 100644 --- a/rawmodel/pymod/export_gap_extender.cc +++ b/modelling/pymod/export_gap_extender.cc @@ -1,9 +1,9 @@ #include <boost/python.hpp> -#include <promod3/rawmodel/gap_extender.hh> +#include <promod3/modelling/gap_extender.hh> using namespace ost; using namespace boost::python; -using namespace promod3::rawmodel; +using namespace promod3::modelling; namespace{ diff --git a/rawmodel/pymod/export_model.cc b/modelling/pymod/export_model.cc similarity index 95% rename from rawmodel/pymod/export_model.cc rename to modelling/pymod/export_model.cc index 7cce177126a55d556e016bc0f19d319fc9db5be3..daee7499f5248690edcddba9f2de8cb5d7d0b891 100644 --- a/rawmodel/pymod/export_model.cc +++ b/modelling/pymod/export_model.cc @@ -1,9 +1,9 @@ #include <boost/python.hpp> #include <boost/python/suite/indexing/vector_indexing_suite.hpp> -#include <promod3/rawmodel/model.hh> +#include <promod3/modelling/model.hh> using namespace boost::python; -using namespace promod3::rawmodel; +using namespace promod3::modelling; ModellingHandle (*BuildRawModelHandle)(const ost::seq::AlignmentHandle&, bool, diff --git a/rawmodel/pymod/wrap_rawmodel.cc b/modelling/pymod/wrap_modelling.cc similarity index 83% rename from rawmodel/pymod/wrap_rawmodel.cc rename to modelling/pymod/wrap_modelling.cc index b2d88e81fdb24d53f213e2731b34a71fab6c9612..ebfa07bac5ae64264b2f6bea21ae5935785ca287 100644 --- a/rawmodel/pymod/wrap_rawmodel.cc +++ b/modelling/pymod/wrap_modelling.cc @@ -4,7 +4,7 @@ void export_gap(); void export_model(); void export_gap_extender(); -BOOST_PYTHON_MODULE(_rawmodel) +BOOST_PYTHON_MODULE(_modelling) { export_gap(); export_model(); diff --git a/rawmodel/src/CMakeLists.txt b/modelling/src/CMakeLists.txt similarity index 54% rename from rawmodel/src/CMakeLists.txt rename to modelling/src/CMakeLists.txt index a1f8628239f0ceca6f24796358dd154698bc9a96..6abdad56537bfcab6eb1477c642eb78a9bd6e9a1 100644 --- a/rawmodel/src/CMakeLists.txt +++ b/modelling/src/CMakeLists.txt @@ -1,17 +1,17 @@ -set(RAWMODEL_SOURCES +set(MODELLING_SOURCES gap.cc gap_extender.cc model.cc ) -set(RAWMODEL_HEADERS +set(MODELLING_HEADERS gap.hh gap_extender.hh model.hh ) -module(NAME rawmodel - HEADERS ${RAWMODEL_HEADERS} - SOURCES ${RAWMODEL_SOURCES} +module(NAME modelling + HEADERS ${MODELLING_HEADERS} + SOURCES ${MODELLING_SOURCES} DEPENDS_ON promod3_core LINK ${OST_LIBRARIES} ${BOOST_LIBRARIES}) diff --git a/rawmodel/src/gap.cc b/modelling/src/gap.cc similarity index 98% rename from rawmodel/src/gap.cc rename to modelling/src/gap.cc index af3d103d3f860f8bf85479ab0280b084231648f7..5a7016eefe9a1cb91cefda6ee6371bc0a6b50050 100644 --- a/rawmodel/src/gap.cc +++ b/modelling/src/gap.cc @@ -5,7 +5,7 @@ using namespace ost::mol; using namespace ost; -namespace promod3 { namespace rawmodel { +namespace promod3 { namespace modelling { String StructuralGap::GetChainName() const { diff --git a/rawmodel/src/gap.hh b/modelling/src/gap.hh similarity index 97% rename from rawmodel/src/gap.hh rename to modelling/src/gap.hh index 86f852366b1b98e97dc4e0569b46a5767fdb0c33..3c506a8ccba7662e4d8ada90505ff7ffe64cdf2c 100644 --- a/rawmodel/src/gap.hh +++ b/modelling/src/gap.hh @@ -1,10 +1,10 @@ -#ifndef PM3_RAWMODEL_GAP_HH -#define PM3_RAWMODEL_GAP_HH +#ifndef PM3_MODELLING_GAP_HH +#define PM3_MODELLING_GAP_HH #include <ost/mol/mol.hh> #include <promod3/core/message.hh> -namespace promod3 { namespace rawmodel { +namespace promod3 { namespace modelling { /// Describes a structural gap, i.e. a loop to be modeled. The gap may either be /// terminal or between two defined regions. The gap stores information of the diff --git a/rawmodel/src/gap_extender.cc b/modelling/src/gap_extender.cc similarity index 93% rename from rawmodel/src/gap_extender.cc rename to modelling/src/gap_extender.cc index acd1cef3e9f8191d8fe306f65ec04f579ffe601f..601f585f9969f44e597f9e4c2e1c22be7b715a93 100644 --- a/rawmodel/src/gap_extender.cc +++ b/modelling/src/gap_extender.cc @@ -1,19 +1,19 @@ -#include <promod3/rawmodel/gap_extender.hh> +#include <promod3/modelling/gap_extender.hh> using namespace ost::mol; using namespace ost; namespace{ - bool CompareScoredElements(const std::pair<promod3::rawmodel::StructuralGap,Real>& a, - const std::pair<promod3::rawmodel::StructuralGap,Real>& b){ + bool CompareScoredElements(const std::pair<promod3::modelling::StructuralGap,Real>& a, + const std::pair<promod3::modelling::StructuralGap,Real>& b){ return a.second < b.second; } } -namespace promod3{ namespace rawmodel{ +namespace promod3{ namespace modelling{ bool GapExtender::Extend() { diff --git a/rawmodel/src/gap_extender.hh b/modelling/src/gap_extender.hh similarity index 88% rename from rawmodel/src/gap_extender.hh rename to modelling/src/gap_extender.hh index c8656355f6e6b0de408fd01444a106667843cc63..82d1bf6b40a383c164ebe77eb7e181533a48c8f2 100644 --- a/rawmodel/src/gap_extender.hh +++ b/modelling/src/gap_extender.hh @@ -1,13 +1,13 @@ -#ifndef PM3_RAWMODEL_GAP_EXTENDER_HH -#define PM3_RAWMODEL_GAP_EXTENDER_HH +#ifndef PM3_MODELLING_GAP_EXTENDER_HH +#define PM3_MODELLING_GAP_EXTENDER_HH #include <ost/mol/mol.hh> #include <promod3/core/message.hh> -#include <promod3/rawmodel/gap.hh> +#include <promod3/modelling/gap.hh> #include <ost/mol/mol.hh> #include <algorithm> -namespace promod3 { namespace rawmodel { +namespace promod3 { namespace modelling { class GapExtender; class ScoringGapExtender; diff --git a/rawmodel/src/model.cc b/modelling/src/model.cc similarity index 99% rename from rawmodel/src/model.cc rename to modelling/src/model.cc index 6c6729bced09a00a0f58266be42999857a37769e..12379bca1fe86eab8d55f35ec36cdfc27f021051 100644 --- a/rawmodel/src/model.cc +++ b/modelling/src/model.cc @@ -17,7 +17,7 @@ using namespace ost; using namespace ost::seq; using namespace ost::conop; -namespace promod3 { namespace rawmodel { +namespace promod3 { namespace modelling { namespace { diff --git a/rawmodel/src/model.hh b/modelling/src/model.hh similarity index 98% rename from rawmodel/src/model.hh rename to modelling/src/model.hh index fa42133843b77b8abd557a5cac70a77f051915a1..f6fe2908cbb04cd4997b89de3429fc88e6d76517 100644 --- a/rawmodel/src/model.hh +++ b/modelling/src/model.hh @@ -1,5 +1,5 @@ -#ifndef PM3_MODEL_HH -#define PM3_MODEL_HH +#ifndef PM3_MODELLING_MODEL_HH +#define PM3_MODELLING_MODEL_HH #include <ost/seq/alignment_handle.hh> #include <ost/seq/sequence_list.hh> @@ -8,7 +8,7 @@ #include "gap.hh" -namespace promod3 { namespace rawmodel { +namespace promod3 { namespace modelling { struct ModellingHandle { diff --git a/modelling/tests/CMakeLists.txt b/modelling/tests/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..f879c0510e58546c11a1d733f49061fe4c0699e9 --- /dev/null +++ b/modelling/tests/CMakeLists.txt @@ -0,0 +1,25 @@ +set(MODELLING_UNIT_TESTS + test_modelling.py + test_gap_extension.py + test_close_gaps.py +) + +set(MODELLING_TEST_DATA + data/ext.pdb + data/compounds.chemlib + data/gly.pdb + data/ter.fasta + data/sep.pdb + data/sep.fasta + data/seq.fasta + data/ins.fasta + data/del.fasta + data/cbeta.pdb + data/cbeta.fasta + data/1mcg.pdb + data/2dbs.pdb +) + +promod3_unittest(MODULE modelling + SOURCES "${MODELLING_UNIT_TESTS}" + DATA "${MODELLING_TEST_DATA}") diff --git a/rawmodel/tests/data/raw-modeling/1mcg.pdb b/modelling/tests/data/1mcg.pdb similarity index 100% rename from rawmodel/tests/data/raw-modeling/1mcg.pdb rename to modelling/tests/data/1mcg.pdb diff --git a/rawmodel/tests/data/raw-modeling/2dbs.pdb b/modelling/tests/data/2dbs.pdb similarity index 100% rename from rawmodel/tests/data/raw-modeling/2dbs.pdb rename to modelling/tests/data/2dbs.pdb diff --git a/rawmodel/tests/data/raw-modeling/cbeta.fasta b/modelling/tests/data/cbeta.fasta similarity index 100% rename from rawmodel/tests/data/raw-modeling/cbeta.fasta rename to modelling/tests/data/cbeta.fasta diff --git a/rawmodel/tests/data/raw-modeling/cbeta.pdb b/modelling/tests/data/cbeta.pdb similarity index 100% rename from rawmodel/tests/data/raw-modeling/cbeta.pdb rename to modelling/tests/data/cbeta.pdb diff --git a/rawmodel/tests/data/raw-modeling/compounds.chemlib b/modelling/tests/data/compounds.chemlib similarity index 100% rename from rawmodel/tests/data/raw-modeling/compounds.chemlib rename to modelling/tests/data/compounds.chemlib diff --git a/rawmodel/tests/data/raw-modeling/del.fasta b/modelling/tests/data/del.fasta similarity index 100% rename from rawmodel/tests/data/raw-modeling/del.fasta rename to modelling/tests/data/del.fasta diff --git a/rawmodel/tests/data/loop/ext.pdb b/modelling/tests/data/ext.pdb similarity index 100% rename from rawmodel/tests/data/loop/ext.pdb rename to modelling/tests/data/ext.pdb diff --git a/rawmodel/tests/data/raw-modeling/gly.pdb b/modelling/tests/data/gly.pdb similarity index 100% rename from rawmodel/tests/data/raw-modeling/gly.pdb rename to modelling/tests/data/gly.pdb diff --git a/rawmodel/tests/data/raw-modeling/ins.fasta b/modelling/tests/data/ins.fasta similarity index 100% rename from rawmodel/tests/data/raw-modeling/ins.fasta rename to modelling/tests/data/ins.fasta diff --git a/rawmodel/tests/data/raw-modeling/sep.fasta b/modelling/tests/data/sep.fasta similarity index 100% rename from rawmodel/tests/data/raw-modeling/sep.fasta rename to modelling/tests/data/sep.fasta diff --git a/rawmodel/tests/data/raw-modeling/sep.pdb b/modelling/tests/data/sep.pdb similarity index 100% rename from rawmodel/tests/data/raw-modeling/sep.pdb rename to modelling/tests/data/sep.pdb diff --git a/rawmodel/tests/data/raw-modeling/seq.fasta b/modelling/tests/data/seq.fasta similarity index 100% rename from rawmodel/tests/data/raw-modeling/seq.fasta rename to modelling/tests/data/seq.fasta diff --git a/rawmodel/tests/data/raw-modeling/ter.fasta b/modelling/tests/data/ter.fasta similarity index 100% rename from rawmodel/tests/data/raw-modeling/ter.fasta rename to modelling/tests/data/ter.fasta diff --git a/rawmodel/tests/test_close_gaps.py b/modelling/tests/test_close_gaps.py similarity index 83% rename from rawmodel/tests/test_close_gaps.py rename to modelling/tests/test_close_gaps.py index c4b0155f7a11f607d57b27703530e997d647c225..d833591eec6be2d75261311ed70f5c0fcb2ce94d 100644 --- a/rawmodel/tests/test_close_gaps.py +++ b/modelling/tests/test_close_gaps.py @@ -1,7 +1,7 @@ import unittest import ost from ost import io, seq -from promod3 import rawmodel +from promod3 import modelling from promod3 import loop # setting up an OST LogSink to capture messages @@ -25,18 +25,18 @@ class CloseGapsTests(unittest.TestCase): def testClosesmalldel(self): # check that very small gaps are closed - # create a rawmodel to work with (which actually is a bit dangerous: + # create a raw model to work with (which actually is a bit dangerous: # the PDB file has nothing to do with the alignment...) - tpl = io.LoadPDB('data/raw-modeling/gly.pdb') + tpl = io.LoadPDB('data/gly.pdb') # switch target and template in this alignment to get a deletion aln = seq.CreateAlignment(seq.CreateSequence('trg', 'GGG-GGG'), seq.CreateSequence('tpl', 'GGGAGGG')) aln.AttachView(1, tpl.CreateFullView()) - rmodel = rawmodel.BuildRawModel(aln) + rmodel = modelling.BuildRawModel(aln) self.assertEqual(len(rmodel.gaps), 1) # obtain the scorer scorer = loop.SetupBackboneScorer(rmodel) - rawmodel.CloseSmallDeletions(rmodel, scorer) + modelling.CloseSmallDeletions(rmodel, scorer) self.assertEqual(len(rmodel.gaps), 0) self.assertEqual(self.log.messages['VERBOSE'], ['Assigning MOL_IDs', @@ -47,15 +47,15 @@ class CloseGapsTests(unittest.TestCase): def testMergeGapsByDistance(self): # test that merging two close gaps works - tpl = io.LoadPDB('data/raw-modeling/1mcg.pdb') + tpl = io.LoadPDB('data/1mcg.pdb') aln = seq.CreateAlignment(seq.CreateSequence('trg', 'DDFAGDTKNLGHN'), seq.CreateSequence('tpl', 'NN----A----LF')) aln.AttachView(1, tpl.CreateFullView()) - rmodel = rawmodel.BuildRawModel(aln) + rmodel = modelling.BuildRawModel(aln) self.assertEqual(len(rmodel.gaps), 2) self.assertEqual(str(rmodel.gaps[0]), 'A.ASP2-(FAGD)-A.THR7') self.assertEqual(str(rmodel.gaps[1]), 'A.THR7-(KNLG)-A.HIS12') - rawmodel.MergeGapsByDistance(rmodel,0) + modelling.MergeGapsByDistance(rmodel,0) self.assertEqual(len(rmodel.gaps), 1) self.assertEqual(str(rmodel.gaps[0]), 'A.ASP2-(FAGDTKNLG)-A.HIS12') self.assertEqual(self.log.messages['VERBOSE'], @@ -68,38 +68,38 @@ class CloseGapsTests(unittest.TestCase): def testMergeGapsByDistanceBothTerminals(self): # test that we do not delete the whole thing for gaps at terminals - tpl = io.LoadPDB('data/raw-modeling/1mcg.pdb') + tpl = io.LoadPDB('data/1mcg.pdb') aln = seq.CreateAlignment(seq.CreateSequence('trg', 'DDFAGDTKNLGHN'), seq.CreateSequence('tpl', '----NNALF----')) aln.AttachView(1, tpl.CreateFullView()) - rmodel = rawmodel.BuildRawModel(aln) + rmodel = modelling.BuildRawModel(aln) self.assertEqual(len(rmodel.gaps), 2) - rawmodel.MergeGapsByDistance(rmodel,4) + modelling.MergeGapsByDistance(rmodel,4) self.assertEqual(len(rmodel.gaps), 2) def testMergeGapsByDistanceOneTerminal(self): # test that we do not delete the whole thing for gaps at terminals - tpl = io.LoadPDB('data/raw-modeling/1mcg.pdb') + tpl = io.LoadPDB('data/1mcg.pdb') aln = seq.CreateAlignment(seq.CreateSequence('trg', 'DDFAGDTKNLGHN'), seq.CreateSequence('tpl', 'NN----ALF----')) aln.AttachView(1, tpl.CreateFullView()) - rmodel = rawmodel.BuildRawModel(aln) + rmodel = modelling.BuildRawModel(aln) self.assertEqual(len(rmodel.gaps), 2) - rawmodel.MergeGapsByDistance(rmodel,2) + modelling.MergeGapsByDistance(rmodel,2) self.assertEqual(len(rmodel.gaps), 1) def testFillGapsByDatabase(self): # get rid of gaps by db - tpl = io.LoadPDB('data/raw-modeling/2dbs.pdb') + tpl = io.LoadPDB('data/2dbs.pdb') aln = seq.CreateAlignment( seq.CreateSequence('trg', 'TLNGFTVPAGNTLV--LNPDKGATVTMA'), seq.CreateSequence('tpl', 'NGGTLLIPNGTYHFLGIQMKSNVHIRVE')) aln.AttachView(1, tpl.CreateFullView()) - rmodel = rawmodel.BuildRawModel(aln) + rmodel = modelling.BuildRawModel(aln) self.assertEqual(len(rmodel.gaps), 1) scorer = loop.SetupBackboneScorer(rmodel) - rawmodel.FillLoopsByDatabase(rmodel, scorer, loop.LoadFragDB(), + modelling.FillLoopsByDatabase(rmodel, scorer, loop.LoadFragDB(), loop.LoadStructureDB(), loop.LoadTorsionSamplerCoil()) self.assertEqual(len(rmodel.gaps), 0) diff --git a/rawmodel/tests/test_gap_extension.py b/modelling/tests/test_gap_extension.py similarity index 87% rename from rawmodel/tests/test_gap_extension.py rename to modelling/tests/test_gap_extension.py index fecd7c3f02924f0269d6bda9cb4fc39aafca1ccc..046446d309b6534f25118cb59bf0b94625bcf4a9 100644 --- a/rawmodel/tests/test_gap_extension.py +++ b/modelling/tests/test_gap_extension.py @@ -1,15 +1,15 @@ import unittest -from promod3 import rawmodel +from promod3 import modelling from ost import io class GapExtension(unittest.TestCase): def testGapExtender(self): - ent = io.LoadPDB('data/loop/ext.pdb') + ent = io.LoadPDB('data/ext.pdb') chain = ent.chains[0] - gap = rawmodel.StructuralGap(chain.FindResidue(9), + gap = modelling.StructuralGap(chain.FindResidue(9), chain.FindResidue(11), 'X') - ext = rawmodel.GapExtender(gap) + ext = modelling.GapExtender(gap) self.assertEqual(str(gap), 'A.PRO9-(X)-A.TRP11') self.assertTrue(ext.Extend()) self.assertEqual(str(gap), 'A.THR8-(PX)-A.TRP11') diff --git a/rawmodel/tests/test_raw_modeling.py b/modelling/tests/test_modelling.py similarity index 73% rename from rawmodel/tests/test_raw_modeling.py rename to modelling/tests/test_modelling.py index 3be952b799cefdecc34138c9e1a794406812216c..69c79bf9e46cc9d5c9c90b922290df261295214c 100644 --- a/rawmodel/tests/test_raw_modeling.py +++ b/modelling/tests/test_modelling.py @@ -1,14 +1,14 @@ """ -Unit tests for rawmodel. +Unit tests for modelling. """ import unittest -from promod3 import rawmodel +from promod3 import modelling from ost import conop, seq, io, mol -class RawModelingTests(unittest.TestCase): +class ModellingTests(unittest.TestCase): def setUp(self): compound_lib = conop.CompoundLib.Load( - 'data/raw-modeling/compounds.chemlib') + 'data/compounds.chemlib') conop.SetDefaultLib(compound_lib) io.profiles['DEFAULT'].processor = conop.RuleBasedProcessor( compound_lib) @@ -17,23 +17,23 @@ class RawModelingTests(unittest.TestCase): # test that BuildRawModel throws exception when no view is attached aln = seq.CreateAlignment(seq.CreateSequence('A', 'acdef'), seq.CreateSequence('B', 'ac-ef')) - self.assertRaises(RuntimeError, rawmodel.BuildRawModel, aln) + self.assertRaises(RuntimeError, modelling.BuildRawModel, aln) def testModeledSequence(self): # test if the model has the sequence we want. - tpl = io.LoadPDB('data/raw-modeling/gly.pdb') - aln = io.LoadAlignment('data/raw-modeling/seq.fasta') + tpl = io.LoadPDB('data/gly.pdb') + aln = io.LoadAlignment('data/seq.fasta') aln.AttachView(1, tpl.CreateFullView()) - result = rawmodel.BuildRawModel(aln) + result = modelling.BuildRawModel(aln) seq1 = seq.SequenceFromChain('MODEL', result.model.chains[0]) self.assertEqual(seq1.string, aln.sequences[0].string) def testDeletion(self): # test if the result contains a "deletion" gap at the right spot. - tpl = io.LoadPDB('data/raw-modeling/gly.pdb') - aln = io.LoadAlignment('data/raw-modeling/del.fasta') + tpl = io.LoadPDB('data/gly.pdb') + aln = io.LoadAlignment('data/del.fasta') aln.AttachView(1, tpl.CreateFullView()) - result = rawmodel.BuildRawModel(aln) + result = modelling.BuildRawModel(aln) residues = result.model.residues self.assertEqual(len(result.gaps), 1) self.assertEqual(result.gaps[0].before, residues[2]) @@ -42,10 +42,10 @@ class RawModelingTests(unittest.TestCase): def testInsertion(self): # test if the result contains an "insertion" gap at the right spot. - tpl = io.LoadPDB('data/raw-modeling/gly.pdb') - aln = io.LoadAlignment('data/raw-modeling/ins.fasta') + tpl = io.LoadPDB('data/gly.pdb') + aln = io.LoadAlignment('data/ins.fasta') aln.AttachView(1, tpl.CreateFullView()) - result = rawmodel.BuildRawModel(aln) + result = modelling.BuildRawModel(aln) residues = result.model.residues self.assertEqual(len(result.gaps), 1) self.assertEqual(result.gaps[0].before, residues[1]) @@ -55,10 +55,10 @@ class RawModelingTests(unittest.TestCase): def testTer(self): # test if the result contains two terminal gaps, one at the beginning, # one at the end - tpl = io.LoadPDB('data/raw-modeling/gly.pdb') - aln = io.LoadAlignment('data/raw-modeling/ter.fasta') + tpl = io.LoadPDB('data/gly.pdb') + aln = io.LoadAlignment('data/ter.fasta') aln.AttachView(1, tpl.CreateFullView()) - result = rawmodel.BuildRawModel(aln) + result = modelling.BuildRawModel(aln) residues = result.model.residues self.assertEqual(len(result.gaps), 2) self.assertEqual(result.gaps[0].before, mol.ResidueHandle()) @@ -70,10 +70,10 @@ class RawModelingTests(unittest.TestCase): def testModified(self): # test if we correctly strip off modifications - tpl = io.LoadPDB('data/raw-modeling/sep.pdb') - aln = io.LoadAlignment('data/raw-modeling/sep.fasta') + tpl = io.LoadPDB('data/sep.pdb') + aln = io.LoadAlignment('data/sep.fasta') aln.AttachView(1, tpl.CreateFullView()) - result = rawmodel.BuildRawModel(aln) + result = modelling.BuildRawModel(aln) residues = result.model.residues self.assertEqual(len(residues), 1) self.assertEqual(len(residues[0].atoms), 6) @@ -86,10 +86,10 @@ class RawModelingTests(unittest.TestCase): def testInsertCBeta(self): # test if the dst residues contain cbeta, unless they are glycines - tpl = io.LoadPDB('data/raw-modeling/cbeta.pdb') - aln = io.LoadAlignment('data/raw-modeling/cbeta.fasta') + tpl = io.LoadPDB('data/cbeta.pdb') + aln = io.LoadAlignment('data/cbeta.fasta') aln.AttachView(1, tpl.CreateFullView()) - result = rawmodel.BuildRawModel(aln) + result = modelling.BuildRawModel(aln) residues = result.model.residues self.assertFalse(residues[0].FindAtom("CB").IsValid()) self.assertFalse(residues[1].FindAtom("CB").IsValid()) diff --git a/pipeline/pymod/CMakeLists.txt b/pipeline/pymod/CMakeLists.txt index 5ed2ecba7ad33823149b4d330a6f81dc078dd3d8..2d94a5b1274e45ed41c3ae21f80acffccbc0e25e 100644 --- a/pipeline/pymod/CMakeLists.txt +++ b/pipeline/pymod/CMakeLists.txt @@ -3,4 +3,4 @@ set(PIPELINE_PYMOD run_engine.py ) -pymod(NAME pipeline PY ${PIPELINE_PYMOD} DEPENDS_ON _rawmodel rawmodel_pymod) +pymod(NAME pipeline PY ${PIPELINE_PYMOD} DEPENDS_ON _modelling modelling_pymod) diff --git a/pipeline/pymod/run_engine.py b/pipeline/pymod/run_engine.py index a8e32b86026e85b3822c19aac6989f8f9d441d3b..0acb61b27cc5cfc432da5dcef42d46433b50289d 100644 --- a/pipeline/pymod/run_engine.py +++ b/pipeline/pymod/run_engine.py @@ -4,16 +4,16 @@ import ost from promod3 import loop -from promod3 import rawmodel +from promod3 import modelling -def BuildFromRawModel(raw_model, structure_db=None, fragment_db=None, +def BuildFromRawModel(mhandle, structure_db=None, fragment_db=None, torsion_sampler=None, merge_distance=4): '''Build a model starting with a - :class:`RawModel <promod3.rawmodel.ModellingHandle>`. + :class:`raw model <promod3.modelling.ModellingHandle>`. - :param raw_model: The prepared template coordinates loaded with the input + :param mhandle: The prepared template coordinates loaded with the input alignment. - :type raw_model: :class:`~promod3.rawmodel.ModellingHandle` + :type mhandle: :class:`~promod3.modelling.ModellingHandle` :param structure_db: The structural database. Loads the default one shipped with |project| if omitted. @@ -49,34 +49,34 @@ def BuildFromRawModel(raw_model, structure_db=None, fragment_db=None, if torsion_sampler == None: torsion_sampler = loop.LoadTorsionSamplerCoil() - scorer = loop.SetupBackboneScorer(raw_model) + scorer = loop.SetupBackboneScorer(mhandle) # step 1: close small deletions in the raw model ost.LogVerbose("Trying to close small deletions (no. of gaps: %d)." % \ - len(raw_model.gaps)) - scorer = rawmodel.CloseSmallDeletions(raw_model, scorer) + len(mhandle.gaps)) + scorer = modelling.CloseSmallDeletions(mhandle, scorer) # step 2: simple handling of further gaps: merge, then fill from db for distance in range(merge_distance): # step 2a: Combine gaps living close to each other ost.LogVerbose("Trying to merge gaps (%d) with distance %d." % \ - (len(raw_model.gaps), distance)) - rawmodel.MergeGapsByDistance(raw_model, distance) - ost.LogVerbose("%d gap(s) left after merging.\n" % len(raw_model.gaps)+ + (len(mhandle.gaps), distance)) + modelling.MergeGapsByDistance(mhandle, distance) + ost.LogVerbose("%d gap(s) left after merging.\n" % len(mhandle.gaps)+ "Trying to fill loops by database") # step 2b: fit loops into the model - scorer = rawmodel.FillLoopsByDatabase(raw_model, scorer, fragment_db, + scorer = modelling.FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db, torsion_sampler, max_loops_to_search=30) ost.LogVerbose("%d gap(s) left after database search." % \ - len(raw_model.gaps)) - if len(raw_model.gaps) == 0: + len(mhandle.gaps)) + if len(mhandle.gaps) == 0: break - return raw_model.model + return mhandle.model __all__ = ('BuildProMod3Model') # LocalWords: BuildProMod ProMod sticked ost promod BuildFromRawModel param -# LocalWords: RawModel rtype bool LoadStructureDB LogVerbose LoadFragDB +# LocalWords: rtype bool LoadStructureDB LogVerbose LoadFragDB # LocalWords: LoadTorsionSamplerCoil SetupBackboneScorer # LocalWords: CloseSmallDeletions diff --git a/pipeline/tests/test_run_engine.py b/pipeline/tests/test_run_engine.py index ea131abf5ae11bfbf6009691f3e608677083c248..17b1ada4cd2a6e6dad2fb89af41c5ee1bb01bc8f 100644 --- a/pipeline/tests/test_run_engine.py +++ b/pipeline/tests/test_run_engine.py @@ -3,7 +3,7 @@ import os import ost from promod3 import pipeline -from promod3 import rawmodel +from promod3 import modelling class RunPipelineTests(unittest.TestCase): def testBuildFromRawModel(self): @@ -16,9 +16,9 @@ class RunPipelineTests(unittest.TestCase): template = ost.io.LoadPDB(os.path.join("data", "2l4k_B.pdb.gz")) aln = ost.io.LoadAlignment(os.path.join("data", "2l4k_B_aln.fasta")) aln.AttachView(1, template.Select('peptide=true')) - raw_model = rawmodel.BuildRawModel(aln) + mhandle = modelling.BuildRawModel(aln) # run the pipeline - self.assertTrue(pipeline.run_engine.BuildFromRawModel(raw_model)) + self.assertTrue(pipeline.run_engine.BuildFromRawModel(mhandle)) if __name__ == "__main__": from ost import testutils diff --git a/rawmodel/doc/CMakeLists.txt b/rawmodel/doc/CMakeLists.txt deleted file mode 100644 index 2f43617494857e74012508cf15feea63e28e6abb..0000000000000000000000000000000000000000 --- a/rawmodel/doc/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(RAWMODEL_RST -index.rst -) - -add_doc_source(NAME rawmodel RST ${RAWMODEL_RST}) diff --git a/rawmodel/pymod/CMakeLists.txt b/rawmodel/pymod/CMakeLists.txt deleted file mode 100644 index 00f6f28f89b9cd9fdce393988af7d9461675077f..0000000000000000000000000000000000000000 --- a/rawmodel/pymod/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -set(RAWMODEL_CPP -wrap_rawmodel.cc -export_model.cc -export_gap.cc -export_gap_extender.cc -) - -set(RAWMODEL_PYMOD - __init__.py - _closegaps.py -) - -pymod(NAME rawmodel - CPP ${RAWMODEL_CPP} - PY ${RAWMODEL_PYMOD} - DEPENDS_ON core_pymod) diff --git a/rawmodel/pymod/__init__.py b/rawmodel/pymod/__init__.py deleted file mode 100644 index 78a1f850948f6a3fd1aac61bc49d104a20fa4d4f..0000000000000000000000000000000000000000 --- a/rawmodel/pymod/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -""" -Initialise the rawmodel module. -""" -from _rawmodel import * -from _closegaps import * diff --git a/rawmodel/tests/CMakeLists.txt b/rawmodel/tests/CMakeLists.txt deleted file mode 100644 index d3005b8160b7744c4370ca725683f9e53d90bec1..0000000000000000000000000000000000000000 --- a/rawmodel/tests/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -set(RAWMODEL_UNIT_TESTS - test_raw_modeling.py - test_gap_extension.py - test_close_gaps.py -) - -set(RAWMODEL_TEST_DATA - data/loop/ext.pdb - data/raw-modeling/compounds.chemlib - data/raw-modeling/gly.pdb - data/raw-modeling/ter.fasta - data/raw-modeling/sep.pdb - data/raw-modeling/sep.fasta - data/raw-modeling/seq.fasta - data/raw-modeling/ins.fasta - data/raw-modeling/del.fasta - data/raw-modeling/cbeta.pdb - data/raw-modeling/cbeta.fasta - data/raw-modeling/1mcg.pdb - data/raw-modeling/2dbs.pdb -) - -promod3_unittest(MODULE rawmodel - SOURCES "${RAWMODEL_UNIT_TESTS}" - DATA "${RAWMODEL_TEST_DATA}") diff --git a/sidechain/pymod/_reconstruct_sidechains.py b/sidechain/pymod/_reconstruct_sidechains.py index 33f029cc7317dfcca8bb3d89ec4a710bc910dcea..fabd97e5c0cf37109d824fe7158d62b192b843ad 100644 --- a/sidechain/pymod/_reconstruct_sidechains.py +++ b/sidechain/pymod/_reconstruct_sidechains.py @@ -360,3 +360,5 @@ def Reconstruct(ent, keep_sidechains = False, build_disulfids = True, r.ApplyOnResidue(rh,True) +# these methods will be exported into module +__all__ = ('Reconstruct',)