Skip to content

Commit

Permalink
Bug fix that caused an issue with the RMSD matrix being the same desp…
Browse files Browse the repository at this point in the history
…ite the "-sr" argument.
  • Loading branch information
tubiana committed Jun 1, 2021
1 parent 975ccec commit c40bf2f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ dependencies:
- scikit-learn
- prettytable
- numba
- hashlib
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ prettytable
scipy >= 0.18
scitkit-learn
mdtraj >= 1.7
numba
numba
hashlib
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from setuptools import setup, find_packages

MAJOR = 4
MINOR = 8
PATCH = 4
MINOR = 10
PATCH = 0
VERSION = "{}.{}.{}".format(MAJOR, MINOR, PATCH)

with open("ttclust/version.py", "w") as f:
Expand Down Expand Up @@ -30,6 +30,7 @@
'scipy >= 0.18',
'scikit-learn',
'numba',
'hashlib'
'mdtraj >= 1.7'],

entry_points={'console_scripts':['ttclust=ttclust.ttclust:main']},
Expand Down
17 changes: 10 additions & 7 deletions ttclust/ttclust.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@ def create_DM(traj, args):
traj=traj,
args=args)

RMSD_selection = return_selection_atom("RMSD", traj=traj,
args=args)
# RMSD_selection = return_selection_atom("RMSD", traj=traj,
# args=args)

# Trajectory superposition (aligment)
traj_aligned = traj.superpose(traj[0],
Expand All @@ -549,12 +549,15 @@ def create_DM(traj, args):
else:
traj_aligned = traj

select_align = improve_nucleic_acid(args["select_alignement"])
# select_align = improve_nucleic_acid(args["select_alignement"])
# Transform the RMSD string for nucleic acids.
untouch_rmsd_string = args["select_rmsd"]
rmsd_string = improve_nucleic_acid(args["select_rmsd"])

# If the RMSD string is not empty
if rmsd_string:
print("NOTE : Extraction of subtrajectory for time optimisation")
# Extract the subpart.
traj_aligned = extract_selected_atoms(rmsd_string, traj_aligned, args["logname"])
# matrix initialization
distances = np.zeros((traj.n_frames, traj.n_frames))
Expand All @@ -568,14 +571,14 @@ def create_DM(traj, args):
return np.load(distance_file)
else: # otherwise

pbar = pg.ProgressBar(widgets=WIDGETS, maxval=traj.n_frames).start()
pbar = pg.ProgressBar(widgets=WIDGETS, maxval=traj_aligned.n_frames).start()
counter = 0
# Pairwise RMSD calculation (matrix n²)
for i in range(traj.n_frames):
for i in range(traj_aligned.n_frames):
# distances[i] = md.rmsd(traj_aligned, traj_aligned, frame=i)

for j in range(i + 1, traj.n_frames):
rmsd = calc_rmsd_2frames(traj.xyz[i], traj.xyz[j])
for j in range(i + 1, traj_aligned.n_frames):
rmsd = calc_rmsd_2frames(traj_aligned.xyz[i], traj_aligned.xyz[j])
distances[i][j] = rmsd
distances[j][i] = rmsd
pbar.update(counter)
Expand Down
2 changes: 1 addition & 1 deletion ttclust/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '4.9.0'
__version__ = '4.10.0'

0 comments on commit c40bf2f

Please sign in to comment.