diff freyja_aggregate_plot.xml @ 0:0ceb9fb0f4ce draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/freyja commit 2036e233d159a5c4b3b06ce6a681531259098f73
author iuc
date Thu, 28 Jul 2022 09:25:04 +0000
parents
children 1f89eeba299a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/freyja_aggregate_plot.xml	Thu Jul 28 09:25:04 2022 +0000
@@ -0,0 +1,345 @@
+<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>
+            </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"/>
+            </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>
+            </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_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"/>
+            </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>
+            <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="This is title"/>
+                <param name="plot_intro" value="Local WW Dashboard"/>
+            </conditional>
+            <output name="aggregated" ftype="tabular">
+                <assert_contents>
+                    <has_text text="summarized"/>
+                    <has_text text="abundances"/>
+                    <has_text text="B.1.617.2"/>
+                </assert_contents>
+            </output>
+            <output name="abundances_dashboard" ftype="html">
+                <assert_contents>
+                    <has_text text="Local WW 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_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="This is title"/>
+                <param name="plot_intro" value="Local WW Dashboard"/>
+                <param name="interval" value="D"/>
+            </conditional>
+            <output name="aggregated" ftype="tabular">
+                <assert_contents>
+                    <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>
+            <output name="abundances_dashboard" ftype="html">
+                <assert_contents>
+                    <has_text text="Local WW Dashboard"/>
+                </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 this form:
+
+*Sample,sample_collection_datetime*  
+
+*sample_0.tsv,03/01/21*  
+
+*sample_1.tsv,03/03/21*  
+ 
+*sample_2.tsv,03/08/21*  
+
+*sample_3.tsv,03/10/21*  
+
+*sample_4.tsv,03/12/21*  
+
+*sample_5.tsv,03/14/21*  
+
+*sample_6.tsv,03/17/21*  
+
+*sample_7.tsv,03/20/21*  
+
+*sample_8.tsv,03/25/21*  
+
+*sample_9.tsv,03/30/21*  
+
+*sample_10.tsv,03/31/21*  
+
+*sample_11.tsv,04/04/21*
+
+
+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*  
+
+*sample_4.tsv,03/12/21,658923.9*  
+
+*sample_5.tsv,03/14/21,500432.8*  
+
+*sample_6.tsv,03/17/21,791406.4*  
+
+*sample_7.tsv,03/20/21,628119.9*  
+
+*sample_8.tsv,03/25/21,810673.9*  
+
+*sample_9.tsv,03/30/21,1263564.4*  
+
+*sample_10.tsv,03/31/21,1627556.3*  
+
+*sample_11.tsv,04/04/21,1528006.4*
+
+
+    ]]></help>
+    <expand macro="citations"/>
+</tool>