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
f2bb4a63
Commit
f2bb4a63
authored
13 years ago
by
Niklaus Johner
Browse files
Options
Downloads
Patches
Plain Diff
Added function to calculate an RMSD matrix from a trajectory
parent
6e657c15
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/mol/alg/pymod/trajectory_analysis.py
+37
-1
37 additions, 1 deletion
modules/mol/alg/pymod/trajectory_analysis.py
with
37 additions
and
1 deletion
modules/mol/alg/pymod/trajectory_analysis.py
+
37
−
1
View file @
f2bb4a63
...
@@ -4,7 +4,8 @@ Some functions for analyzing trajectories
...
@@ -4,7 +4,8 @@ Some functions for analyzing trajectories
Author: Niklaus Johner
Author: Niklaus Johner
"""
"""
from
ost
import
*
import
ost.mol.alg
from
ost
import
LogError
import
os
import
os
def
smooth
(
vec
,
n
):
def
smooth
(
vec
,
n
):
...
@@ -46,3 +47,38 @@ def smooth(vec,n):
...
@@ -46,3 +47,38 @@ def smooth(vec,n):
return
vec2
return
vec2
"""
From here on the module needs numpy
"""
def
RMSD_Matrix_From_Traj
(
t
,
sele
,
first
=
0
,
last
=-
1
):
"""
This function calculates a matrix M such that M[i,j] is the
RMSD of the EntityView sele between frames i and j of the trajectory t
aligned on sele.
Its inputs are:
t : the trajectory (CoordGroupHandle)
sele : the EntityView used for alignment and RMSD calculation
first=0 : the first frame of t to be used
last=-1 : the last frame of t to be used
Returns a numpy NxN matrix, where n is the number of frames.
"""
try
:
import
numpy
as
npy
if
last
==-
1
:
last
=
t
.
GetFrameCount
()
n_frames
=
last
-
first
rmsd_matrix
=
npy
.
identity
(
n_frames
)
for
i
in
range
(
n_frames
):
t
=
ost
.
mol
.
alg
.
SuperposeFrames
(
t
,
sele
,
begin
=
first
,
end
=
last
,
ref
=
i
)
eh
=
t
.
GetEntity
()
t
.
CopyFrame
(
i
)
rmsd_matrix
[
i
,:]
=
ost
.
mol
.
alg
.
AnalyzeRMSD
(
t
,
sele
,
sele
)
if
i
==
0
:
last
=
last
-
first
first
=
0
return
rmsd_matrix
except
ImportError
:
LogError
(
"
Function needs numpy, but I could not import it.
"
)
raise
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