diff --git a/Makefile b/Makefile index a2765461c..bd9f4f877 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ jstest: stylecheck: jshint $(JSLOCS) prettier --check --tab-width 4 $(JSLOCS) $(CSSLOCS) - flake8 empress/*.py tests/python/*.py setup.py + flake8 empress/*.py tests/python/*.py setup.py empress/scripts/*.py # Auto-formats the JS code jsstyle: diff --git a/empress/core.py b/empress/core.py index daf873c5b..401e3ade8 100644 --- a/empress/core.py +++ b/empress/core.py @@ -136,6 +136,11 @@ def __init__(self, tree, table=None, sample_metadata=None, # self._validate_and_match_data() self.features = feature_metadata.copy() else: + if shear_to_feature_metadata: + raise ValueError( + "Feature metadata must be provided in order to shear " + "to feature metadata." + ) self.features = None self.ordination = ordination diff --git a/empress/scripts/_cli.py b/empress/scripts/_cli.py index 2c4adbb71..24976cb8c 100644 --- a/empress/scripts/_cli.py +++ b/empress/scripts/_cli.py @@ -15,10 +15,12 @@ def empress(): """Generates an interactive visualization of a phylogenetic tree.""" pass + # Allow using -h to show help information # https://click.palletsprojects.com/en/7.x/documentation/#help-parameter-customization CTXSETS = {"help_option_names": ["-h", "--help"]} + @empress.command( "tree-plot", short_help=desc.TREE_PLOT_DESC, context_settings=CTXSETS ) diff --git a/tests/python/test_core.py b/tests/python/test_core.py index 69ad7cf61..b8a9c0afe 100644 --- a/tests/python/test_core.py +++ b/tests/python/test_core.py @@ -204,6 +204,11 @@ def test_init_tree_plot_fm_not_matching(self): ): Empress(self.tree, feature_metadata=bad_fm) + def test_init_tree_plot_shear_without_metadata(self): + with self.assertRaisesRegex(ValueError, + "Feature metadata must be provided"): + Empress(self.tree, shear_to_feature_metadata=True) + def test_init_only_one_of_table_and_sm_passed(self): exp_errmsg = ( "Both the table and sample metadata should be specified or None. "