Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mrdna
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
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
tbgl
tools
mrdna
Commits
09b759a3
Commit
09b759a3
authored
7 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
Removed mdtraj dependency
parent
07784594
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
dnarbd/coords.py
+15
-49
15 additions, 49 deletions
dnarbd/coords.py
dnarbd/segmentmodel.py
+1
-1
1 addition, 1 deletion
dnarbd/segmentmodel.py
dnarbd/simulate.py
+1
-1
1 addition, 1 deletion
dnarbd/simulate.py
with
17 additions
and
51 deletions
dnarbd/coords.py
+
15
−
49
View file @
09b759a3
...
...
@@ -164,63 +164,29 @@ def readArbdCoords(fname):
return
np
.
array
(
coords
)
def
readAvgArbdCoords
(
psf
,
pdb
,
dcd
,
rmsdThreshold
=
3.5
):
import
mdtraj
as
md
## align trajectory to pdb
ref
=
md
.
load
(
pdb
,
top
=
pdb
)
sel
=
md
.
load
(
dcd
,
top
=
pdb
)
# return ref.xyz[0,:,:]*10
import
MDAnalysis
as
mda
# ref = sel[-1]
ids
=
ref
.
topology
.
select
(
"
name =~
'
D.*
'"
)
assert
(
len
(
ids
)
>
3
)
usel
=
mda
.
Universe
(
psf
,
dcd
)
sel
=
usel
.
select_atoms
(
"
name D*
"
)
# r0 = ref.xyz[0,ids,:]
r0
=
sel
.
xyz
[
-
1
,
ids
,:]
t
=
-
1
# in case dcd_frames < 3
for
t
in
range
(
len
(
sel
.
xyz
)
-
2
,
-
1
,
-
1
):
# print(t)
R
,
comA
,
comB
=
minimizeRmsd
(
sel
.
xyz
[
t
,
ids
,:],
r0
)
sel
.
xyz
[
t
,:,:]
=
np
.
array
(
[(
r
-
comA
).
dot
(
R
)
+
comB
for
r
in
sel
.
xyz
[
t
]]
)
rmsd
=
np
.
mean
(
(
sel
.
xyz
[
t
,
ids
,:]
-
r0
)
**
2
)
if
rmsd
>
(
0.1
*
rmsdThreshold
)
**
2
:
ts
=
usel
.
trajectory
[
-
1
]
r0
=
sel
.
positions
pos
=
[]
for
t
in
range
(
ts
.
frame
-
1
,
-
1
,
-
1
):
usel
.
trajectory
[
t
]
R
,
comA
,
comB
=
minimizeRmsd
(
sel
.
positions
,
r0
)
r
=
np
.
array
(
[(
r
-
comA
).
dot
(
R
)
+
comB
for
r
in
sel
.
positions
]
)
rmsd
=
np
.
mean
(
(
r
-
r0
)
**
2
)
r
=
np
.
array
(
[(
r
-
comA
).
dot
(
R
)
+
comB
for
r
in
usel
.
atoms
.
positions
]
)
pos
.
append
(
r
)
if
rmsd
>
rmsdThreshold
**
2
:
break
t0
=
t
+
1
print
(
"
Averaging coordinates in %s after frame %d
"
%
(
dcd
,
t0
)
)
pos
=
sel
.
xyz
[
t0
:,:,:]
pos
=
np
.
mean
(
pos
,
axis
=
0
)
return
10
*
pos
# convert to Angstroms
# def readAvgArbdCoords(psf,pdb,dcd,rmsdThreshold=3.5):
# import MDAnalysis as md
# ## align trajectory to pdb
# from pdb import set_trace
# set_trace()
# uref = md.Universe(psf, pdb)
# usel = md.Universe(psf, dcd)
# ref = uref.select_atoms("name 'd*'")
# sel = usel.select_atoms("name 'd*'")
# # r0 = ref.xyz[0,ids,:]
# ts = usel.trajectory[-1]
# ts.frame
# r0 = sel.positions
# for t in range(ts.frame-1,-1,-1):
# print(t)
# usel.trajectory[t]
# R,comA,comB = minimizeRmsd(sel.positions,r0)
# sel.positions = np.array( [(r-comA).dot(R)+comB for r in sel.positions] )
# rmsd = np.mean( (sel.positions-r0)**2 )
# if rmsd > (0.1*rmsdThreshold)**2:
# break
# t0=t+1
# print( "Averaging coordinates in %s after frame %d" % (dcd, t0) )
# pos = sel.xyz[t0:,:,:]
# pos = np.mean(pos, axis=0)
# return 10*pos # convert to Angstroms
return
pos
def
unit_quat_conversions
():
for
axis
in
[[
0
,
0
,
1
],[
1
,
1
,
1
],[
1
,
0
,
0
],[
-
1
,
-
2
,
0
]]:
...
...
This diff is collapsed.
Click to expand it.
dnarbd/segmentmodel.py
+
1
−
1
View file @
09b759a3
...
...
@@ -744,7 +744,7 @@ class Segment(ConnectableElement, Group):
b
=
self
.
_generate_one_bead
(
self
.
nt_pos_to_contour
(
0
),
0
)
existing_beads
=
[
b
]
+
existing_beads
if
existing_beads
[
-
1
].
get_nt_position
(
self
)
-
(
self
.
num_nt
-
1
)
<
-
0.5
:
if
existing_beads
[
-
1
].
get_nt_position
(
self
)
-
(
self
.
num_nt
-
1
)
<
-
0.5
or
len
(
existing_beads
)
==
1
:
b
=
self
.
_generate_one_bead
(
self
.
nt_pos_to_contour
(
self
.
num_nt
-
1
),
0
)
existing_beads
.
append
(
b
)
assert
(
len
(
existing_beads
)
>
1
)
...
...
This diff is collapsed.
Click to expand it.
dnarbd/simulate.py
+
1
−
1
View file @
09b759a3
...
...
@@ -76,7 +76,7 @@ def multiresolution_simulation( model, output_name,
model
.
_clear_beads
()
model
.
_generate_bead_model
(
1
,
1
,
local_twist
=
True
,
escapable_twist
=
False
)
model
.
simulate
(
outputPrefix
=
output_prefix
,
numSteps
=
fine_steps
,
**
simargs
)
coordinates
=
readAvgArbdCoords
(
'
%s.psf
'
%
output_
name
,
'
%s.pdb
'
%
output_prefix
,
'
%s.0.dcd
'
%
full_output_prefix
)
coordinates
=
readAvgArbdCoords
(
'
%s.psf
'
%
output_
prefix
,
'
%s.pdb
'
%
output_prefix
,
'
%s.0.dcd
'
%
full_output_prefix
)
"""
Atomic simulation
"""
...
...
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