Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProMod3
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
ProMod3
Commits
1fc6d71d
Commit
1fc6d71d
authored
May 10, 2016
by
Studer Gabriel
Browse files
Options
Downloads
Patches
Plain Diff
Make it possible to define ranges in which gaps should be closed in a rawmodel
parent
58879c49
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
modelling/pymod/_closegaps.py
+130
-5
130 additions, 5 deletions
modelling/pymod/_closegaps.py
with
130 additions
and
5 deletions
modelling/pymod/_closegaps.py
+
130
−
5
View file @
1fc6d71d
...
@@ -245,7 +245,8 @@ def SetupBackboneScorer(mhandle):
...
@@ -245,7 +245,8 @@ def SetupBackboneScorer(mhandle):
def
CloseSmallDeletions
(
mhandle
,
scorer
,
max_extension
=
9
,
clash_thresh
=
1.0
,
def
CloseSmallDeletions
(
mhandle
,
scorer
,
max_extension
=
9
,
clash_thresh
=
1.0
,
e_thresh
=
200
,
use_scoring_extender
=
True
,
e_thresh
=
200
,
use_scoring_extender
=
True
,
use_full_extender
=
True
):
use_full_extender
=
True
,
chain_idx
=
None
,
resnum_range
=
None
):
'''
Close small deletions by relaxing neighbouring residues.
'''
Close small deletions by relaxing neighbouring residues.
Small deletions in the template from the target-template alignment have a
Small deletions in the template from the target-template alignment have a
...
@@ -271,6 +272,7 @@ def CloseSmallDeletions(mhandle, scorer, max_extension=9, clash_thresh=1.0,
...
@@ -271,6 +272,7 @@ def CloseSmallDeletions(mhandle, scorer, max_extension=9, clash_thresh=1.0,
:param clash_thresh: Threshold for the clash score, acceptance means being
:param clash_thresh: Threshold for the clash score, acceptance means being
lower than this.
lower than this.
:type clash_thresh: :class:`float`
:type clash_thresh: :class:`float`
:param e_thresh: Potential energy should be lower than this.
:param e_thresh: Potential energy should be lower than this.
...
@@ -292,6 +294,15 @@ def CloseSmallDeletions(mhandle, scorer, max_extension=9, clash_thresh=1.0,
...
@@ -292,6 +294,15 @@ def CloseSmallDeletions(mhandle, scorer, max_extension=9, clash_thresh=1.0,
extender to skip neighboring gaps and to correctly
extender to skip neighboring gaps and to correctly
handle gaps close to termini.
handle gaps close to termini.
:type use_full_extender: :class:`bool`
:type use_full_extender: :class:`bool`
:param chain_idx: If not None, only gaps from chain with given index get
processed
:type chain_idx: :class:`int`
:param resnum_range: If not None, only gaps within this resnum range get
processed
:type resnum_range: :class:`tuple` containing two :class:`int`
'''
'''
if
len
(
mhandle
.
gaps
)
>
0
:
if
len
(
mhandle
.
gaps
)
>
0
:
...
@@ -314,12 +325,35 @@ def CloseSmallDeletions(mhandle, scorer, max_extension=9, clash_thresh=1.0,
...
@@ -314,12 +325,35 @@ def CloseSmallDeletions(mhandle, scorer, max_extension=9, clash_thresh=1.0,
# transform the template sequence into the target sequence, aa's vanish,
# transform the template sequence into the target sequence, aa's vanish,
# so the target sequence has gap characters, the template not.
# so the target sequence has gap characters, the template not.
# If we are not looking at a deletion, do nothing.
# If we are not looking at a deletion, do nothing.
if
len
(
mhandle
.
gaps
[
current_gap_index
].
seq
)
==
0
:
if
len
(
mhandle
.
gaps
[
current_gap_index
].
seq
)
==
0
\
and
not
mhandle
.
gaps
[
current_gap_index
].
IsTerminal
():
# work on a copy of the gap, if not closed in the end, no harm done
# work on a copy of the gap, if not closed in the end, no harm done
current_gap
=
mhandle
.
gaps
[
current_gap_index
].
Copy
()
current_gap
=
mhandle
.
gaps
[
current_gap_index
].
Copy
()
current_chain
=
current_gap
.
GetChain
()
current_chain
=
current_gap
.
GetChain
()
current_chain_index
=
current_gap
.
GetChainIndex
()
current_chain_index
=
current_gap
.
GetChainIndex
()
# Evaluate whether the range is fulfilled if the according parameters
# are set
if
chain_idx
!=
None
:
if
current_chain_index
!=
chain_idx
:
# Gap gets neglected, we still need to increase the counter
# to jump to the next gap
current_gap_index
+=
1
continue
if
resnum_range
!=
None
:
# It is assumed that: gap_after_num = gap_before_num + 1
gap_before_num
=
current_gap
.
before
.
GetNumber
().
GetNum
()
if
not
(
gap_before_num
>=
resnum_range
[
0
]
\
and
gap_before_num
<
resnum_range
[
1
]):
# We're outside the range, we still need to increase the
# counter to jump to the next gap
current_gap_index
+=
1
continue
# Try to close gap by relaxation: by checking how far we may extend
# Try to close gap by relaxation: by checking how far we may extend
# the gap, we get the backbone to be stretched. If no more extension
# the gap, we get the backbone to be stretched. If no more extension
# is possible, break out. On first successful relaxation for an
# is possible, break out. On first successful relaxation for an
...
@@ -443,7 +477,8 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db,
...
@@ -443,7 +477,8 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db,
min_loops_required
=
4
,
max_res_extension
=-
1
,
min_loops_required
=
4
,
max_res_extension
=-
1
,
extended_search
=
True
,
use_scoring_extender
=
True
,
extended_search
=
True
,
use_scoring_extender
=
True
,
use_full_extender
=
True
,
score_variant
=
0
,
use_full_extender
=
True
,
score_variant
=
0
,
ring_punch_detection
=
1
):
ring_punch_detection
=
1
,
chain_idx
=
None
,
resnum_range
=
None
):
'''
Try to fill up loops from a structural database.
'''
Try to fill up loops from a structural database.
Usually this will extend the gaps a bit to match candidates from the
Usually this will extend the gaps a bit to match candidates from the
...
@@ -524,6 +559,15 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db,
...
@@ -524,6 +559,15 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db,
- **2**: check incl. sidechain for loop cand.
- **2**: check incl. sidechain for loop cand.
:type ring_punch_detection: :class:`int`
:type ring_punch_detection: :class:`int`
:param chain_idx: If not None, only gaps from chain with given index get
processed
:type chain_idx: :class:`int`
:param resnum_range: If not None, only gaps within this resnum range get
processed
:type resnum_range: :class:`tuple` containing two :class:`int`
'''
'''
if
len
(
mhandle
.
gaps
)
>
0
:
if
len
(
mhandle
.
gaps
)
>
0
:
...
@@ -545,6 +589,41 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db,
...
@@ -545,6 +589,41 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db,
# gap could not be removed.
# gap could not be removed.
while
gap_idx
<
len
(
mhandle
.
gaps
)
and
gap_idx
>=
0
:
while
gap_idx
<
len
(
mhandle
.
gaps
)
and
gap_idx
>=
0
:
# It is possible to specify exact ranges that should be resolved by
# the chain_idx and resnum_range parameters.
# Let's check whether we care for that particular gap in case of one
# parameter being set.
if
chain_idx
!=
None
:
if
mhandle
.
gaps
[
gap_idx
].
GetChainIndex
()
!=
chain_idx
:
# Gap is not in the chain we're interested in
gap_idx
+=
1
continue
if
resnum_range
!=
None
:
gap_before_num
=
mhandle
.
gaps
[
gap_idx
].
before
.
GetNumber
().
GetNum
()
gap_after_num
=
mhandle
.
gaps
[
gap_idx
].
after
.
GetNumber
().
GetNum
()
in_range
=
False
# check for full overlap => current gap is fully enclosing range
if
gap_before_num
<=
resnum_range
[
0
]
\
and
gap_after_num
>=
resnum_range
[
1
]:
# n_stem is not in the range we're interested in
in_range
=
True
# check for partial overlap => one of the stem residues is within
# the range
if
gap_before_num
>=
resnum_range
[
0
]
and
\
gap_before_num
<
resnum_range
[
1
]
or
\
gap_after_num
>
resnum_range
[
0
]
and
\
gap_after_num
<=
resnum_range
[
1
]:
in_range
=
True
if
not
in_range
:
# Gap is not in range we're interested in
gap_idx
+=
1
continue
# keep copy of original gap
# keep copy of original gap
gap_orig
=
mhandle
.
gaps
[
gap_idx
].
Copy
()
gap_orig
=
mhandle
.
gaps
[
gap_idx
].
Copy
()
if
score_variant
==
0
:
if
score_variant
==
0
:
...
@@ -555,6 +634,7 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db,
...
@@ -555,6 +634,7 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db,
gap_idx
+=
1
gap_idx
+=
1
continue
continue
##################################
##################################
# find loop candidates
# find loop candidates
##################################
##################################
...
@@ -652,7 +732,8 @@ def FillLoopsByMonteCarlo(mhandle, scorer, torsion_sampler, max_loops_to_search=
...
@@ -652,7 +732,8 @@ def FillLoopsByMonteCarlo(mhandle, scorer, torsion_sampler, max_loops_to_search=
max_extension
=
30
,
mc_num_loops
=
2
,
mc_steps
=
5000
,
max_extension
=
30
,
mc_num_loops
=
2
,
mc_steps
=
5000
,
use_scoring_extender
=
True
,
use_full_extender
=
True
,
use_scoring_extender
=
True
,
use_full_extender
=
True
,
score_variant
=
0
,
ring_punch_detection
=
1
,
score_variant
=
0
,
ring_punch_detection
=
1
,
fragger_handles
=
None
):
fragger_handles
=
None
,
chain_idx
=
None
,
resnum_range
=
None
):
'''
Try to fill up loops with Monte Carlo sampling.
'''
Try to fill up loops with Monte Carlo sampling.
This is meant as a
"
last-resort
"
approach when it is not possible to fill
This is meant as a
"
last-resort
"
approach when it is not possible to fill
...
@@ -715,6 +796,15 @@ def FillLoopsByMonteCarlo(mhandle, scorer, torsion_sampler, max_loops_to_search=
...
@@ -715,6 +796,15 @@ def FillLoopsByMonteCarlo(mhandle, scorer, torsion_sampler, max_loops_to_search=
:param fragger_handles: Either None (no fragger sampling used) or one
:param fragger_handles: Either None (no fragger sampling used) or one
fragger handle for each chain in *mhandle*.
fragger handle for each chain in *mhandle*.
:type fragger_handles: :class:`list` of :class:`~promod3.loop.FraggerHandle`
:type fragger_handles: :class:`list` of :class:`~promod3.loop.FraggerHandle`
:param chain_idx: If not None, only gaps from chain with given index get
processed
:type chain_idx: :class:`int`
:param resnum_range: If not None, only gaps within this resnum range get
processed
:type resnum_range: :class:`tuple` containing two :class:`int`
'''
'''
if
len
(
mhandle
.
gaps
)
>
0
:
if
len
(
mhandle
.
gaps
)
>
0
:
...
@@ -730,6 +820,41 @@ def FillLoopsByMonteCarlo(mhandle, scorer, torsion_sampler, max_loops_to_search=
...
@@ -730,6 +820,41 @@ def FillLoopsByMonteCarlo(mhandle, scorer, torsion_sampler, max_loops_to_search=
# gap could not be removed.
# gap could not be removed.
while
gap_idx
<
len
(
mhandle
.
gaps
)
and
gap_idx
>=
0
:
while
gap_idx
<
len
(
mhandle
.
gaps
)
and
gap_idx
>=
0
:
# It is possible to specify exact ranges that should be resolved by
# the chain_idx and resnum_range parameters.
# Let's check whether we care for that particular gap in case of one
# parameter being set.
if
chain_idx
!=
None
:
if
mhandle
.
gaps
[
gap_idx
].
GetChainIndex
()
!=
chain_idx
:
# Gap is not in the chain we're interested in
gap_idx
+=
1
continue
if
resnum_range
!=
None
:
gap_before_num
=
mhandle
.
gaps
[
gap_idx
].
before
.
GetNumber
().
GetNum
()
gap_after_num
=
mhandle
.
gaps
[
gap_idx
].
after
.
GetNumber
().
GetNum
()
in_range
=
False
# check for full overlap => current gap is fully enclosing range
if
gap_before_num
<=
resnum_range
[
0
]
\
and
gap_after_num
>=
resnum_range
[
1
]:
# n_stem is not in the range we're interested in
in_range
=
True
# check for partial overlap => one of the stem residues is within
# the range
if
gap_before_num
>=
resnum_range
[
0
]
and
\
gap_before_num
<
resnum_range
[
1
]
or
\
gap_after_num
>
resnum_range
[
0
]
and
\
gap_after_num
<=
resnum_range
[
1
]:
in_range
=
True
if
not
in_range
:
# Gap is not in range we're interested in
gap_idx
+=
1
continue
# keep copy of original gap
# keep copy of original gap
gap_orig
=
mhandle
.
gaps
[
gap_idx
].
Copy
()
gap_orig
=
mhandle
.
gaps
[
gap_idx
].
Copy
()
if
score_variant
==
0
:
if
score_variant
==
0
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment