Skip to content

Commit

Permalink
Handle sketchlib import error
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlees committed Feb 7, 2020
1 parent 790c290 commit ccaa02d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions PopPUNK/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
10 changes: 8 additions & 2 deletions PopPUNK/sketchlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ccaa02d

Please sign in to comment.