Skip to content

Commit

Permalink
fix(mtnetwork): add import check
Browse files Browse the repository at this point in the history
try to import HyPhy before use
in transmission_network.fit_degree_distribution

closes #40
  • Loading branch information
FynnFreyer committed Aug 22, 2023
1 parent f585f98 commit 5477e72
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hivclustering/mtnetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -2496,6 +2496,11 @@ 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")
Expand Down

0 comments on commit 5477e72

Please sign in to comment.