view extract_ipm_date_interval.xml @ 0:1868b7913590 draft

Uploaded
author greg
date Tue, 07 Aug 2018 13:05:10 -0400
parents
children b03291d5a842
line wrap: on
line source

<tool id="ipm_date_interval" name="Extract date interval" version="1.1.0">
    <description>from insect phenology model data</description>
    <requirements>
        <requirement type="package" version="1.10.4">r-data.table</requirement>
        <requirement type="package" version="2.2.6">r-hash</requirement>
        <requirement type="package" version="1.4.4">r-optparse</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
#import os
#set input_data_dir = 'input_data_dir'
#set output_data_dir = "output_data_dir"
#set output_plots_dir = "output_plots_dir"
#set error_file = $os.path.join($output_data_dir, "04_combined_generations.csv")
#set job = $input_data[0].creating_job
#set tool_parameters = ""
#for $p in $job.parameters:
    #set tool_parameters = $tool_parameters + "__SeP__" + $p.name
    #set tool_parameters = $tool_parameters + "__SeP__" + $p.value
#end for
mkdir $input_data_dir &&
mkdir output_data_dir &&
mkdir output_plots_dir &&
#for $i in $input_data:
    #set filename = $i.file_name
    #set name = $i.name
    ln -s $filename $input_data_dir/$name &&
#end for
Rscript '$__tool_directory__/extract_ipm_date_interval.R'
--end_date '$end_date'
--input_data_dir '$input_data_dir'
--script_dir '$__tool_directory__'
--start_date '$start_date'
--tool_parameters '$tool_parameters'
&>eipmdi_log.txt;
if [[ $? -ne 0 ]]; then
    cp eipmdi_log.txt '$error_file';
    exit 1;
fi]]></command>
    <inputs>
        <param name="input_data" type="data_collection" format="csv" collection_type="list" label="Insect phenology model data files" />
        <param name="start_date" type="text" value="" label="Start date" help="Format must be yyyy-mm-dd">
            <validator type="expression" message="Date must have the format yyyy-mm-dd">len(value.split('-')[0])==4 and int(value.split('-')[0]) and len(value.split('-')[1])==2 and int(value.split('-')[1]) and len(value.split('-')[2])==2 and int(value.split('-')[2])</validator>
        </param>
        <param name="end_date" type="text" value="" label="End date" help="Format must be yyyy-mm-dd">
            <validator type="expression" message="Date must have the format yyyy-mm-dd">len(value.split('-')[0])==4 and int(value.split('-')[0]) and len(value.split('-')[1])==2 and int(value.split('-')[1]) and len(value.split('-')[2])==2 and int(value.split('-')[2])</validator>
        </param>
    </inputs>
    <outputs>
        <collection name="output_data_collection" type="list" label="${tool.name} (data), on ${on_string}">
            <discover_datasets pattern="__name__" directory="output_data_dir" format="csv"/>
        </collection>
        <collection name="output_plot_collection" type="list" label="${tool.name} (plots), on ${on_string}">
            <discover_datasets pattern="__name__" directory="output_plots_dir" format="pdf"/>
        </collection>
    </outputs>
    <tests>
        <test>
            <!--
            FIXME: Here is a sort of layout for a test, but since the input collection will be uploaded, the test
            will fail bacused the job parameters for the inputs will not be those produced by the insect_phenology_model
            tool.  Testing this tool will require using the workflow testing approach.
            <param name="input_data">
                <collection type="list">
                    <element name="input_p_1.csv" value="input_p_1.csv" ftype="csv"/>
                    <element name="input_f1_1.csv" value="input_f1_1.csv" ftype="csv"/>
                    <element name="input_f2_1.csv" value="input_f2_1.csv" ftype="csv"/>
                    <element name="input_combined1.csv" value="input_combined1.csv" ftype="csv"/>
                </collection>
            </param>
            <param name="start_date" value="2017-04-01"/>
            <param name="end_date" value="2017-04-15"/>
            <output_collection name="output_data_collection" type="list">
                <element name="01_generation_P.csv" file="output_p_1.csv" ftype="csv" compare="contains"/>
                <element name="02_generation_F1.csv" file="output_f1_1.csv" ftype="csv" compare="contains"/>
                <element name="03_generation_F2.csv" file="output_f2_1.csv" ftype="csv" compare="contains"/>
                <element name="04_combined_generations.csv" file="output_combined1.csv" ftype="csv" compare="contains"/>
            </output_collection>
            <output_collection name="output_plot_collection" type="list">
                <element name="01_egg_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
                <element name="04_total_nymph_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
                <element name="08_total_adult_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
                <element name="09_total_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
            </output_collection>
            -->
        </test>
    </tests>
    <help>
**What it does**

Provides an agent-based stochastic model expressing stage-specific phenology and population dynamics for an insect species across geographic regions.

-----

**Required options**

 * **Plot standard error** - add standard error lines to plot.
    </help>
    <citations>
        <citation type="doi">10.3389/fphys.2016.00165</citation>
        <citation type="doi">10.1175/JTECH-D-11-00103.1</citation>
        <citation type="doi">10.7289/V5D21VHZ</citation>
    </citations>
</tool>