Skip to content

Commit

Permalink
Python 3.11 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenweaver committed Sep 28, 2023
1 parent f585f98 commit ccd648a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions hivclustering/mtnetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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__)
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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':
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='[email protected]',
Expand All @@ -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',
Expand Down

0 comments on commit ccd648a

Please sign in to comment.