Skip to content

Commit

Permalink
try/expect statement removed from scipy linkage calculation and repla…
Browse files Browse the repository at this point in the history
…ce with a test.
  • Loading branch information
tubiana committed Jan 19, 2021
1 parent 2f94ee3 commit 74c193e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
12 changes: 5 additions & 7 deletions create_envir_with_ttclust.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: ttclust
channels:
- defaults
- conda-forge
dependencies:
- argcomplete
- cython
Expand All @@ -9,10 +10,7 @@ dependencies:
- numpy
- pandas
- scipy >= 0.18
- omnia::mdtraj
- pip
- pip:
- prettytable
- argparse
- sklearn
- ttclust
- conda-forge::mdtraj
- scikit-learn
- conda-forge::prettytable
- numba
5 changes: 3 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: ttclust
channels:
- defaults
- conda-forge
dependencies:
- argcomplete
- cython
Expand All @@ -9,7 +10,7 @@ dependencies:
- numpy
- pandas
- scipy >= 0.18
- conda-forge::mdtraj
- mdtraj
- scikit-learn
- conda-forge::prettytable
- prettytable
- numba
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

MAJOR = 4
MINOR = 8
PATCH = 2
PATCH = 3
VERSION = "{}.{}.{}".format(MAJOR, MINOR, PATCH)

with open("ttclust/version.py", "w") as f:
Expand Down
11 changes: 6 additions & 5 deletions ttclust/ttclust.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def calculate_representative_frame_spread(clusters_list, DM):
cluster.spread = sum(mean_rmsd_per_frame.values()) / len(frames)
cluster.spread *= 10

@jit(nopython=True)
@jit(nopython=True, parallel=False, cache=True, nogil=True)
def calc_rmsd_2frames(ref, frame):
"""
RMSD calculation between a reference and a frame.
Expand Down Expand Up @@ -700,13 +700,14 @@ def create_cluster_table(traj, args):
else:
print(" Matrix shape: {}".format(distances.shape))
print(" Scipy linkage in progress. Please wait. It can be long")
try:
# linkage method from https://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.hierarchy.linkage.html
linkage_methods = ['single','average','complete','weighted','centroid','median','ward']
if args["method"] in linkage_methods:
linkage = sch.linkage(distances, method=args["method"])
except:
else:
printScreenLogfile("ERROR : method name given for clustering didn't recognized")
printScreenLogfile(" : methods are : single; complete; average; weighted; centroid; ward.")
printScreenLogfile(" : check https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/sc"
"ipy.cluster.hierarchy.linkage.html for more info")
printScreenLogfile(" : check https://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.hierarchy.linkage.html")
sys.exit(1)
print(" >Done!")
print(" ...Saving linkage matrix...")
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.8.2'
__version__ = '4.8.3'

0 comments on commit 74c193e

Please sign in to comment.