annotate extract_ipm_date_interval.xml @ 5:d62034b36200 draft default tip

Uploaded
author greg
date Thu, 09 Aug 2018 10:15:32 -0400
parents 2c517a58544c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1868b7913590 Uploaded
greg
parents:
diff changeset
1 <tool id="ipm_date_interval" name="Extract date interval" version="1.1.0">
1868b7913590 Uploaded
greg
parents:
diff changeset
2 <description>from insect phenology model data</description>
1868b7913590 Uploaded
greg
parents:
diff changeset
3 <requirements>
1868b7913590 Uploaded
greg
parents:
diff changeset
4 <requirement type="package" version="1.10.4">r-data.table</requirement>
1868b7913590 Uploaded
greg
parents:
diff changeset
5 <requirement type="package" version="2.2.6">r-hash</requirement>
1868b7913590 Uploaded
greg
parents:
diff changeset
6 <requirement type="package" version="1.4.4">r-optparse</requirement>
1868b7913590 Uploaded
greg
parents:
diff changeset
7 </requirements>
1868b7913590 Uploaded
greg
parents:
diff changeset
8 <command detect_errors="exit_code"><![CDATA[
1868b7913590 Uploaded
greg
parents:
diff changeset
9 #import os
1868b7913590 Uploaded
greg
parents:
diff changeset
10 #set input_data_dir = 'input_data_dir'
1868b7913590 Uploaded
greg
parents:
diff changeset
11 #set output_data_dir = "output_data_dir"
1868b7913590 Uploaded
greg
parents:
diff changeset
12 #set output_plots_dir = "output_plots_dir"
1868b7913590 Uploaded
greg
parents:
diff changeset
13 #set error_file = $os.path.join($output_data_dir, "04_combined_generations.csv")
1868b7913590 Uploaded
greg
parents:
diff changeset
14 #set job = $input_data[0].creating_job
1868b7913590 Uploaded
greg
parents:
diff changeset
15 #set tool_parameters = ""
1868b7913590 Uploaded
greg
parents:
diff changeset
16 #for $p in $job.parameters:
1868b7913590 Uploaded
greg
parents:
diff changeset
17 #set tool_parameters = $tool_parameters + "__SeP__" + $p.name
1868b7913590 Uploaded
greg
parents:
diff changeset
18 #set tool_parameters = $tool_parameters + "__SeP__" + $p.value
1868b7913590 Uploaded
greg
parents:
diff changeset
19 #end for
1868b7913590 Uploaded
greg
parents:
diff changeset
20 mkdir $input_data_dir &&
1868b7913590 Uploaded
greg
parents:
diff changeset
21 mkdir output_data_dir &&
1868b7913590 Uploaded
greg
parents:
diff changeset
22 mkdir output_plots_dir &&
1868b7913590 Uploaded
greg
parents:
diff changeset
23 #for $i in $input_data:
1868b7913590 Uploaded
greg
parents:
diff changeset
24 #set filename = $i.file_name
1868b7913590 Uploaded
greg
parents:
diff changeset
25 #set name = $i.name
1868b7913590 Uploaded
greg
parents:
diff changeset
26 ln -s $filename $input_data_dir/$name &&
1868b7913590 Uploaded
greg
parents:
diff changeset
27 #end for
1868b7913590 Uploaded
greg
parents:
diff changeset
28 Rscript '$__tool_directory__/extract_ipm_date_interval.R'
1868b7913590 Uploaded
greg
parents:
diff changeset
29 --end_date '$end_date'
1868b7913590 Uploaded
greg
parents:
diff changeset
30 --input_data_dir '$input_data_dir'
1868b7913590 Uploaded
greg
parents:
diff changeset
31 --script_dir '$__tool_directory__'
1868b7913590 Uploaded
greg
parents:
diff changeset
32 --start_date '$start_date'
1868b7913590 Uploaded
greg
parents:
diff changeset
33 --tool_parameters '$tool_parameters'
1868b7913590 Uploaded
greg
parents:
diff changeset
34 &>eipmdi_log.txt;
1868b7913590 Uploaded
greg
parents:
diff changeset
35 if [[ $? -ne 0 ]]; then
1868b7913590 Uploaded
greg
parents:
diff changeset
36 cp eipmdi_log.txt '$error_file';
1868b7913590 Uploaded
greg
parents:
diff changeset
37 exit 1;
1868b7913590 Uploaded
greg
parents:
diff changeset
38 fi]]></command>
1868b7913590 Uploaded
greg
parents:
diff changeset
39 <inputs>
1868b7913590 Uploaded
greg
parents:
diff changeset
40 <param name="input_data" type="data_collection" format="csv" collection_type="list" label="Insect phenology model data files" />
1868b7913590 Uploaded
greg
parents:
diff changeset
41 <param name="start_date" type="text" value="" label="Start date" help="Format must be yyyy-mm-dd">
1868b7913590 Uploaded
greg
parents:
diff changeset
42 <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>
1868b7913590 Uploaded
greg
parents:
diff changeset
43 </param>
2
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
44 <param name="end_date" type="text" value="" label="End date" help="Format must be yyyy-mm-dd, and the date must be between 1 and 50 days after the start date">
0
1868b7913590 Uploaded
greg
parents:
diff changeset
45 <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>
1868b7913590 Uploaded
greg
parents:
diff changeset
46 </param>
1868b7913590 Uploaded
greg
parents:
diff changeset
47 </inputs>
1868b7913590 Uploaded
greg
parents:
diff changeset
48 <outputs>
1868b7913590 Uploaded
greg
parents:
diff changeset
49 <collection name="output_data_collection" type="list" label="${tool.name} (data), on ${on_string}">
1868b7913590 Uploaded
greg
parents:
diff changeset
50 <discover_datasets pattern="__name__" directory="output_data_dir" format="csv"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
51 </collection>
1868b7913590 Uploaded
greg
parents:
diff changeset
52 <collection name="output_plot_collection" type="list" label="${tool.name} (plots), on ${on_string}">
1868b7913590 Uploaded
greg
parents:
diff changeset
53 <discover_datasets pattern="__name__" directory="output_plots_dir" format="pdf"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
54 </collection>
1868b7913590 Uploaded
greg
parents:
diff changeset
55 </outputs>
1868b7913590 Uploaded
greg
parents:
diff changeset
56 <tests>
1868b7913590 Uploaded
greg
parents:
diff changeset
57 <test>
1868b7913590 Uploaded
greg
parents:
diff changeset
58 <!--
1868b7913590 Uploaded
greg
parents:
diff changeset
59 FIXME: Here is a sort of layout for a test, but since the input collection will be uploaded, the test
1868b7913590 Uploaded
greg
parents:
diff changeset
60 will fail bacused the job parameters for the inputs will not be those produced by the insect_phenology_model
1868b7913590 Uploaded
greg
parents:
diff changeset
61 tool. Testing this tool will require using the workflow testing approach.
1868b7913590 Uploaded
greg
parents:
diff changeset
62 <param name="input_data">
1868b7913590 Uploaded
greg
parents:
diff changeset
63 <collection type="list">
1868b7913590 Uploaded
greg
parents:
diff changeset
64 <element name="input_p_1.csv" value="input_p_1.csv" ftype="csv"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
65 <element name="input_f1_1.csv" value="input_f1_1.csv" ftype="csv"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
66 <element name="input_f2_1.csv" value="input_f2_1.csv" ftype="csv"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
67 <element name="input_combined1.csv" value="input_combined1.csv" ftype="csv"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
68 </collection>
1868b7913590 Uploaded
greg
parents:
diff changeset
69 </param>
1868b7913590 Uploaded
greg
parents:
diff changeset
70 <param name="start_date" value="2017-04-01"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
71 <param name="end_date" value="2017-04-15"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
72 <output_collection name="output_data_collection" type="list">
1868b7913590 Uploaded
greg
parents:
diff changeset
73 <element name="01_generation_P.csv" file="output_p_1.csv" ftype="csv" compare="contains"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
74 <element name="02_generation_F1.csv" file="output_f1_1.csv" ftype="csv" compare="contains"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
75 <element name="03_generation_F2.csv" file="output_f2_1.csv" ftype="csv" compare="contains"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
76 <element name="04_combined_generations.csv" file="output_combined1.csv" ftype="csv" compare="contains"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
77 </output_collection>
1868b7913590 Uploaded
greg
parents:
diff changeset
78 <output_collection name="output_plot_collection" type="list">
1868b7913590 Uploaded
greg
parents:
diff changeset
79 <element name="01_egg_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
80 <element name="04_total_nymph_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
81 <element name="08_total_adult_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
82 <element name="09_total_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
1868b7913590 Uploaded
greg
parents:
diff changeset
83 </output_collection>
1868b7913590 Uploaded
greg
parents:
diff changeset
84 -->
1868b7913590 Uploaded
greg
parents:
diff changeset
85 </test>
1868b7913590 Uploaded
greg
parents:
diff changeset
86 </tests>
1868b7913590 Uploaded
greg
parents:
diff changeset
87 <help>
1868b7913590 Uploaded
greg
parents:
diff changeset
88 **What it does**
1868b7913590 Uploaded
greg
parents:
diff changeset
89
2
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
90 Extracts a date interval from the data produced by the Insect Phenology Model tool, providing a "zoomed in" view of the plots.
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
91
5
d62034b36200 Uploaded
greg
parents: 4
diff changeset
92 The Insect Phenology Model tool produces 2 dataset collections, one consisting of the the analyzed data files and another consisting
2
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
93 of plots based on the data files. The data consists of a complete year, and the X axis displays weekly tick marks (on Sundays)
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
94 as well as the first day of each month.
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
95
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
96 This tool accepts the Insect Phenology Model collection of data files as input and extracts the user-specified date interval from
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
97 the files, producing a collection of data files with the same names, but containing only the extracted date interval. A collection
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
98 of plots is also produced, each with the same name as those produced by the Insect Phenology Model tool, but restricted to the
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
99 date interval, which is cannot be more than 50 days. The X axis displays daily tick marks, essentially zooming in on the original
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
100 data.
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
101
5
d62034b36200 Uploaded
greg
parents: 4
diff changeset
102 This tool inspects the parameter values that were specified when the Insect Phenology Model tool was executed in order to
2
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
103 generate the plots, so it is essential that the dataset collection selected as the input to this tool was produced by the
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
104 Insect Phenology Model tool.
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
105
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
106 -----
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
107
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
108 **Required options**
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
109
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
110 * **Insect phenology model data files** - select the collection of data files produced by the Insect Phenology Model tool.
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
111 * **Start date** - enter a start date for the interval using the format YYYY-MM-DD, making sure that the year coincides with the selected collection of input data files.
b03291d5a842 Uploaded
greg
parents: 0
diff changeset
112 * **End date** - enter an end date for the interval using the format YYYY-MM-DD which is between 1 and 50 days after the start date.
0
1868b7913590 Uploaded
greg
parents:
diff changeset
113 </help>
1868b7913590 Uploaded
greg
parents:
diff changeset
114 <citations>
1868b7913590 Uploaded
greg
parents:
diff changeset
115 <citation type="doi">10.3389/fphys.2016.00165</citation>
1868b7913590 Uploaded
greg
parents:
diff changeset
116 <citation type="doi">10.1175/JTECH-D-11-00103.1</citation>
1868b7913590 Uploaded
greg
parents:
diff changeset
117 <citation type="doi">10.7289/V5D21VHZ</citation>
1868b7913590 Uploaded
greg
parents:
diff changeset
118 </citations>
1868b7913590 Uploaded
greg
parents:
diff changeset
119 </tool>