3
+ − 1 <tool id="insect_phenology_model" name="Insect phenology model" version="1.1.0">
0
+ − 2 <description>expressing stage-specific phenology and population dynamics</description>
+ − 3 <requirements>
4
+ − 4 <requirement type="package" version="1.4.4">r-optparse</requirement>
0
+ − 5 </requirements>
2
+ − 6 <command detect_errors="exit_code"><![CDATA[
33
+ − 7 #import os
+ − 8 #set output_data_dir = "output_data_dir"
+ − 9 #set output_plots_dir = "output_plots_dir"
+ − 10 #set error_file = $os.path.join($output_data_dir, "04_combined_generations.csv")
48
+ − 11 #set custom_date_interval = $custom_date_interval_cond.custom_date_interval
17
+ − 12 #set life_stages = list()
13
+ − 13 #set plot_adult_life_stage = $plot_adult_life_stage_cond.plot_adult_life_stage
+ − 14 #set plot_nymph_life_stage = $plot_nymph_life_stage_cond.plot_nymph_life_stage
17
+ − 15 #if str($plot_egg_life_stage) == "yes":
+ − 16 $life_stages.append("Egg")
+ − 17 #end if
+ − 18 #if str($plot_nymph_life_stage) == "yes":
+ − 19 $life_stages.append("Nymph")
+ − 20 #end if
+ − 21 #if str($plot_adult_life_stage) == "yes":
+ − 22 $life_stages.append("Adult")
+ − 23 #end if
13
+ − 24 #if str($plot_egg_life_stage) == "yes" and str($plot_nymph_life_stage) == "yes" and str($plot_adult_life_stage) == "yes":
17
+ − 25 $life_stages.append("Total")
13
+ − 26 #end if
17
+ − 27 #set life_stages = ",".join($life_stages)
33
+ − 28 mkdir output_data_dir &&
+ − 29 mkdir output_plots_dir &&
0
+ − 30 Rscript '$__tool_directory__/insect_phenology_model.R'
6
+ − 31 --adult_mortality $adult_mortality
+ − 32 --adult_accumulation $adult_accumulation
+ − 33 --egg_mortality $egg_mortality
42
+ − 34 #if str($merge_ytd_temperature_data_cond.merge_ytd_temperature_data) == "yes":
+ − 35 --input_ytd '$merge_ytd_temperature_data_cond.input_ytd'
44
+ − 36 --location '$merge_ytd_temperature_data_cond.location'
+ − 37 --num_days_ytd $merge_ytd_temperature_data_cond.input_ytd.metadata.data_lines
42
+ − 38 #end if
37
+ − 39 --input_norm '$input_norm'
6
+ − 40 --insect '$insect'
+ − 41 --insects_per_replication $insects_per_replication
17
+ − 42 --life_stages '$life_stages'
+ − 43 #if str($plot_adult_life_stage) == "yes":
+ − 44 --life_stages_adult '$plot_adult_life_stage_cond.life_stages_adult'
9
+ − 45 #end if
17
+ − 46 #if str($plot_nymph_life_stage) == "yes":
+ − 47 --life_stages_nymph '$plot_nymph_life_stage_cond.life_stages_nymph'
9
+ − 48 #end if
6
+ − 49 --max_clutch_size $max_clutch_size
+ − 50 --min_clutch_size $min_clutch_size
+ − 51 --nymph_mortality $nymph_mortality
+ − 52 --old_nymph_accumulation $old_nymph_accumulation
+ − 53 --oviposition $oviposition
+ − 54 --photoperiod $photoperiod
9
+ − 55 --plot_generations_separately $plot_generations_separately
+ − 56 --plot_std_error $plot_std_error
48
+ − 57 --replications $replications
+ − 58 #if str($custom_date_interval) == "yes":
+ − 59 --start_date '$custom_date_interval_cond.start_date'
+ − 60 --end_date '$custom_date_interval_cond.end_date'
+ − 61 #end if
26
+ − 62 --young_nymph_accumulation $young_nymph_accumulation
29
+ − 63 &>ipm_log.txt;
+ − 64 if [[ $? -ne 0 ]]; then
33
+ − 65 cp ipm_log.txt '$error_file';
29
+ − 66 exit 1;
+ − 67 fi]]></command>
0
+ − 68 <inputs>
37
+ − 69 <param name="input_norm" type="data" format="csv" label="30 year normals temperature data">
+ − 70 <validator type="expression" message="30 year normals temperature data must have 10 columns and 366 rows">value is not None and value.metadata.columns==10 and value.metadata.data_lines==366</validator>
+ − 71 </param>
42
+ − 72 <conditional name="merge_ytd_temperature_data_cond">
+ − 73 <param name="merge_ytd_temperature_data" type="select" label="Merge year-to-date temperature data with 30 year normals temperature data?">
+ − 74 <option value="yes" selected="true">Yes</option>
+ − 75 <option value="no">No</option>
+ − 76 </param>
+ − 77 <when value="yes">
+ − 78 <param name="input_ytd" type="data" format="csv" label="Year-to-date temperature data">
+ − 79 <validator type="expression" message="Year-to-date temperature data must have 6 columns">value is not None and value.metadata.columns==6</validator>
+ − 80 </param>
44
+ − 81 <param name="location" type="text" value="" optional="true" label="Location" help="Enter the location or leave blank to use the station name from 30 year normals data."/>
42
+ − 82 </when>
+ − 83 <when value="no"/>
+ − 84 </conditional>
5
+ − 85 <param name="insect" type="select" label="Select insect">
9
+ − 86 <option value="BMSB" selected="True">Brown Marmorated Stink Bug</option>
5
+ − 87 </param>
42
+ − 88 <param name="replications" type="integer" value="10" min="2" label="Number of replications"/>
+ − 89 <param name="insects_per_replication" type="integer" value="1000" min="1" label="Number of insects with which to start each replication"/>
+ − 90 <param name="photoperiod" type="float" value="13.5" min="0" label="Critical photoperiod for diapause induction/termination"/>
+ − 91 <param name="egg_mortality" type="integer" value="1" min="0" label="Adjustment rate for egg mortality"/>
+ − 92 <param name="nymph_mortality" type="integer" value="1" min="0" label="Adjustment rate for nymph mortality"/>
+ − 93 <param name="adult_mortality" type="integer" value="1" min="0" label="Adjustment rate for adult mortality"/>
+ − 94 <param name="oviposition" type="integer" value="1" min="0" label="Adjustment oviposition rate"/>
+ − 95 <param name="min_clutch_size" type="integer" value="0" min="0" label="Adjustment of minimum clutch size"/>
+ − 96 <param name="max_clutch_size" type="integer" value="0" min="0" label="Adjustment of maximum clutch size"/>
+ − 97 <param name="young_nymph_accumulation" type="integer" value="0" min="0" label="Adjustment of degree-days accumulation (egg->young nymph)"/>
+ − 98 <param name="old_nymph_accumulation" type="integer" value="0" min="0" label="Adjustment of degree-days accumulation (young nymph->old nymph)"/>
+ − 99 <param name="adult_accumulation" type="integer" value="0" min="0" label="Adjustment of degree-days accumulation (old nymph->adult)"/>
48
+ − 100 <conditional name="custom_date_interval_cond">
+ − 101 <param name="custom_date_interval" type="select" label="Set date interval for plots?" help="Scales the x axis in plots from weeks to days">
+ − 102 <option value="no" selected="true">No</option>
+ − 103 <option value="yes">Yes</option>
+ − 104 </param>
+ − 105 <when value="no"/>
+ − 106 <when value="yes">
+ − 107 <param name="start_date" type="text" value="" label="Start date" help="Format must be yyyy-mm-dd">
+ − 108 <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>
+ − 109 </param>
+ − 110 <param name="end_date" type="text" value="" label="End date" help="Format must be yyyy-mm-dd">
+ − 111 <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>
+ − 112 </param>
+ − 113 </when>
+ − 114 </conditional>
9
+ − 115 <param name="plot_generations_separately" type="select" label="Plot generations separately?">
+ − 116 <option value="yes" selected="True">Yes</option>
+ − 117 <option value="no">No</option>
+ − 118 </param>
13
+ − 119 <param name="plot_egg_life_stage" type="select" label="Plot egg life stage?">
+ − 120 <option value="yes" selected="true">Yes</option>
+ − 121 <option value="no">No</option>
+ − 122 </param>
+ − 123 <conditional name="plot_nymph_life_stage_cond">
+ − 124 <param name="plot_nymph_life_stage" type="select" label="Plot nymph life stage?">
+ − 125 <option value="yes" selected="true">Yes</option>
+ − 126 <option value="no">No</option>
9
+ − 127 </param>
13
+ − 128 <when value="yes">
17
+ − 129 <param name="life_stages_nymph" type="select" multiple="true" label="Select nymph life stage">
9
+ − 130 <option value="Total" selected="true">All</option>
+ − 131 <option value="Young">Young</option>
+ − 132 <option value="Old">Old</option>
+ − 133 </param>
+ − 134 </when>
13
+ − 135 <when value="no"/>
+ − 136 </conditional>
+ − 137 <conditional name="plot_adult_life_stage_cond">
+ − 138 <param name="plot_adult_life_stage" type="select" label="Plot adult life stage?">
+ − 139 <option value="yes" selected="true">Yes</option>
+ − 140 <option value="no">No</option>
+ − 141 </param>
+ − 142 <when value="yes">
17
+ − 143 <param name="life_stages_adult" type="select" multiple="true" label="Select adult life stage">
9
+ − 144 <option value="Total" selected="true">All</option>
+ − 145 <option value="Pre-vittelogenic">Pre-vittelogenic</option>
+ − 146 <option value="Vittelogenic">Vittelogenic</option>
+ − 147 <option value="Diapausing">Diapausing</option>
+ − 148 </param>
+ − 149 </when>
13
+ − 150 <when value="no"/>
9
+ − 151 </conditional>
+ − 152 <param name="plot_std_error" type="select" label="Plot standard error?">
+ − 153 <option value="yes" selected="True">Yes</option>
+ − 154 <option value="no">No</option>
0
+ − 155 </param>
+ − 156 </inputs>
+ − 157 <outputs>
33
+ − 158 <collection name="output_data_collection" type="list" label="${tool.name} (data), on ${on_string}">
42
+ − 159 <discover_datasets pattern="__name__" directory="output_data_dir" format="csv"/>
33
+ − 160 </collection>
+ − 161 <collection name="output_plots_collection" type="list" label="${tool.name} (plots), on ${on_string}">
42
+ − 162 <discover_datasets pattern="__name__" directory="output_plots_dir" format="pdf"/>
9
+ − 163 </collection>
0
+ − 164 </outputs>
+ − 165 <tests>
+ − 166 <test>
42
+ − 167 <param name="input_norm" value="30_year_normals.csv" ftype="csv"/>
+ − 168 <param name="merge_ytd_temperature_data" value="no"/>
+ − 169 <param name="replications" value="2"/>
+ − 170 <param name="plot_generations_separately" value="no"/>
+ − 171 <param name="plot_egg_life_stage" value="no"/>
+ − 172 <param name="life_stages_nymph" value="Young"/>
+ − 173 <param name="life_stages_adult" value="Pre-vittelogenic"/>
33
+ − 174 <output_collection name="output_data_collection" type="list">
+ − 175 <element name="04_combined_generations.csv" file="output_combined1.csv" ftype="csv" compare="contains"/>
+ − 176 </output_collection>
+ − 177 <output_collection name="output_plots_collection" type="list">
28
+ − 178 <element name="02_young_nymph_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+ − 179 <element name="05_pre-vittelogenic_adult_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
22
+ − 180 </output_collection>
+ − 181 </test>
+ − 182 <test>
42
+ − 183 <param name="input_norm" value="30_year_normals.csv" ftype="csv"/>
+ − 184 <param name="input_ytd" value="state_college_partial.csv" ftype="csv"/>
+ − 185 <param name="location" value="State College PA"/>
+ − 186 <param name="replications" value="2"/>
+ − 187 <param name="plot_generations_separately" value="no"/>
+ − 188 <param name="plot_egg_life_stage" value="no"/>
+ − 189 <param name="life_stages_nymph" value="Young"/>
+ − 190 <param name="life_stages_adult" value="Pre-vittelogenic"/>
+ − 191 <output_collection name="output_data_collection" type="list">
+ − 192 <element name="04_combined_generations.csv" file="output_combined1.csv" ftype="csv" compare="contains"/>
+ − 193 </output_collection>
+ − 194 <output_collection name="output_plots_collection" type="list">
+ − 195 <element name="02_young_nymph_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+ − 196 <element name="05_pre-vittelogenic_adult_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+ − 197 </output_collection>
+ − 198 </test>
+ − 199 <test>
+ − 200 <param name="input_norm" value="30_year_normals.csv" ftype="csv"/>
+ − 201 <param name="input_ytd" value="state_college_ytd.csv" ftype="csv"/>
+ − 202 <param name="location" value="State College PA"/>
+ − 203 <param name="replications" value="2"/>
+ − 204 <param name="plot_generations_separately" value="no"/>
33
+ − 205 <output_collection name="output_data_collection" type="list">
+ − 206 <element name="04_combined_generations.csv" file="output_combined2.csv" ftype="csv" compare="contains"/>
+ − 207 </output_collection>
+ − 208 <output_collection name="output_plots_collection" type="list">
28
+ − 209 <element name="01_egg_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+ − 210 <element name="04_total_nymph_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+ − 211 <element name="08_total_adult_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+ − 212 <element name="09_total_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
22
+ − 213 </output_collection>
+ − 214 </test>
+ − 215 <test>
42
+ − 216 <param name="input_norm" value="30_year_normals.csv" ftype="csv"/>
+ − 217 <param name="input_ytd" value="state_college_partial.csv" ftype="csv"/>
+ − 218 <param name="location" value="State College PA"/>
+ − 219 <param name="replications" value="2"/>
+ − 220 <param name="plot_egg_life_stage" value="no"/>
+ − 221 <param name="life_stages_nymph" value="Old"/>
+ − 222 <param name="plot_adult_life_stage" value="no"/>
33
+ − 223 <output_collection name="output_data_collection" type="list">
+ − 224 <element name="01_generation_P.csv" file="output_p_3.csv" ftype="csv" compare="contains"/>
+ − 225 <element name="02_generation_F1.csv" file="output_f1_3.csv" ftype="csv" compare="contains"/>
+ − 226 <element name="03_generation_F2.csv" file="output_f2_3.csv" ftype="csv" compare="contains"/>
+ − 227 <element name="04_combined_generations.csv" file="output_combined3.csv" ftype="csv" compare="contains"/>
+ − 228 </output_collection>
+ − 229 <output_collection name="output_plots_collection" type="list">
28
+ − 230 <element name="03_old_nymph_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
22
+ − 231 </output_collection>
+ − 232 </test>
+ − 233 <test>
42
+ − 234 <param name="input_norm" value="30_year_normals.csv" ftype="csv"/>
+ − 235 <param name="input_ytd" value="state_college_ytd.csv" ftype="csv"/>
+ − 236 <param name="location" value="State College PA"/>
+ − 237 <param name="replications" value="2"/>
33
+ − 238 <output_collection name="output_data_collection" type="list">
+ − 239 <element name="01_generation_P.csv" file="output_p_4.csv" ftype="csv" compare="contains"/>
+ − 240 <element name="02_generation_F1.csv" file="output_f1_4.csv" ftype="csv" compare="contains"/>
+ − 241 <element name="03_generation_F2.csv" file="output_f2_4.csv" ftype="csv" compare="contains"/>
+ − 242 <element name="04_combined_generations.csv" file="output_combined4.csv" ftype="csv" compare="contains"/>
+ − 243 </output_collection>
+ − 244 <output_collection name="output_plots_collection" type="list">
28
+ − 245 <element name="01_egg_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+ − 246 <element name="04_total_nymph_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+ − 247 <element name="08_total_adult_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+ − 248 <element name="09_total_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
9
+ − 249 </output_collection>
0
+ − 250 </test>
+ − 251 </tests>
+ − 252 <help>
+ − 253 **What it does**
6
+ − 254
0
+ − 255 Provides an agent-based stochastic model expressing stage-specific phenology and population dynamics for an insect species across geographic regions.
+ − 256
+ − 257 -----
+ − 258
+ − 259 **Required options**
+ − 260
42
+ − 261 * **30 year normals temperature data** - the dataset from your history containing the 30-year normals temperature data (available at http://pestwatch.psu.edu/ghcn).
+ − 262 * **Merge year-to-date temperature data with 30 year normals temperature data** - select Yes to merge a year-to-date temperature dataset from your history into the selected 30 year normals temperature data.
+ − 263
+ − 264 * **Year-to-date temperature data** - the dataset from your history containing the year-to-date temperature data (available at http://pestwatch.psu.edu/minmax).
+ − 265
0
+ − 266 * **Location** - the location associated with the selected temperature data.
7
+ − 267 * **Select insect** - currently only the Brown Marmorated Stink Bug can be analyzed.
0
+ − 268 * **Number of replications** - number of replications.
6
+ − 269 * **Number of insects with which to start each replication** - the analysis for each replication will start with this number of insects.
0
+ − 270 * **Critical photoperiod for diapause induction/termination** - critical photoperiod for diapause induction/termination.
+ − 271 * **Adjustment rate for egg mortality** - adjustment rate for egg mortality.
+ − 272 * **Adjustment rate for nymph mortality** - adjustment rate for nymph mortality.
+ − 273 * **Adjustment rate for adult mortality** - adjustment rate for adult mortality.
+ − 274 * **Adjustment oviposition rate** - adjustment oviposition rate.
+ − 275 * **Adjustment of minimum clutch size** - adjustment of minimum clutch size.
+ − 276 * **Adjustment of maximum clutch size** - adjustment of maximum clutch size
6
+ − 277 * **Adjustment of degree-days accumulation (egg->young nymph)** - adjustment of degree-days accumulation (egg->young nymph).
+ − 278 * **Adjustment of degree-days accumulation (young nymph->old nymph)** - adjustment of degree-days accumulation (young nymph->old nymph).
+ − 279 * **Adjustment of degree-days accumulation (old nymph->adult)** - adjustment of degree-days accumulation (old nymph->adult).
9
+ − 280 * **Plot generations separately** - select "Yes" to plot P, F1 and F2 as separate lines or "no" to pool across generations, resulting in a total for the selected life states.
14
+ − 281 * **Plot egg life stage** - select "Yes" to plot the egg life stage. If all life stages (egg, nymph and adult) are selected for plotting, one output for the total will be produced.
+ − 282 * **Plot nymph life stage** - select "Yes" to plot the nymph life stage. If all life stages (egg, nymph and adult) are selected for plotting, one output for the total will be produced.
+ − 283
+ − 284 * **Select nymph life stage** - select the nymph life stage for plotting.
+ − 285
+ − 286 * **Plot adult life stage** - select "Yes" to plot the adult life stage. If all life stages (egg, nymph and adult) are selected for plotting, one output for the total will be produced.
+ − 287
+ − 288 * **Select adult life stage** - select the adult life stage for plotting.
+ − 289
6
+ − 290 * **Plot standard error** - add standard error lines to plot.
0
+ − 291 </help>
+ − 292 <citations>
+ − 293 <citation type="doi">10.3389/fphys.2016.00165</citation>
3
+ − 294 <citation type="doi">10.1175/JTECH-D-11-00103.1</citation>
+ − 295 <citation type="doi">10.7289/V5D21VHZ</citation>
0
+ − 296 </citations>
+ − 297 </tool>