view freyja_aggregate_plot.xml @ 3:54acd5139cab draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/freyja commit 79a21a9a4a63e538f2ba0bc29384593df2c65859
author iuc
date Fri, 15 Nov 2024 16:44:42 +0000
parents 1f89eeba299a
children
line wrap: on
line source

<tool id="freyja_aggregate_plot" name="Freyja: Aggregate and visualize"
      version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@"
      profile="@PROFILE@">
    <description>
        demixed results
    </description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="biotools"/>
    <expand macro="requirements"/>
    <expand macro="version"/>
    <command detect_errors="exit_code"><![CDATA[
#if $need_aggregation.choice == 'yes'
    #set demix_dir = 'demix_outputs/'
    #set file_paths1 = []
    mkdir -p demix_outputs &&
    #for $input_file in $demix_file
        #set $file_path = $demix_dir + $input_file.element_identifier
        ln -s '$input_file' '$file_path' &&
        $file_paths1.append($file_path)
    #end for
    freyja aggregate
        '$demix_dir'
        --output aggregated.tsv
    #if $plot_format.choice != 'none'
        &&
    #end if
#end if
@PLOT_AND_DASH_COMMAND@
    ]]></command>
    <inputs>
        <conditional name="need_aggregation">
            <param name="choice" type="select"
                   label="Aggregate demixed data or provide aggregated data file?">
                <option value="yes">aggregate demixed data</option>
                <option value="no">provide aggregated data file</option>
            </param>
            <when value="yes">
                <param name="demix_file" type="data" format="tabular" multiple="true"
                       label="Lineages abundances summary file(s)" help="One file per one sample."/>
            </when>
            <when value="no">
                <param name="tsv_aggregated" type="data" format="tabular"
                       label="Provide aggregated data"/>
            </when>
        </conditional>
        <conditional name="plot_format">
            <param name="choice" type="select" label="Report(s) to generate">
                <option value="plot">non-interactive plot</option>
                <option value="dash">interactive dashboard (html)</option>
                <option value="plot_and_dash">plot and dashboard</option>
                <option value="none">no plots, just aggregated data table</option>
            </param>
            <when value="plot">
                <conditional name="need_metadata">
                    <param name="choice" type="select"
                           label="Provide a sample metadata file for plotting data over time?">
                        <option value="yes">Yes</option>
                        <option value="no">No</option>
                    </param>
                    <when value="yes">
                        <param name="csv_meta" type="data" format="csv"
                               label="Provide time(s) metadata file"
                               help="See info box below to learn more about the form of meta-file. Accepts only CSV (.csv) files"/>
                        <param name="interval" type="select" label="Choose interval" display="radio"
                               help="Used for pdf format.">
                            <option value="MS" selected="true">month bins</option>
                            <option value="D">day bins</option>
                        </param>
                    </when>
                    <when value="no"/>
                </conditional>
                <expand macro="plot_lineages"/>
                <expand macro="plot_mincov"/>
            </when>
            <when value="dash">
                <param name="csv_meta" type="data" format="csv"
                       label="Provide sample(s) metadata file"
                       help="See info box below to learn more about the form of meta-file. Accepts only CSV (.csv) files"/>
                <param name="plot_title" type="text" value="" optional="true" label="Title"/>
                <param name="plot_intro" type="text" value="" optional="true" label="Introduction"/>
                <expand macro="plot_mincov"/>
            </when>
            <when value="plot_and_dash">
                <param name="csv_meta" type="data" format="csv"
                       label="Provide sample(s)/time(s) metadata file"
                       help="See info box below to learn more about the form of meta-file. Accepts only CSV (.csv) files"/>
                <param name="plot_title" type="text" value="" optional="true" label="Title"
                       help="Used for interactive dashboard."/>
                <param name="plot_intro" type="text" value="" optional="true" label="Introduction"
                       help="Used for interactive dashboard."/>
                <param name="interval" type="select" label="Choose interval" display="radio"
                       help="Used for pdf non-interactive plot.">
                    <option value="MS" selected="true">month bins</option>
                    <option value="D">day bins</option>
                </param>
                <expand macro="plot_lineages"/>
                <expand macro="plot_mincov"/>
            </when>
            <when value="none"/>
        </conditional>
    </inputs>
    <outputs>
        <!-- outputs for aggregate command -->
        <data name="aggregated" format="tabular"
              label="${tool.name} on ${on_string}: Aggregated data"
              from_work_dir="aggregated.tsv">
            <filter>need_aggregation['choice'] == 'yes'</filter>
        </data>
        <!-- outputs for dash command -->
        <data name="abundances_dashboard" format="html"
              label="${tool.name} on ${on_string}: Lineages abundances dashboard"
              from_work_dir="abundances_dashboard.html">
            <filter>plot_format['choice'] == 'dash' or plot_format['choice'] == 'plot_and_dash'
            </filter>
        </data>
        <!-- outputs for plot command -->
        <data name="abundances_plot" format="pdf"
              label="${tool.name} on ${on_string}: Lineages abundances plot"
              from_work_dir="abundances_plot.pdf">
            <filter>plot_format['choice'] == 'plot' or plot_format['choice'] == 'plot_and_dash'
            </filter>
        </data>
    </outputs>
    <tests>
        <!-- Test 01: aggregate command -->
        <test expect_num_outputs="1">
            <conditional name="need_aggregation">
                <param name="choice" value="yes"/>
                <param name="demix_file"
                       value="abundances.tsv,abundances2.tsv,abundances3.tsv,abundances4.tsv"/>
            </conditional>
            <conditional name="plot_format">
                <param name="choice" value="none"/>
            </conditional>
            <output name="aggregated" ftype="tabular">
                <assert_contents>
                    <has_n_columns n="6" />
                    <has_text text="summarized"/>
                    <has_text text="abundances"/>
                    <has_text text="B.1.617.2"/>
                </assert_contents>
            </output>
        </test>
        <!-- Test 02: dash command -->
        <test expect_num_outputs="1">
            <conditional name="need_aggregation">
                <param name="choice" value="no"/>
                <param name="tsv_aggregated" value="bunch_of_files.tsv"/>
            </conditional>
            <conditional name="plot_format">
                <param name="choice" value="dash"/>
                <param name="csv_meta" value="csv_sample_meta.csv"/>
                <param name="plot_title" value="This is title"/>
                <param name="plot_intro" value="Local WW Dashboard"/>
                <param name="mincov" value="75"/>
            </conditional>
            <output name="abundances_dashboard" ftype="html">
                <assert_contents>
                    <has_text text="Local WW Dashboard"/>
                </assert_contents>
            </output>
        </test>
        <!-- Test 03: plot command -->
        <test expect_num_outputs="1">
            <conditional name="need_aggregation">
                <param name="choice" value="no"/>
                <param name="tsv_aggregated" value="bunch_of_files.tsv"/>
            </conditional>
            <conditional name="plot_format">
                <param name="choice" value="plot"/>
                <conditional name="need_metadata">
                    <param name="choice" value="yes"/>
                    <param name="csv_meta" value="times_metadata.csv"/>
                    <param name="interval" value="D"/>
                </conditional>
            </conditional>
            <param name="lineages" value="true"/>
            <output name="abundances_plot" ftype="pdf">
                <assert_contents>
                    <has_text text="Matplotlib"/>
                </assert_contents>
            </output>
        </test>
        <!-- Test 04: aggregate and dash commands -->
        <test expect_num_outputs="2">
            <conditional name="need_aggregation">
                <param name="choice" value="yes"/>
                <param name="demix_file" value="abundances.tsv,abundances2.tsv,abundances3.tsv"/>
            </conditional>
            <conditional name="plot_format">
                <param name="choice" value="dash"/>
                <param name="csv_meta" value="csv_sample_meta2.csv"/>
                <param name="plot_title" value="Title"/>
                <param name="plot_intro" value="Dashboard"/>
            </conditional>
            <output name="aggregated" ftype="tabular">
                <assert_contents>
                    <has_n_columns n="6" />
                    <has_text text="summarized"/>
                </assert_contents>
            </output>
            <output name="abundances_dashboard" ftype="html">
                <assert_contents>
                    <has_text text="Dashboard"/>
                </assert_contents>
            </output>
        </test>
        <!-- Test 05: aggregate and plot commands -->
        <test expect_num_outputs="2">
            <conditional name="need_aggregation">
                <param name="choice" value="yes"/>
                <param name="demix_file" value="abundances.tsv,abundances2.tsv,abundances3.tsv"/>
            </conditional>
            <conditional name="plot_format">
                <param name="choice" value="plot"/>
                <conditional name="need_metadata">
                    <param name="choice" value="yes"/>
                    <param name="csv_meta" value="csv_sample_meta2.csv"/>
                    <param name="interval" value="D"/>
                </conditional>
            </conditional>
            <output name="aggregated" ftype="tabular">
                <assert_contents>
                    <has_n_columns n="6" />
                    <has_text text="summarized"/>
                    <has_text text="abundances"/>
                    <has_text text="B.1.617.2"/>
                </assert_contents>
            </output>
            <output name="abundances_plot" ftype="pdf">
                <assert_contents>
                    <has_text text="Matplotlib"/>
                </assert_contents>
            </output>
        </test>
        <!-- Test 06: aggregate, dash and plot commands -->
        <test expect_num_outputs="3">
            <conditional name="need_aggregation">
                <param name="choice" value="yes"/>
                <param name="demix_file" value="abundances.tsv,abundances2.tsv,abundances3.tsv"/>
            </conditional>
            <conditional name="plot_format">
                <param name="choice" value="plot_and_dash"/>
                <param name="csv_meta" value="csv_sample_meta2.csv"/>
                <param name="plot_title" value="Title"/>
                <param name="plot_intro" value="Dashboard"/>
                <param name="interval" value="D"/>
            </conditional>
            <output name="aggregated" ftype="tabular">
                <assert_contents>
                    <has_n_columns n="6" />
                    <has_text text="summarized"/>
                </assert_contents>
            </output>
            <output name="abundances_plot" ftype="pdf">
                <assert_contents>
                    <has_text text="Matplotlib"/>
                </assert_contents>
            </output>
            <output name="abundances_dashboard" ftype="html">
                <assert_contents>
                    <has_text text="Dash"/>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
