Skip to content

Commit

Permalink
filtered features visualizer
Browse files Browse the repository at this point in the history
  • Loading branch information
colinvwood committed Sep 13, 2024
1 parent aba502e commit 5d2c65e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
20 changes: 19 additions & 1 deletion q2_qsip2/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)
from q2_qsip2.visualizers._visualizers import (
plot_weighted_average_densities, plot_sample_curves, plot_density_outliers,
show_comparison_groups
show_comparison_groups, plot_filtered_features
)


Expand Down Expand Up @@ -231,4 +231,22 @@
citations=[],
)

plugin.visualizers.register_function(
function=plot_filtered_features,
inputs={
'filtered_qsip_data': QSIP2Data[Filtered]
},
parameters={},
input_descriptions={
'filtered_qsip_data': 'Your filtered qsip data artifact.'
},
parameter_descriptions={},
name='Visualize feature retention.',
description=(
'Displays per-source stacked bar charts of feature retention by '
'relative abundance and feature count.'
),
citations=[],
)

importlib.import_module('q2_qsip2.types._deferred_setup')
18 changes: 18 additions & 0 deletions q2_qsip2/visualizers/_visualizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,21 @@ def show_comparison_groups(
df = qsip2.show_comparison_groups(qsip_data, groups_vector)

df.to_html(Path(output_dir) / 'index.html')


def plot_filtered_features(output_dir: str, filtered_qsip_data: RS4) -> None:
'''
Displays per-source stacked bar charts showing the retention of features.
Parameters
----------
output_dir : str
The root directory of the visualization loaded into the browser.
qsip_data : RS4
The "qsip_data" object.
'''
plot = qsip2.plot_filter_gradient_position(filtered_qsip_data)

_ggplot2_object_to_visualization(
plot, Path(output_dir), width=10, height=10
)

0 comments on commit 5d2c65e

Please sign in to comment.