diff --git a/PopPUNK/__main__.py b/PopPUNK/__main__.py index 2e9a292b..23f0c5c8 100644 --- a/PopPUNK/__main__.py +++ b/PopPUNK/__main__.py @@ -211,6 +211,8 @@ def main(): kmers = np.arange(args.min_k, args.max_k + 1, args.k_step) # Dict of DB access functions for assign_query (which is out of scope) + if no_sketchlib: + args.use_mash = True dbFuncs = setupDBFuncs(args, kmers, args.min_kmer_count) createDatabaseDir = dbFuncs['createDatabaseDir'] constructDatabase = dbFuncs['constructDatabase'] diff --git a/PopPUNK/sketchlib.py b/PopPUNK/sketchlib.py index 260b9e66..df40cd36 100644 --- a/PopPUNK/sketchlib.py +++ b/PopPUNK/sketchlib.py @@ -21,9 +21,15 @@ import sharedmem import networkx as nx from scipy import optimize -import h5py -import pp_sketchlib +# Try to import sketchlib +try: + no_sketchlib = False + import pp_sketchlib + import h5py +except ImportError as e: + sys.stderr.write("Sketchlib backend not available") + no_sketchlib = True from .mash import fitKmerCurve from .utils import iterDistRows