Skip to content

Commit

Permalink
Add external clustering test
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjcroucher committed Mar 11, 2024
1 parent d56b5ae commit b4773dd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions PopPUNK/visualise.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,20 @@ def generate_visualisations(query_db,
#* *#
#**********************************#

# identify existing model and cluster files
if model_dir is not None:
model_prefix = model_dir
else:
model_prefix = ref_db
try:
model_file = os.path.join(model_prefix, os.path.basename(model_prefix))
model = loadClusterFit(model_file + '_fit.pkl',
model_file + '_fit.npz')
model.set_threads(threads)
except FileNotFoundError:
sys.stderr.write('Unable to locate previous model fit in ' + model_prefix + '\n')
sys.exit(1)

# Either use strain definitions, lineage assignments or external clustering
isolateClustering = {}
# Use external clustering if specified
Expand All @@ -389,20 +403,6 @@ def generate_visualisations(query_db,

else:

# identify existing model and cluster files
if model_dir is not None:
model_prefix = model_dir
else:
model_prefix = ref_db
try:
model_file = os.path.join(model_prefix, os.path.basename(model_prefix))
model = loadClusterFit(model_file + '_fit.pkl',
model_file + '_fit.npz')
model.set_threads(threads)
except FileNotFoundError:
sys.stderr.write('Unable to locate previous model fit in ' + model_prefix + '\n')
sys.exit(1)

# Load previous clusters
if previous_clustering is not None:
cluster_file = previous_clustering
Expand Down
Binary file modified test/example_set.tar.bz2
Binary file not shown.

0 comments on commit b4773dd

Please sign in to comment.