From ccd648a1b16e243d3f46452fab6ede11996b7414 Mon Sep 17 00:00:00 2001 From: Steven Weaver Date: Wed, 27 Sep 2023 17:18:52 -0700 Subject: [PATCH] Python 3.11 compatibility --- hivclustering/mtnetwork.py | 16 ++++++++++++++++ setup.py | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/hivclustering/mtnetwork.py b/hivclustering/mtnetwork.py index 13e65f5..e5a823b 100644 --- a/hivclustering/mtnetwork.py +++ b/hivclustering/mtnetwork.py @@ -132,6 +132,7 @@ def _test_edge_support(cycles, sequence_records, hy_instance, p_value_cutoff, te except ImportError: raise ImportError("Optional dependencies not found. Please install the 'edgefiltering' extras to use this function: pip install hivclustering[edgefiltering]") hy_instance = hy.HyphyInterface() + script_path = os.path.realpath(__file__) cycle_spec = [] @@ -173,6 +174,10 @@ def _batch_sequence_sim(spec): def _simulate_HIV_sequences(sequence, tree_matrix, hy_instance): if hy_instance is None: + try: + import hppy as hy + except ImportError: + raise ImportError("Optional dependencies not found. Please install the 'edgefiltering' extras to use this function: pip install hivclustering[edgefiltering]") hy_instance = hy.HyphyInterface() script_path = os.path.realpath(__file__) @@ -930,6 +935,11 @@ def simulate_sequence_evolution(self, founders, founder_sequences, rate_per_year if self.adjacency_list is None: self.compute_adjacency() + try: + import hppy as hy + except ImportError: + raise ImportError("Optional dependencies not found. Please install the 'edgefiltering' extras to use this function: pip install hivclustering[edgefiltering]") + hy_instance = hy.HyphyInterface() already_simulated = set() @@ -2496,7 +2506,13 @@ def test_edge_support(self, sequence_records, cycles, adjacency_set, hy_instance def fit_degree_distribution(self, degree_option=None, hy_instance=None): if hy_instance is None: + try: + import hppy as hy + except ImportError: + raise ImportError("Optional dependencies not found. please install the 'edgefiltering' extras to use this function: pip install hivclustering[edgefiltering]") + hy_instance = hy.HyphyInterface() + script_path = os.path.realpath(__file__) hbl_path = os.path.join(os.path.dirname(script_path), "data", "HBL", "DegreeDistributions.bf") if degree_option == 'indegree': diff --git a/setup.py b/setup.py index f70093a..e189944 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ sys.path.insert(0, join(split(abspath(__file__))[0], 'lib')) setup(name='hivclustering', - version="1.6.7", + version="1.6.8", description='HIV molecular clustering tools', author='Sergei Kosakovsky Pond', author_email='spond@ucsd.edu', @@ -19,7 +19,7 @@ 'data/HBL/*.bf', ]}, extras_require={ - 'edgefiltering': ['bioext >= 0.19.0','hyphy-python >= 0.1.11','hppy >= 0.9.9'], + 'edgefiltering': ['bioext >= 0.21.0','hyphy-python >= 0.1.11','hppy >= 0.9.9'], }, scripts=[ 'scripts/hivnetworkcsv',