Skip to content

Commit

Permalink
squash
Browse files Browse the repository at this point in the history
  • Loading branch information
thermokarst committed Nov 23, 2020
1 parent 1af4193 commit 8e6de02
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion q2_emperor/_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def plot(output_dir: str, pcoa: skbio.OrdinationResults,
pcoa.features = None
if pcoa.features is not None:
raise ValueError("Arrows cannot be visualized with the 'plot' method, "
"use 'biplot' instead.")
"use 'biplot' instead, or enable "
"`ignore_pcoa_features`.")

generic_plot(output_dir, master=pcoa, metadata=metadata, other_pcoa=None,
ignore_missing_samples=ignore_missing_samples,
Expand Down
3 changes: 2 additions & 1 deletion q2_emperor/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
)
}

PLOT_PARAMETERS_DESC = {**PARAMETERS_DESC,
PLOT_PARAMETERS_DESC = {
**PARAMETERS_DESC,
'ignore_pcoa_features': 'Biplot arrows cannot be visualized using this '
'method. If you want to visualize biplot arrows '
'use the `biplot` method. Enabling this setting '
Expand Down
15 changes: 15 additions & 0 deletions q2_emperor/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ def test_plot_custom_axes(self):
self.assertTrue(os.path.exists(index_fp))
self.assertTrue('src="./emperor.html"' in open(index_fp).read())

def test_plot_with_pcoa_features(self):
# using the biplot test data, since it has features
with tempfile.TemporaryDirectory() as output_dir:
plot(output_dir, self.biplot, self.metadata,
ignore_pcoa_features=True)
self.assertTrue(True) # checkpoint, everything should be good

def test_plot_with_pcoa_features_ignored(self):
# using the biplot test data, since it has features
with tempfile.TemporaryDirectory() as output_dir, \
self.assertRaisesRegex(ValueError,
'Arrows cannot be visualized'):
plot(output_dir, self.biplot, self.metadata,
ignore_pcoa_features=False)

def test_plot_procrustes(self):
with tempfile.TemporaryDirectory() as output_dir:
procrustes_plot(output_dir, self.pcoa, other_pcoa=self.other,
Expand Down

0 comments on commit 8e6de02

Please sign in to comment.