@HELP_HEADER@

Information about **freyja aggregate** method
=============================================

Method for manipulating the "demixed" output files.

Outputs
-------

This resulting aggregated data can analyzed directly as a tsv file, or can be visualized using *freyja plot* and *freyja dash*.

Information about **freyja plot** method
========================================

Method provides a fractional abundance estimate for all aggregated samples.

A **time(s) metadata CSV file** should have *Sample,sample_collection_datetime* form:

*sample_0.tsv,03/01/21*

*sample_1.tsv,03/03/21*

*sample_2.tsv,03/08/21*

*sample_3.tsv,03/10/21*

or *Sample,sample_collection_datetime,viral_load* form:

*sample_0.tsv,03/01/21,460326*

*sample_1.tsv,03/03/21,176645.1*

*sample_2.tsv,03/08/21,449891.7*

*sample_3.tsv,03/10/21,361699.5*


Note: sample_collection_datetime can have either *MM/DD/YY* or *YYYY-MM-DD* format.


Information about **freyja dash** method
========================================

Functionality to rapidly prepare a dashboard web page, directly from aggregated freyja output.

A **sample(s) metadata CSV file** should have this form:

*Sample,sample_collection_datetime,viral_load*

*sample_0.tsv,03/01/21,460326*

*sample_1.tsv,03/03/21,176645.1*

*sample_2.tsv,03/08/21,449891.7*

*sample_3.tsv,03/10/21,361699.5*


Note: sample_collection_datetime can have either *MM/DD/YY* or *YYYY-MM-DD* format.


    ]]></help>
    <expand macro="citations"/>
</tool>