Previous changeset 5:1878a03f9c9f (2017-11-22) Next changeset 7:ad26f07a7dd8 (2018-02-13) |
Commit message:
Uploaded |
modified:
insect_phenology_model.R insect_phenology_model.xml test-data/output.pdf |
b |
diff -r 1878a03f9c9f -r fe3f86012394 insect_phenology_model.R --- a/insect_phenology_model.R Wed Nov 22 13:22:49 2017 -0500 +++ b/insect_phenology_model.R Wed Dec 06 10:07:21 2017 -0500 |
[ |
b'@@ -3,46 +3,30 @@\n suppressPackageStartupMessages(library("optparse"))\n \n option_list <- list(\n- make_option(c("-a", "--adult_mort"), action="store", dest="adult_mort", type="integer", help="Adjustment rate for adult mortality"),\n- make_option(c("-b", "--adult_accum"), action="store", dest="adult_accum", type="integer", help="Adjustment of DD accumulation (old nymph->adult)"),\n- make_option(c("-c", "--egg_mort"), action="store", dest="egg_mort", type="integer", help="Adjustment rate for egg mortality"),\n- make_option(c("-e", "--location"), action="store", dest="location", help="Selected location"),\n- make_option(c("-f", "--min_clutch_size"), action="store", dest="min_clutch_size", type="integer", help="Adjustment of minimum clutch size"),\n- make_option(c("-i", "--max_clutch_size"), action="store", dest="max_clutch_size", type="integer", help="Adjustment of maximum clutch size"),\n- make_option(c("-j", "--nymph_mort"), action="store", dest="nymph_mort", type="integer", help="Adjustment rate for nymph mortality"),\n- make_option(c("-k", "--old_nymph_accum"), action="store", dest="old_nymph_accum", type="integer", help="Adjustment of DD accumulation (young nymph->old nymph)"),\n- make_option(c("-n", "--num_days"), action="store", dest="num_days", type="integer", help="Total number of days in the temperature dataset"),\n- make_option(c("-o", "--output"), action="store", dest="output", help="Output dataset"),\n- make_option(c("-p", "--oviposition"), action="store", dest="oviposition", type="integer", help="Adjustment for oviposition rate"),\n- make_option(c("-q", "--photoperiod"), action="store", dest="photoperiod", type="double", help="Critical photoperiod for diapause induction/termination"),\n- make_option(c("-s", "--replications"), action="store", dest="replications", type="integer", help="Number of replications"),\n- make_option(c("-t", "--se_plot"), action="store", dest="se_plot", help="Plot SE"),\n- make_option(c("-v", "--input"), action="store", dest="input", help="Temperature data for selected location"),\n- make_option(c("-y", "--young_nymph_accum"), action="store", dest="young_nymph_accum", type="integer", help="Adjustment of DD accumulation (egg->young nymph)"),\n- make_option(c("-x", "--insect"), action="store", dest="insect", help="Insect name")\n+ make_option(c("--adult_mortality"), action="store", dest="adult_mortality", type="integer", help="Adjustment rate for adult mortality"),\n+ make_option(c("--adult_accumulation"), action="store", dest="adult_accumulation", type="integer", help="Adjustment of degree-days accumulation (old nymph->adult)"),\n+ make_option(c("--egg_mortality"), action="store", dest="egg_mortality", type="integer", help="Adjustment rate for egg mortality"),\n+ make_option(c("--input"), action="store", dest="input", help="Temperature data for selected location"),\n+ make_option(c("--insect"), action="store", dest="insect", help="Insect name"),\n+ make_option(c("--insects_per_replication"), action="store", dest="insects_per_replication", type="integer", help="Number of insects with which to start each replication"),\n+ make_option(c("--location"), action="store", dest="location", help="Selected location"),\n+ make_option(c("--min_clutch_size"), action="store", dest="min_clutch_size", type="integer", help="Adjustment of minimum clutch size"),\n+ make_option(c("--max_clutch_size"), action="store", dest="max_clutch_size", type="integer", help="Adjustment of maximum clutch size"),\n+ make_option(c("--nymph_mortality"), action="store", dest="nymph_mortality", type="integer", help="Adjustment rate for nymph mortality"),\n+ make_option(c("--old_nymph_accumulation"), action="store", dest="old_nymph_accumulation", type="integer", help="Adjustment of degree-days accumulation (young nymph->old nymph)"),\n+ make_option(c("--num_days"), action="store", dest="num_days", type="integer", help="Total number of days in the temperature dataset"),\n+ m'..b'e, lwd=2, lty=1, col=4)\n-axis(1, at=c(1:12) * 30 - 15, cex.axis=3, labels=c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"))\n-axis(2, cex.axis=3)\n-leg.text <- c("Egg", "Nymph", "Adult")\n-legend("topleft", leg.text, lty=c(1, 1, 1), col=c(4, 2, 1), cex=3)\n-if (opt$se_plot == 1) {\n- # Add SE lines to plot\n- # SE for adults\n- lines (day.all, sa + sa.se, lty=2)\n- lines (day.all, sa - sa.se, lty=2) \n- # SE for nymphs\n- lines (day.all, sn + sn.se, col=2, lty=2)\n- lines (day.all, sn - sn.se, col=2, lty=2)\n- # SE for eggs\n- lines (day.all, se + se.se, col=4, lty=2)\n- lines (day.all, se - se.se, col=4, lty=2)\n-}\n+# Data analysis and visualization plots only within a single calendar year.\n+days <- c(1:opt$num_days)\n+start_date <- temperature_data_frame$DATE[1]\n+end_date <- temperature_data_frame$DATE[opt$num_days]\n \n-# Subfigure 2: population size by generation\n-title <- paste(opt$insect, ": Total pop. by generation :", opt$location, ": Lat:", latitude, ":", start_date, "-", end_date, sep=" ")\n-plot(day.all, g0, main=title, type="l", ylim=c(0, max(g2)), axes=F, lwd=2, xlab="", ylab="", cex=3, cex.lab=3, cex.axis=3, cex.main=3)\n-lines(day.all, g1, lwd = 2, lty = 1, col=2)\n-lines(day.all, g2, lwd = 2, lty = 1, col=4)\n-axis(1, at=c(1:12) * 30 - 15, cex.axis=3, labels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"))\n-axis(2, cex.axis=3)\n-leg.text <- c("P", "F1", "F2")\n-legend("topleft", leg.text, lty=c(1, 1, 1), col=c(1, 2, 4), cex=3)\n-if (opt$se_plot == 1) {\n- # Add SE lines to plot\n- # SE for adults\n- lines (day.all, g0+g0.se, lty=2)\n- lines (day.all, g0-g0.se, lty=2) \n- # SE for nymphs\n- lines (day.all, g1+g1.se, col=2, lty=2)\n- lines (day.all, g1-g1.se, col=2, lty=2)\n- # SE for eggs\n- lines (day.all, g2+g2.se, col=4, lty=2)\n- lines (day.all, g2-g2.se, col=4, lty=2)\n-}\n-\n-# Subfigure 3: adult population size by generation\n-title <- paste(opt$insect, ": Adult pop. by generation :", opt$location, ": Lat:", latitude, ":", start_date, "-", end_date, sep=" ")\n-plot(day.all, g0a, ylim=c(0, max(g2a) + 100), main=title, type="l", axes=F, lwd=2, xlab="", ylab="", cex=3, cex.lab=3, cex.axis=3, cex.main=3)\n-lines(day.all, g1a, lwd = 2, lty = 1, col=2)\n-lines(day.all, g2a, lwd = 2, lty = 1, col=4)\n-axis(1, at=c(1:12) * 30 - 15, cex.axis=3, labels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"))\n-axis(2, cex.axis=3)\n-leg.text <- c("P", "F1", "F2")\n-legend("topleft", leg.text, lty=c(1, 1, 1), col=c(1, 2, 4), cex=3)\n-if (opt$se_plot == 1) {\n- # Add SE lines to plot\n- # SE for adults\n- lines (day.all, g0a+g0a.se, lty=2)\n- lines (day.all, g0a-g0a.se, lty=2) \n- # SE for nymphs\n- lines (day.all, g1a+g1a.se, col=2, lty=2)\n- lines (day.all, g1a-g1a.se, col=2, lty=2)\n- # SE for eggs\n- lines (day.all, g2a+g2a.se, col=4, lty=2)\n- lines (day.all, g2a-g2a.se, col=4, lty=2)\n-}\n+# Subfigure 1: population size by life stage.\n+maxval <- max(eggs+eggs.std_error, nymphs+nymphs.std_error, adults+adults.std_error)\n+render_chart("pop_size_by_life_stage", opt$insect, opt$location, latitude, start_date, end_date, days, maxval,\n+ opt$std_error_plot, adults, nymphs, eggs, adults.std_error, nymphs.std_error, eggs.std_error)\n+# Subfigure 2: population size by generation.\n+maxval <- max(F2)\n+render_chart("pop_size_by_generation", opt$insect, opt$location, latitude, start_date, end_date, days, maxval,\n+ opt$std_error_plot, P, F1, F2, P.std_error, F1.std_error, F2.std_error)\n+# Subfigure 3: adult population size by generation.\n+maxval <- max(F2_adults) + 100\n+render_chart("adult_pop_size_by_generation", opt$insect, opt$location, latitude, start_date, end_date, days, maxval,\n+ opt$std_error_plot, P_adults, F1_adults, F2_adults, P_adults.std_error, F1_adults.std_error, F2_adults.std_error)\n \n # Turn off device driver to flush output.\n dev.off()\n' |
b |
diff -r 1878a03f9c9f -r fe3f86012394 insect_phenology_model.xml --- a/insect_phenology_model.xml Wed Nov 22 13:22:49 2017 -0500 +++ b/insect_phenology_model.xml Wed Dec 06 10:07:21 2017 -0500 |
[ |
@@ -5,23 +5,24 @@ </requirements> <command detect_errors="exit_code"><![CDATA[ Rscript '$__tool_directory__/insect_phenology_model.R' --a $adult_mort --b $adult_accum --c $egg_mort --e '$location' --f $max_clutch_size --i $min_clutch_size --j $nymph_mort --k $old_nymph_accum --n $input.metadata.data_lines --o '$output' --p $oviposition --q $photoperiod --s $replications --t $se_plot --v '$input' --y $young_nymph_accum --x '$insect']]></command> +--adult_mortality $adult_mortality +--adult_accumulation $adult_accumulation +--egg_mortality $egg_mortality +--input '$input' +--insect '$insect' +--insects_per_replication $insects_per_replication +--location '$location' +--max_clutch_size $max_clutch_size +--min_clutch_size $min_clutch_size +--nymph_mortality $nymph_mortality +--num_days $input.metadata.data_lines +--old_nymph_accumulation $old_nymph_accumulation +--output '$output' +--oviposition $oviposition +--photoperiod $photoperiod +--replications $replications +--std_error_plot $std_error_plot +--young_nymph_accumulation $young_nymph_accumulation]]></command> <inputs> <param name="input" type="data" format="csv" label="Temperature data" /> <param name="location" type="text" value="" optional="false" label="Location" /> @@ -29,17 +30,18 @@ <option value="Brown Marmolated Stink Bug" selected="True">Brown Marmolated Stink Bug</option> </param> <param name="replications" type="integer" value="10" min="1" label="Number of replications" /> + <param name="insects_per_replication" type="integer" value="1000" min="1" label="Number of insects with which to start each replication" /> <param name="photoperiod" type="float" value="13.5" min="0" label="Critical photoperiod for diapause induction/termination" /> - <param name="egg_mort" type="integer" value="1" min="0" label="Adjustment rate for egg mortality" /> - <param name="nymph_mort" type="integer" value="1" min="0" label="Adjustment rate for nymph mortality" /> - <param name="adult_mort" type="integer" value="1" min="0" label="Adjustment rate for adult mortality" /> + <param name="egg_mortality" type="integer" value="1" min="0" label="Adjustment rate for egg mortality" /> + <param name="nymph_mortality" type="integer" value="1" min="0" label="Adjustment rate for nymph mortality" /> + <param name="adult_mortality" type="integer" value="1" min="0" label="Adjustment rate for adult mortality" /> <param name="oviposition" type="integer" value="1" min="0" label="Adjustment oviposition rate" /> <param name="min_clutch_size" type="integer" value="0" min="0" label="Adjustment of minimum clutch size" /> <param name="max_clutch_size" type="integer" value="0" min="0" label="Adjustment of maximum clutch size" /> - <param name="young_nymph_accum" type="integer" value="0" min="0" label="Adjustment of DD accumulation (egg->young nymph)" /> - <param name="old_nymph_accum" type="integer" value="0" min="0" label="Adjustment of DD accumulation (young nymph->old nymph)" /> - <param name="adult_accum" type="integer" value="0" min="0" label="Adjustment of DD accumulation (old nymph->adult)" /> - <param name="se_plot" type="select" label="Plot SE?"> + <param name="young_nymph_accumulation" type="integer" value="0" min="0" label="Adjustment of degree-days accumulation (egg->young nymph)" /> + <param name="old_nymph_accumulation" type="integer" value="0" min="0" label="Adjustment of degree-days accumulation (young nymph->old nymph)" /> + <param name="adult_accumulation" type="integer" value="0" min="0" label="Adjustment of degree-days accumulation (old nymph->adult)" /> + <param name="std_error_plot" type="select" label="Plot standard error?"> <option value="1" selected="True">Yes</option> <option value="0">No</option> </param> @@ -57,7 +59,7 @@ </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. ----- @@ -66,7 +68,9 @@ * **Location** - the location associated with the selected temperature data. * **Temperature data** - select the dataset from your history containing the temperature data. + * **Select insect** - currently only the Brown Marmolated Stink Bug can be analyzed. * **Number of replications** - number of replications. + * **Number of insects with which to start each replication** - the analysis for each replication will start with this number of insects. * **Critical photoperiod for diapause induction/termination** - critical photoperiod for diapause induction/termination. * **Adjustment rate for egg mortality** - adjustment rate for egg mortality. * **Adjustment rate for nymph mortality** - adjustment rate for nymph mortality. @@ -74,11 +78,11 @@ * **Adjustment oviposition rate** - adjustment oviposition rate. * **Adjustment of minimum clutch size** - adjustment of minimum clutch size. * **Adjustment of maximum clutch size** - adjustment of maximum clutch size - * **Adjustment of DD accumulation (egg->young nymph)** - adjustment of DD accumulation (egg->young nymph). - * **Adjustment of DD accumulation (young nymph->old nymph)** - adjustment of DD accumulation (young nymph->old nymph). - * **Adjustment of DD accumulation (old nymph->adult)** - adjustment of DD accumulation (old nymph->adult). - * **Plot SE** - add SE lines to plot for eggs, nymphs and adults. - + * **Adjustment of degree-days accumulation (egg->young nymph)** - adjustment of degree-days accumulation (egg->young nymph). + * **Adjustment of degree-days accumulation (young nymph->old nymph)** - adjustment of degree-days accumulation (young nymph->old nymph). + * **Adjustment of degree-days accumulation (old nymph->adult)** - adjustment of degree-days accumulation (old nymph->adult). + * **Plot standard error** - add standard error lines to plot. + </help> <citations> <citation type="doi">10.3389/fphys.2016.00165</citation> |
b |
diff -r 1878a03f9c9f -r fe3f86012394 test-data/output.pdf --- a/test-data/output.pdf Wed Nov 22 13:22:49 2017 -0500 +++ b/test-data/output.pdf Wed Dec 06 10:07:21 2017 -0500 |
[ |
@@ -1,19 +1,16 @@ 1 0 obj << +/CreationDate +/ModDate /Title (R Graphics Output) +/Producer /Creator (R) ->> -endobj -2 0 obj << /Type /Catalog /Pages 3 0 R >> endobj 7 0 obj << /Type /Page /Parent 3 0 R /Contents 8 0 R /Resources 4 0 R >> endobj -8 0 obj -<< ->> -stream 3 0 obj << /Type /Pages /Kids [ 7 0 R ] /Count 1 /MediaBox [0 0 1440 2160] >> endobj @@ -52,3 +49,4 @@ trailer << /Size 12 /Info 1 0 R /Root 2 0 R >> startxref +%%EOF |