Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions tools/mags_visualization/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: mags_visualization
Comment thread
SaimMomin12 marked this conversation as resolved.
owner: iuc
categories:
- Metagenomics
- Visualization
description: Visualization tools for MAG evaluation and analysis
long_description: |
MAGs-visualization is a toolkit for generating publication-ready plots and
dashboards for metagenome-assembled genomes (MAGs).

Suppoerted visualization include:

- completeness and contamination (CheckM/CheckM2)
- taxonomic profiles (GTDB)
- clustering (dRep)
- abundance patterns (CoverM)
- functional annotation (KEGG pathways)

The Galaxy wrappers provide modular tools corresponding to each visualization type.
homepage_url: https://github.com/usegalaxy-eu/MAGs-visualization
remote_repository_url: https://github.com/galaxyproject/tools-iuc/tree/main/tools/mags_visualization
type: unrestricted
suite:
name: "suite_mags_visualization"
description: "A suite of MAGs-visualization tools"
type: repository_suite_definition
auto_tool_repositories:
name_template: "{{ tool_id }}"
description_template: "Wrapper for MAGs-visualization tool: {{ tool_name }}"
188 changes: 188 additions & 0 deletions tools/mags_visualization/comp_conta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
<tool id="mags_visualization_comp_conta" name="MAGs-visualization comp-conta" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
<description>Create completeness/contamination plots</description>
<macros>
<import>macros.xml</import>
</macros>
<expand macro="requirements"/>
<expand macro="version_command"/>
<command detect_errors="exit_code"><![CDATA[
mags-visualization comp-conta
--checkm '$checkm'
--checkm2 '$checkm2'
--mode '$mode_cond.mode'
--top_n '$top_n'
--format '$format'

#if $mode_cond.mode == "tax"
--gtdb '$mode_cond.gtdb'
--tax_level '$mode_cond.tax_level'
#end if

#if $mode_cond.mode == "meta"
--metadata '$mode_cond.metadata'
--meta_col '$mode_cond.meta_col'
--meta_bin_width '$mode_cond.meta_bin_width'
#end if

#if str($fig_size.width) != "" and str($fig_size.height) != ""
--fig_size '$fig_size.width' '$fig_size.height'
#end if

-o outputs
]]></command>
<inputs>
<param argument="--checkm" type="data" format="tabular" label="CheckM results"/>
Comment thread
bernt-matthias marked this conversation as resolved.
Outdated
<param argument="--checkm2" type="data" format="tabular" label="CheckM2 results"/>

<conditional name="mode_cond">
<param name="mode" type="select" label="Plot mode">
<option value="quality" selected="true">quality</option>
<option value="tax">tax</option>
<option value="meta">meta</option>
</param>
<when value="quality"/>

<when value="tax">
<param argument="--gtdb" type="data" format="tabular" label="GTDB annotation table"/>
<param argument="--tax_level" type="select" label="Taxonomic level">
<option value="domain">domain</option>
<option value="phylum" selected="true">phylum</option>
<option value="class">class</option>
<option value="order">order</option>
<option value="family">family</option>
<option value="genus">genus</option>
<option value="species">species</option>
</param>
</when>

<when value="meta">
<param argument="--metadata" type="data" format="tabular" label="Metadata table"/>
<param name="meta_col" type="data_column"
data_ref="metadata"
label="Metadata column"
use_header_names="true"
help="Select the column to color by"/>
<param name="meta_bin_width" type="float" value="5.0" min="0.1" label="Bin width for numeric metadata"/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs more explanation

</when>
</conditional>

<param argument="--top_n" type="integer" value="30" min="1" label="Top N groups"
help="Number of most abundant groups to display (taxonomic groups or metadata categories)"/>

<param argument="--format" type="select" label="Output format">
<option value="png" selected="true">png</option>
<option value="pdf">pdf</option>
<option value="svg">svg</option>
</param>
<section name="fig_size" title="Figure size" expanded="false">
<param name="width" type="float" optional="true" min="1" label="Figure width"/>
<param name="height" type="float" optional="true" min="1" label="Figure height"/>
</section>
</inputs>
<outputs>
<collection name="plots" type="list">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you do not need collection output here, since each tool produces only one output afaik, since file name are variable you could do

cp outputs/${dynamic_name}.png outputs/final_plot.png

on the command line and then

<data name="plot" format="png" from_work_dir="outputs/final_plot.png"/>

Please adapt for all tools.

