Skip to content
Snippets Groups Projects
Commit b59dcd57 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

make fragment sampling available in default modelling pipeline

parent 2fe0e865
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,7 @@ parser = pm3argparse.PM3ArgumentParser(__doc__, action=True)
parser.AddAlignment()
parser.AddStructure(attach_views=True)
parser.AddProfile()
parser.AddFragments()
parser.AssembleParser()
parser.add_argument('-o', '--model-file', metavar='<FILENAME>', type=str,
default='model.pdb', help='File to store model coordinates'+
......@@ -70,6 +71,12 @@ try:
# pssm files would not be sufficient and we would be restricted to hhm.
if len(opts.profiles) > 0:
modelling.SetSequenceProfiles(mhandle, opts.profiles)
# add fragment support for Monte Carlo sampling. The fragment search
# is setup in the argument parser. If activated you get fragment support
# in any case but for optimal performance you should provide profiles
# in hhm format (for profile AND secondary structure information).
if len(opts.fragger_handles) > 0:
modelling.SetFraggerHandles(mhandle, opts.fragger_handles)
# build final model
final_model = modelling.BuildFromRawModel(mhandle)
except Exception as ex:
......
This diff is collapsed.
......@@ -400,6 +400,7 @@ Modelling Steps
with seqres in **mhandle**
.. autofunction:: SetFraggerHandles
.. autofunction:: CloseGaps
......
......@@ -23,6 +23,7 @@ set(MODELLING_PYMOD
_fragger_handle.py
_reconstruct_sidechains.py
_monte_carlo.py
_mhandle_helper.py
)
pymod(NAME modelling
......
......@@ -24,3 +24,4 @@ from _ring_punches import *
from _denovo import *
from _fragger_handle import *
from _monte_carlo import *
from _mhandle_helper import *
# Copyright (c) 2013-2018, SIB - Swiss Institute of Bioinformatics and
# Biozentrum - University of Basel
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
def SetFraggerHandles(mhandle, fragger_handles):
""" Sets the :attr:`fragger_handles` in **mhandle** while ensuring
consistency with the :attr:`ModellingHandle.seqres`
:param mhandle: Will have the fragger handles attached afterwards
:param fragger_handles: The fragger handles to attach
:type mhandle: :class:`ModellingHandle`
:type fragger_handles: :class:`list` of :class:`FraggerHandle`
:raises: :class:`ValueError` when the given **fragger_handles** are not
consistent with seqres in **mhandle**
"""
if len(mhandle.seqres) != len(mhandle.fragger_handles):
raise RuntimeError("Must have one FraggerHandle per chain!")
for a,b in zip(mhandle.seqres, mhandle.fragger_handles):
if str(a) != str(b.sequence):
raise RuntimeError("Sequence in FraggerHandle must match sequence "+
"in SEQRES!")
mhandle.fragger_handles = fragger_handles
......@@ -445,6 +445,13 @@ def BuildFromRawModel(mhandle, use_amber_ff=False, extra_force_fields=list()):
and adapt the default scoring members. Alternatively, you can setup the
scoring manually, but you must ensure consistency yourself!
By default, a simple backbone dihedral sampling is performed when entering
Monte Carlo. If *mhandle* has a list of :class:`FraggerHandle` objects
attached as "fragger_handles" attribute, the sampling will be performed with
structural fragments. To ensure consistency, the fragger handles should be
attached using :meth:`SetFraggerHandles`.
But be aware of increased runtime due to the fragment search step.
If the function fails to close all gaps, it will produce a warning and
return an incomplete model.
......@@ -489,10 +496,16 @@ def BuildFromRawModel(mhandle, use_amber_ff=False, extra_force_fields=list()):
# remove terminal gaps
RemoveTerminalGaps(mhandle)
# check whether we have fragger handles
fragger_handles = None
if hasattr(mhandle, "fragger_handles"):
fragger_handles = mhandle.fragger_handles
ost.LogInfo("Use fragments for Monte Carlo sampling")
# close gaps
CloseGaps(mhandle, merge_distance=merge_distance,
fragment_db=fragment_db, structure_db=structure_db,
torsion_sampler=torsion_sampler)
torsion_sampler=torsion_sampler, fragger_handles=fragger_handles)
# build sidechains
BuildSidechains(mhandle, merge_distance, fragment_db,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment