Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
27f67ebc
Commit
27f67ebc
authored
13 years ago
by
Bienchen
Browse files
Options
Downloads
Patches
Plain Diff
Added MatchResidueByGlobalAln, implemented as shared function with MatchResidueByLocalAln
parent
51da9c1a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/mol/alg/doc/molalg.rst
+2
-0
2 additions, 0 deletions
modules/mol/alg/doc/molalg.rst
modules/mol/alg/pymod/superpose.py
+56
-20
56 additions, 20 deletions
modules/mol/alg/pymod/superpose.py
with
58 additions
and
20 deletions
modules/mol/alg/doc/molalg.rst
+
2
−
0
View file @
27f67ebc
...
@@ -53,6 +53,8 @@
...
@@ -53,6 +53,8 @@
.. autofunction:: MatchResidueByLocalAln
.. autofunction:: MatchResidueByLocalAln
.. autofunction:: MatchResidueByGlobalAln
.. autofunction:: Superpose
.. autofunction:: Superpose
...
...
This diff is collapsed.
Click to expand it.
modules/mol/alg/pymod/superpose.py
+
56
−
20
View file @
27f67ebc
...
@@ -178,25 +178,9 @@ def MatchResidueByIdx(ent_a, ent_b, atoms='all'):
...
@@ -178,25 +178,9 @@ def MatchResidueByIdx(ent_a, ent_b, atoms='all'):
return
result_a
,
result_b
return
result_a
,
result_b
def
MatchResidueBy
Local
Aln
(
ent_a
,
ent_b
,
atoms
=
'
all
'
):
def
_
MatchResidueByAln
(
ent_a
,
ent_b
,
atoms
,
alnmethod
):
"""
"""
Match residues by local alignment. Takes **ent_a** and **ent_b**, extracts
For internal use, only
the sequences chain-wise and aligns them in Smith/Waterman manner. This local
alignment is then used to gather residues from both entities, only touching
atoms as defined by **atoms**. Regardless of what the list of **atoms** says,
only those present in two matched residues will be included in the returned
views. Chains are processed in order of appearance. If **ent_a** and
**ent_b** contain a different number of chains, processing stops with the
lower count.
:param ent_a: The first entity
:type ent_a: :class:`~ost.mol.EntityView` or :class:`~ost.mol.EntityHandle`
:param ent_b: The second entity
:type ent_b: :class:`~ost.mol.EntityView` or :class:`~ost.mol.EntityHandle`
:param atoms: The subset of atoms to be included in the two views.
:type atoms: :class:`str`, :class:`list`, :class:`set`
:returns: Two :class:`~ost.mol.EntityView` instances with the same number of
residues. Each residue will have the same number & type of atoms.
"""
"""
## init. final views
## init. final views
result_a
=
_EmptyView
(
ent_a
)
result_a
=
_EmptyView
(
ent_a
)
...
@@ -215,7 +199,7 @@ def MatchResidueByLocalAln(ent_a, ent_b, atoms='all'):
...
@@ -215,7 +199,7 @@ def MatchResidueByLocalAln(ent_a, ent_b, atoms='all'):
## create sequence from residue lists & alignment
## create sequence from residue lists & alignment
seq_a
=
ost
.
seq
.
CreateSequence
(
chain_a
.
name
,
s_a
)
seq_a
=
ost
.
seq
.
CreateSequence
(
chain_a
.
name
,
s_a
)
seq_b
=
ost
.
seq
.
CreateSequence
(
chain_b
.
name
,
s_b
)
seq_b
=
ost
.
seq
.
CreateSequence
(
chain_b
.
name
,
s_b
)
aln_a_b
=
ost
.
seq
.
alg
.
LocalAlign
(
seq_a
,
seq_b
,
ost
.
seq
.
alg
.
BLOSUM62
)
aln_a_b
=
alnmethod
(
seq_a
,
seq_b
,
ost
.
seq
.
alg
.
BLOSUM62
)
## evaluate alignment
## evaluate alignment
for
aln
in
aln_a_b
:
for
aln
in
aln_a_b
:
## bind chain to alignment
## bind chain to alignment
...
@@ -231,6 +215,51 @@ def MatchResidueByLocalAln(ent_a, ent_b, atoms='all'):
...
@@ -231,6 +215,51 @@ def MatchResidueByLocalAln(ent_a, ent_b, atoms='all'):
result_b
.
AddAllInclusiveBonds
()
result_b
.
AddAllInclusiveBonds
()
return
result_a
,
result_b
return
result_a
,
result_b
def
MatchResidueByLocalAln
(
ent_a
,
ent_b
,
atoms
=
'
all
'
):
"""
Match residues by local alignment. Takes **ent_a** and **ent_b**, extracts
the sequences chain-wise and aligns them in Smith/Waterman manner. For
scoring, the BLOSUM62 matrix is used. The local alignment is used to gather
residues from both entities, only touching atoms as defined by **atoms**.
Regardless of what the list of **atoms** says, only those present in two
matched residues will be included in the returned views. Chains are processed
in order of appearance. If **ent_a** and **ent_b** contain a different number
of chains, processing stops with the lower count.
:param ent_a: The first entity
:type ent_a: :class:`~ost.mol.EntityView` or :class:`~ost.mol.EntityHandle`
:param ent_b: The second entity
:type ent_b: :class:`~ost.mol.EntityView` or :class:`~ost.mol.EntityHandle`
:param atoms: The subset of atoms to be included in the two views.
:type atoms: :class:`str`, :class:`list`, :class:`set`
:returns: Two :class:`~ost.mol.EntityView` instances with the same number of
residues. Each residue will have the same number & type of atoms.
"""
return
_MatchResidueByAln
(
ent_a
,
ent_b
,
atoms
,
ost
.
seq
.
alg
.
LocalAlign
)
def
MatchResidueByGlobalAln
(
ent_a
,
ent_b
,
atoms
=
'
all
'
):
"""
Match residues by global alignment. Takes **ent_a** and **ent_b**, extracts
the sequences chain-wise and aligns them in Needleman/Wunsch manner. For
scoring, the BLOSUM62 matrix is used. The global alignment is used to gather
residues from both entities, only touching atoms as defined by **atoms**.
Regardless of what the list of **atoms** says, only those present in two
matched residues will be included in the returned views. Chains are processed
in order of appearance. If **ent_a** and **ent_b** contain a different number
of chains, processing stops with the lower count.
:param ent_a: The first entity
:type ent_a: :class:`~ost.mol.EntityView` or :class:`~ost.mol.EntityHandle`
:param ent_b: The second entity
:type ent_b: :class:`~ost.mol.EntityView` or :class:`~ost.mol.EntityHandle`
:param atoms: The subset of atoms to be included in the two views.
:type atoms: :class:`str`, :class:`list`, :class:`set`
:returns: Two :class:`~ost.mol.EntityView` instances with the same number of
residues. Each residue will have the same number & type of atoms.
"""
return
_MatchResidueByAln
(
ent_a
,
ent_b
,
atoms
,
ost
.
seq
.
alg
.
GlobalAlign
)
def
Superpose
(
ent_a
,
ent_b
,
match
=
'
number
'
,
atoms
=
'
all
'
):
def
Superpose
(
ent_a
,
ent_b
,
match
=
'
number
'
,
atoms
=
'
all
'
):
"""
"""
Superposes the first entity onto the second. To do so, two views are created,
Superposes the first entity onto the second. To do so, two views are created,
...
@@ -248,6 +277,9 @@ def Superpose(ent_a, ent_b, match='number', atoms='all'):
...
@@ -248,6 +277,9 @@ def Superpose(ent_a, ent_b, match='number', atoms='all'):
* ``local`` - select residues from a Smith/Waterman alignment, includes
* ``local`` - select residues from a Smith/Waterman alignment, includes
**atoms**, calls :func:`~ost.mol.alg.MatchResidueByLocalAln`
**atoms**, calls :func:`~ost.mol.alg.MatchResidueByLocalAln`
* ``global`` - select residues from a Needleman/Wunsch alignment, includes
**atoms**, calls :func:`~ost.mol.alg.MatchResidueByGlobalAln`
:param ent_a: The first entity
:param ent_a: The first entity
:type ent_a: :class:`~ost.mol.EntityView` or :class:`~ost.mol.EntityHandle`
:type ent_a: :class:`~ost.mol.EntityView` or :class:`~ost.mol.EntityHandle`
:param ent_b: The second entity
:param ent_b: The second entity
...
@@ -271,7 +303,11 @@ def Superpose(ent_a, ent_b, match='number', atoms='all'):
...
@@ -271,7 +303,11 @@ def Superpose(ent_a, ent_b, match='number', atoms='all'):
elif
match
.
upper
()
==
'
INDEX
'
:
elif
match
.
upper
()
==
'
INDEX
'
:
view_a
,
view_b
=
MatchResidueByIdx
(
ent_a
,
ent_b
,
atoms
)
view_a
,
view_b
=
MatchResidueByIdx
(
ent_a
,
ent_b
,
atoms
)
elif
match
.
upper
()
==
'
LOCAL
'
:
elif
match
.
upper
()
==
'
LOCAL
'
:
view_a
,
view_b
=
MatchResidueByLocalAln
(
ent_a
,
ent_b
,
atoms
)
view_a
,
view_b
=
_MatchResidueByAln
(
ent_a
,
ent_b
,
atoms
,
ost
.
seq
.
alg
.
LocalAlign
)
elif
match
.
upper
()
==
'
GLOBAL
'
:
view_a
,
view_b
=
_MatchResidueByAln
(
ent_a
,
ent_b
,
atoms
,
ost
.
seq
.
alg
.
GlobalAlign
)
else
:
else
:
raise
ValueError
(
not_supported
)
raise
ValueError
(
not_supported
)
## action
## action
...
...
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
register
or
sign in
to comment