From 6226e767aaf3ccff15d8e7e80948a018bfc11e33 Mon Sep 17 00:00:00 2001 From: Luiz Irber Date: Wed, 27 Jun 2018 21:24:44 +0000 Subject: [PATCH] make sourmash compatible with khmer 3 --- setup.py | 2 +- sourmash/sbt.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 7300fbfde0..00839520be 100644 --- a/setup.py +++ b/setup.py @@ -70,7 +70,7 @@ language="c++", extra_compile_args=EXTRA_COMPILE_ARGS, extra_link_args=EXTRA_LINK_ARGS)], - "install_requires": ["screed>=0.9", "ijson", "khmer>=2.1<3.0"], + "install_requires": ["screed>=0.9", "ijson", "khmer>=2.1"], "setup_requires": ['Cython>=0.25.2', "setuptools>=38.6.0"], "extras_require": { 'test' : ['pytest', 'pytest-cov', 'numpy', 'matplotlib', 'scipy','recommonmark'], diff --git a/sourmash/sbt.py b/sourmash/sbt.py index e0c67298d6..3ab73eda04 100644 --- a/sourmash/sbt.py +++ b/sourmash/sbt.py @@ -54,6 +54,11 @@ def search_transcript(node, seq, threshold): import khmer +try: + load_nodegraph = khmer.load_nodegraph +except AttributeError: + load_nodegraph = khmer.Nodegraph.load + from .sbt_storage import FSStorage, TarStorage, IPFSStorage, RedisStorage from .logging import error, notify, debug @@ -785,7 +790,7 @@ def data(self): with NamedTemporaryFile(suffix=".gz") as f: f.write(data) f.file.flush() - self._data = khmer.load_nodegraph(f.name) + self._data = load_nodegraph(f.name) return self._data @data.setter @@ -838,7 +843,7 @@ def data(self): with NamedTemporaryFile(suffix=".gz") as f: f.write(data) f.file.flush() - self._data = khmer.load_nodegraph(f.name) + self._data = load_nodegraph(f.name) return self._data @data.setter