<discover_datasets directory="outputs" pattern="(?P&lt;designation&gt;.+)\.(?P&lt;ext&gt;png|pdf|svg)$" visible="true"/>
</collection>
</outputs>
<tests>
<test expect_num_outputs="1">
<param name="checkm" value="checkm.tsv"/>
<param name="checkm2" value="checkm2.tsv"/>
<param name="format" value="png"/>
<output_collection name="plots" type="list">
<element name="comp_conta_marginals_checkm" ftype="png">
<assert_contents>
<has_size min="100000"/>
<has_image_width min="1500"/>
<has_image_height min="1200"/>
</assert_contents>
</element>
<element name="comp_conta_marginals_checkm2" ftype="png">
<assert_contents>
<has_size min="100000"/>
<has_image_width min="1500"/>
<has_image_height min="1200"/>
</assert_contents>
</element>
</output_collection>
</test>
<test expect_num_outputs="1">
<param name="checkm" value="checkm.tsv"/>
<param name="checkm2" value="checkm2.tsv"/>
<param name="mode_cond|mode" value="tax"/>
<param name="mode_cond|gtdb" value="gtdb.tsv"/>
<param name="mode_cond|tax_level" value="phylum"/>
<param name="format" value="pdf"/>
<output_collection name="plots" type="list">
<element name="comp_conta_by_rank_marginals_CheckM2" ftype="pdf">
<assert_contents>
<has_size min="30000"/>
</assert_contents>
</element>
</output_collection>
</test>
<test expect_num_outputs="1">
<param name="checkm" value="checkm.tsv"/>
<param name="checkm2" value="checkm2.tsv"/>
<param name="mode_cond|mode" value="meta"/>
<param name="mode_cond|metadata" value="metadata.tsv"/>
<param name="mode_cond|meta_col" value="6"/>
<param name="mode_cond|meta_bin_width" value="5.0"/>
<param name="format" value="svg"/>
<output_collection name="plots" type="list">
<element name="comp_conta_by_Infection_by_Nosema_ceranae_marginals_CheckM" ftype="svg">
<assert_contents>
<has_size min="100000"/>
<has_text text="Contamination (%)"/>
<has_text text="Completeness (%)"/>
<has_text text="% of MAGs"/>
</assert_contents>
</element>
<element name="comp_conta_by_Infection_by_Nosema_ceranae_marginals_CheckM2" ftype="svg">
<assert_contents>
<has_size min="100000"/>
<has_text text="Contamination (%)"/>
<has_text text="Completeness (%)"/>
<has_text text="% of MAGs"/>
</assert_contents>
</element>
</output_collection>
</test>
</tests>
<help><![CDATA[
**MAGs-visualization: comp-conta**

This tool visualizes MAG quality by plotting genome completeness against contamination using CheckM/ CheckM2 results.

Available modes:

- **quality**:
MAGs are colored by quality category based on completeness and contamination thresholds (high, medium, low).
This provides an overview of the overall quality distribution of the dataset.

- **tax**:
MAGs are colored by taxonomic classification (e.g. phylum) using GTDB annotations.
This allows comparison of MAG quality across different taxonomic groups

- **meta**:
MAGs are colored based on a user-defined metadata column (e.g. treatment).
This shows how MAG quality relates to experimental conditions or sample metadata.

Requirements:

- CheckM / CheckM2 tables
- GTDB annotations (tax mode)
- Metadata table (meta mode)

Output:

- Scatter plots of completeness vs contamination with optional grouping

Example output plots are available in the MAGs-visualization use cases with example configurations and parameter choices:
https://github.com/usegalaxy-eu/MAGs-visualization/tree/main/use-cases

For a direct example (bee microbiome dataset):
https://github.com/usegalaxy-eu/MAGs-visualization/tree/main/use-cases/bee-use-case/plots
]]></help>
<expand macro="citation"/>
</tool>
140 changes: 140 additions & 0 deletions tools/mags_visualization/drep_cluster_annot.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<tool id="mags_visualization_drep_cluster_annot" name="MAGs-visualization drep-cluster-annot" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
<description>Create a dRep cluster plot with optional annotation</description>
<macros>
<import>macros.xml</import>
</macros>
<expand macro="requirements"/>
<expand macro="version_command"/>
<command detect_errors="exit_code"><![CDATA[
mags-visualization drep-cluster-annot
--drep '$drep'
--gtdb '$gtdb'
--top_n '$top_n'
--tax_levels_space '$tax_levels_space'
--format '$format'

#if $checkm2
--checkm2 '$checkm2'
#end if

#if $quast
--quast '$quast'
#end if

#if $bakta
--bakta '$bakta'
#end if

#if $tax_levels
--tax_levels
#for $tl in $tax_levels
'$tl'
#end for
#end if

#if str($fig_size.width) != "" and str($fig_size.height) != ""
--fig_size '$fig_size.width' '$fig_size.height'
#end if

-o outputs
]]></command>
<inputs>
<param argument="--drep" type="data" format="csv,tabular" label="dRep cluster table"/>
<param argument="--gtdb" type="data" format="tabular" label="GTDB annotation table"/>
<param argument="--checkm2" type="data" format="tabular" optional="true" label="CheckM2 table (optional)"/>
<param argument="--quast" type="data" format="tabular" optional="true" label="QUAST table (optional)"/>
<param argument="--bakta" type="data" format="tabular" optional="true" label="Bakta table (optional)"/>
<param argument="--tax_levels" type="select" multiple="true" label="Taxonomy levels">
<option value="domain">domain</option>
<option value="phylum" selected="true">phylum</option>
<option value="class">class</option>
<option value="order">order</option>
<option value="family">family</option>
<option value="genus" selected="true">genus</option>
<option value="species">species</option>
</param>
<param argument="--top_n" type="integer" value="30" min="1" label="Top N clusters"/>
<param argument="--tax_levels_space" type="float" value="0.3" min="0.1" max="2.0" label="Spacing between taxonomy columns"/>
<param argument="--format" type="select" label="Output format">
<option value="png" selected="true">png</option>
<option value="pdf">pdf</option>
<option value="svg">svg</option>
</param>
<section name="fig_size" title="Figure size" expanded="false">
<param name="width" type="float" optional="true" min="1" label="Figure width"/>
<param name="height" type="float" optional="true" min="1" label="Figure height"/>
</section>
</inputs>
<outputs>
<collection name="plots" type="list">
<discover_datasets directory="outputs" pattern="(?P&lt;designation&gt;.+)\.(?P&lt;ext&gt;png|pdf|svg)$" visible="true"/>
</collection>
</outputs>
<tests>
<test expect_num_outputs="1">
<param name="drep" value="drep.csv"/>
<param name="gtdb" value="gtdb.tsv"/>
<param name="format" value="png"/>
<param name="top_n" value="30"/>
<param name="tax_levels" value="phylum,genus"/>
<output_collection name="plots" type="list">
<element name="drep_cluster_top30_phylum-genus" ftype="png">
<assert_contents>
<has_size min="500000"/>
<has_image_width min="3300"/>
<has_image_height min="2100"/>
</assert_contents>
</element>
</output_collection>
</test>
<test expect_num_outputs="1">
<param name="drep" value="drep.csv"/>
<param name="gtdb" value="gtdb.tsv"/>
<param name="checkm2" value="checkm2.tsv"/>
<param name="quast" value="quast.tsv"/>
<param name="bakta" value="bakta.tsv"/>
<param name="format" value="png"/>
<param name="top_n" value="30"/>
<param name="tax_levels" value="phylum,genus"/>
<output_collection name="plots" type="list">
<element name="drep_cluster_top30_phylum-genus" ftype="png">
<assert_contents>
<has_size min="600000"/>
<has_image_width min="3400"/>
<has_image_height min="2100"/>
</assert_contents>
</element>
</output_collection>
</test>
</tests>
<help><![CDATA[
**MAGs-visualization: drep-cluster-annot**

This tool visualizes genome clusters generated by dRep and annotates them using GTDB taxonomy.

Clusters are grouped by taxonomic levels (e.g. phylum, genus) based on representative genomes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are they grouped ?


Optional annotations can be included:

- CheckM2 (genome quality)
- QUAST (assembly statistics)
- Bakta (annotation summaries)

Requirements:

- dRep clustering table
- GTDB taxonomy table

Output:

- Cluster plots with taxonomic grouping and optional annotations


Example output plots are available in the MAGs-visualization use cases with example configurations and parameter choices:
https://github.com/usegalaxy-eu/MAGs-visualization/tree/main/use-cases

For a direct example (bee microbiome dataset):
https://github.com/usegalaxy-eu/MAGs-visualization/tree/main/use-cases/bee-use-case/plots
]]></help>
<expand macro="citation"/>
</tool>
Loading
Loading