Skip to content

Commit

Permalink
hidap-agrofims v.0.0.17 21-06-2018
Browse files Browse the repository at this point in the history
  • Loading branch information
CIP-RIU committed Jun 21, 2018
1 parent 54ef53f commit 5d76f1e
Show file tree
Hide file tree
Showing 90 changed files with 4,491 additions and 531 deletions.
48 changes: 24 additions & 24 deletions inst/hidap_agrofims/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ ui <- dashboardPage(


br(),
sidebarMenuOutput("menu") #menu is render in login.R when users logs in
sidebarMenuOutput("menu")#, #menu is render in login.R when users logs in
# menuItem("Site information", tabName = "trialSite", icon = icon("map-marker")),
# menuItem("Fieldbook", icon = icon("book"),
# #menuSubItem("New fieldbook", tabName = "newFieldbook", icon = icon("file")),
# menuSubItem("Create fieldbook", tabName = "newFieldbookAgrofims", icon = icon("file")),
#
#
# menuSubItem("Open fieldbook", tabName = "openFieldbook", icon = icon("file-o")),
# menuSubItem("Check fieldbook", tabName = "checkFieldbook", icon = icon("eraser"))#,
# # menuSubItem("Data transformation", tabName = "singleAnalysisTrans", icon = icon("file-text-o"))
Expand All @@ -161,22 +161,22 @@ ui <- dashboardPage(
# #menuSubItem("Distribution Data", tabName = "distributionDB", icon = icon("database"))
# ),
#
# menuItem("Fieldbook management",
# #menuSubItem("New fieldbook", tabName = "newFieldbook", icon = icon("file")),
# menuSubItem("Create fieldbook", tabName = "newFieldbookAgrofims", icon = icon("file")),
#
# menuSubItem("Open fieldbook", tabName = "openFieldbook", icon = icon("file-o")),
# menuSubItem("Check fieldbook", tabName = "checkFieldbook", icon = icon("eraser"))#,
# # menuSubItem("Data transformation", tabName = "singleAnalysisTrans", icon = icon("file-text-o"))
# )#,
#
# # menuItem("Single Trial Analysis",
# # #menuSubItem("Single trial graph",tabName = "SingleChart", icon = icon("calculator")),
# # menuSubItem("Single report", tabName = "singleAnalysisReport", icon = icon("file-text-o")),
# # menuSubItem("Genetic report", tabName = "geneticAnalysisReport", icon = icon("file-text-o"))
# #
# # #menuSubItem("Data Transformation", tabName = "singleAnalysisTrans", icon = icon("file-text-o"))
# # ),
# menuItem("Fieldbook management",
# #menuSubItem("New fieldbook", tabName = "newFieldbook", icon = icon("file")),
# menuSubItem("Create fieldbook", tabName = "newFieldbookAgrofims", icon = icon("file")),
#
# menuSubItem("Open fieldbook", tabName = "openFieldbook", icon = icon("file-o")),
# menuSubItem("Check fieldbook", tabName = "checkFieldbook", icon = icon("eraser"))#,
# # menuSubItem("Data transformation", tabName = "singleAnalysisTrans", icon = icon("file-text-o"))
# ),

# menuItem("Single Trial Analysis",
# #menuSubItem("Single trial graph",tabName = "SingleChart", icon = icon("calculator")),
# menuSubItem("Single report", tabName = "singleAnalysisReport", icon = icon("file-text-o"))#,
# #menuSubItem("Genetic report", tabName = "geneticAnalysisReport", icon = icon("file-text-o"))
#
# #menuSubItem("Data Transformation", tabName = "singleAnalysisTrans", icon = icon("file-text-o"))
# )#,
# #
# # menuItem("PVS Trial Analysis",
# # menuSubItem("PVS report", tabName = "singlePVS", icon = icon("calculator"))#,
Expand Down Expand Up @@ -214,7 +214,7 @@ ui <- dashboardPage(
# # menuSubItem("Check updates", tabName = "updateHidap",icon = icon("refresh"))#,
# ),
#
# menuItem("About", tabName = "dashboard", icon = icon("dashboard"), selected = TRUE)
#menuItem("About", tabName = "dashboard", icon = icon("dashboard"), selected = TRUE)

)

Expand Down Expand Up @@ -419,7 +419,7 @@ ui <- dashboardPage(
br(),
br(),

h2("HIDAP AgroFIMS v0.0.16"),
h2("HIDAP AgroFIMS v0.0.17"),
p(class = "text-muted", style="text-align:justify",
#paste("HiDAP is a Highly Interactive Data Analysis Platform originally meant to support clonal crop breeders at the <a href='http://www.cipotato.org' target='_new'>International Potato Center</a>. It is part of a continuous institutional effort to improve data collection, data quality, data analysis and open access publication. The recent iteration simultaneously also represents efforts to unify best practices from experiences in breeding data management of over 10 years, specifically with DataCollector and CloneSelector for potato and sweetpotato breeding, to address new demands for open access publishing and continue to improve integration with both corporate and community databases (such as biomart and sweetpotatobase) and platforms such as the <a href='https://research.cip.cgiar.org/gtdms/' target='_new'> Global Trial Data Management System (GTDMS)</a> at CIP. </br> One of the main new characteristics of the current software development platform established over the last two years is the web-based interface which provides also a highly interactive environment. It could be used both online and offline and on desktop as well as tablets and laptops. Key features include support for data capture, creation of field books, upload field books from and to accudatalogger, data access from breeding databases (e.g., <a href = 'http://germplasmdb.cip.cgiar.org/' target='_new'>CIP BioMart</a>, <a href='http://www.sweetpotatobase.org' target='_new'>sweetpotatobase</a> via <a href='http://docs.brapi.apiary.io/' target='_new'>breeding API</a>), data quality checks, single and multi-environmental data analysis, selection indices, and report generations. For users of DataCollector or CloneSelector many of the features are known but have been improved upon. Novel features include list management of breeding families, connection with the institutional pedigree database, interactive and linked graphs as well as reproducible reports. With the first full release by end of November 2016 we will include all characteristics from both DataCollector and CloneSelector. HIDAP, with additional support from <a href='https://sweetpotatogenomics.cals.ncsu.edu/' target='_new'>GT4SP</a>, <a href='http://www.rtb.cgiar.org/' target='_new'>RTB</a>, USAID, and <a href='http://cipotato.org/research/partnerships-and-special-projects/sasha-program/' target='_new'>SASHA</a>, is aimed to support the broader research community working on all aspects with primary focus on breeding, genetics, biotechnology, physiology and agronomy.")
shiny::includeHTML("www/about_hidap.txt")
Expand Down Expand Up @@ -488,8 +488,8 @@ ui <- dashboardPage(
# # Material List Module ----------------------------------------------------
#
# fbmlist::generate_ui(name = "generateList"),
fbmlist::managerlist_ui_agrofims(name ="manageListAgrofims"),
fbmlist::generate_ui_agrofims(name = "generateListAgrofims")
#fbmlist::managerlist_ui_agrofims(name ="manageListAgrofims"),
#fbmlist::generate_ui_agrofims(name = "generateListAgrofims")

# fbmlist::managerlist_ui(name = "manageList"),
# fbmlist::createlist_ui(name = "createList"),
Expand All @@ -498,7 +498,7 @@ ui <- dashboardPage(

# #brapps::fbasingle_ui("SingleChart"),
#
# fbanalysis::single_ui(name="singleAnalysisReport"),
fbanalysis::single_hdagrofims_ui(name="singleAnalysisReportAgrofims")#,
# fbanalysis::genetic_ui(name="geneticAnalysisReport"),
#
#
Expand Down Expand Up @@ -610,7 +610,7 @@ sv <- function(input, output, session) ({
fbdesign::server_design_agrofims(input, output, session, values)
# fbdesign::server_design_big(input, output, session, values)
# fbopenbooks::fbopenbooks_server(input, output, session, values)
# fbanalysis::single_server(input, output, session, values)
fbanalysis::single_hdagrofims_server(input, output, session, values)
# fbanalysis::dtr_server(input, output, session, values)
#
# fbanalysis::met_server(input, output, session, values)
Expand Down
4 changes: 0 additions & 4 deletions inst/hidap_agrofims/reports/.gitignore

This file was deleted.

76 changes: 76 additions & 0 deletions inst/hidap_agrofims/reports/2fcrd.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: "`r params$title`"
subtitle: '`r params$subtitle`'
author: '`r params$author`'
date: '`r format(Sys.time(), "%B %d, %Y")`'
output:
html_document:
theme: united
toc: true
toc_depth: 3
pdf_document:
toc: true
toc_depth: 3
highlight: zenburn
word_document:
toc: true
toc_depth: 3
highlight: "tango"
params:
traits: "no data"
A: "no data"
B: "no data"
rep: "no data"
design: "no data"
data: "no data"
maxp: "no data"
title: "no data"
subtitle: "no data"
author: "no data"
---

```{r, echo = FALSE}
library(knitr)
traits <- params$traits
A <- params$A
B <- params$B
rep <- params$rep
design <- params$design
data <- params$data
maxp <- params$maxp
data[, A] <- as.character(data[, A])
data[, B] <- as.character(data[, B])
data[, rep] <- as.character(data[, rep])
```

# 1. Model specification and data description

The data frame has two factors with `r nlevels(as.factor(data[, A]))` and `r nlevels(as.factor(data[, B]))` levels. The experimental design is a completely randomized design with `r nlevels(as.factor(data[, rep]))` replications. The statistical model is
$$
y_{ijk} = \mu + \alpha_i + \beta_j + (\alpha\beta)_{ij} + \epsilon_{ijk}
$$
where

* $y_{ijk}$ is the observed response with level $i$ of factor A, level $j$ of factor B, and replication $k$.
* $\mu$ is the mean response over all levels of factor A, factor B, and replications.
* $\alpha_i$ is the effect for level $i$ of factor A.
* $\beta_j$ is the effect for level $j$ of factor B.
* $(\alpha\beta)_{ij}$ is the interaction effect between level $i$ of factor A and level $j$ of factor B.
* $\epsilon_{ijk}$ is the error term.

In this model we assume that the errors are independent and have a normal distribution with common variance, that is, $\epsilon_{ijk} \sim N(0,\sigma_{\epsilon}^2)$.

```{r, include = FALSE}
out <- NULL
for (i in 1:length(traits)) {
lc <- check.2f(traits[i], A, B, rep, data)
if (lc$c1 == 1 & lc$c2 == 1 & lc$c3 == 1 & lc$pmis <= maxp)
out <- c(out, knit_expand('child_2f.Rmd'))
else
out <- c(out, knit_expand('child_2f_fail.Rmd'))
}
```

`r paste(knit(text = out), collapse = '\n')`
77 changes: 77 additions & 0 deletions inst/hidap_agrofims/reports/2frcbd.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: "`r params$title`"
subtitle: '`r params$subtitle`'
author: '`r params$author`'
date: '`r format(Sys.time(), "%B %d, %Y")`'
output:
html_document:
theme: united
toc: true
toc_depth: 3
pdf_document:
toc: true
toc_depth: 3
highlight: zenburn
word_document:
toc: true
toc_depth: 3
highlight: "tango"
params:
traits: "no data"
A: "no data"
B: "no data"
rep: "no data"
design: "no data"
data: "no data"
maxp: "no data"
title: "no data"
subtitle: "no data"
author: "no data"
---

```{r, echo = FALSE}
library(knitr)
traits <- params$traits
A <- params$A
B <- params$B
rep <- params$rep
design <- params$design
data <- params$data
maxp <- params$maxp
data[, A] <- as.character(data[, A])
data[, B] <- as.character(data[, B])
data[, rep] <- as.character(data[, rep])
```

# 1. Model specification and data description

The data frame has two factors with `r nlevels(as.factor(data[, A]))` and `r nlevels(as.factor(data[, B]))` levels. The experimental design is a randomized complete block design with `r nlevels(as.factor(data[, rep]))` blocks. The statistical model is
$$
y_{ijk} = \mu + \alpha_i + \beta_j + (\alpha\beta)_{ij} + \gamma_k + \epsilon_{ijk}
$$
where

* $y_{ijk}$ is the observed response with level $i$ of factor A, level $j$ of factor B, and block $k$.
* $\mu$ is the mean response over all levels of factor A, factor B, and blocks.
* $\alpha_i$ is the effect for level $i$ of factor A.
* $\beta_j$ is the effect for level $j$ of factor B.
* $(\alpha\beta)_{ij}$ is the interaction effect between level $i$ of factor A and level $j$ of factor B.
* $\gamma_k$ is the effect of block $k$.
* $\epsilon_{ijk}$ is the error term.

In this model we assume that the errors are independent and have a normal distribution with common variance, that is, $\epsilon_{ijk} \sim N(0,\sigma_{\epsilon}^2)$.

```{r, include = FALSE}
out <- NULL
for (i in 1:length(traits)) {
lc <- check.2f(traits[i], A, B, rep, data)
if (lc$c1 == 1 & lc$c2 == 1 & lc$c3 == 1 & lc$pmis <= maxp)
out <- c(out, knit_expand('child_2f.Rmd'))
else
out <- c(out, knit_expand('child_2f_fail.Rmd'))
}
```

`r paste(knit(text = out), collapse = '\n')`
5 changes: 4 additions & 1 deletion inst/hidap_agrofims/reports/a01d.Rmd
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Automatic report for an alpha (0,1) design"
title: "`r params$title`"
subtitle: '`r params$subtitle`'
author: '`r params$author`'
date: '`r format(Sys.time(), "%B %d, %Y")`'
output:
Expand All @@ -22,6 +23,8 @@ params:
block: "no data"
k: "no data"
data: "no data"
title: "no data"
subtitle: "no data"
author: "no data"
---

Expand Down
5 changes: 4 additions & 1 deletion inst/hidap_agrofims/reports/abd.Rmd
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Automatic report for an Augmented Block Design (ABD)"
title: "`r params$title`"
subtitle: '`r params$subtitle`'
author: '`r params$author`'
date: '`r format(Sys.time(), "%B %d, %Y")`'
output:
Expand All @@ -20,6 +21,8 @@ params:
geno: "no data"
rep: "no data"
data: "no data"
title: "no data"
subtitle: "no data"
author: "no data"
---

Expand Down
31 changes: 31 additions & 0 deletions inst/hidap_agrofims/reports/aov.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: "Report for an aov or lm object"
author: '`r params$author`'
date: '`r format(Sys.time(), "%B %d, %Y")`'
output:
html_document:
theme: united
pdf_document:
toc: true
highlight: zenburn
word_document:
highlight: "tango"
params:
x: "no data"
author: "no data"
---

Congratulations! You have fitted a linear model. The ANOVA table for your model is
```{r, echo = FALSE}
anova(params$x)
noterms <- dim(anova(params$x))[1] - 1
pvalues <- anova(params$x)[1:noterms, 5]
```

`r if(noterms == 1 & sum(pvalues < 0.05) > 0) {"Your model has 1 term and it is significant. That is really good! Have you checked your assumptions?"}`

`r if(noterms > 1 & sum(pvalues < 0.05) > 0) {paste("Your model has", noterms, "terms and some of them are significant. That is really good! Have you checked your assumptions?")}`

`r if(noterms == 1 & sum(pvalues < 0.05) == 0) {"Your model has 1 term but it is not significant. I am really sorry, but don't forget that p-values are a function of sample size, so maybe you can try with more replications or a larger sample size next time."}`

`r if(noterms > 1 & sum(pvalues < 0.05) == 0) {paste("Your model has", noterms, "terms but none of them are significant. I am really sorry, but don't forget that p-values are a function of sample size, so maybe you can try with more replications or a larger sample size next time.")}`
71 changes: 71 additions & 0 deletions inst/hidap_agrofims/reports/aovmet.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: "ANOVA for a MET with a RCBD"
author: '`r params$author`'
date: '`r format(Sys.time(), "%B %d, %Y")`'
output:
html_document:
theme: united
pdf_document:
toc: true
highlight: zenburn
word_document:
highlight: "tango"
params:
trait: "no data"
geno: "no data"
env: "no data"
rep: "no data"
data: "no data"
maxp: "no data"
author: "no data"
---

```{r, echo = FALSE}
trait <- params$trait
geno <- params$geno
env <- params$env
rep <- params$rep
data <- params$data
maxp <- params$maxp
lc <- check.2f(trait, geno, env, rep, data)
at <- suppressWarnings(aov.met(trait, geno, env, rep, data, maxp))
if (lc$c4 == 0)
data[, trait] <- mve.met(trait, geno, env, rep, data, maxp)[, 5]
model <- aov(data[, trait] ~ data[, geno] + data[, env]
+ data[, rep] %in% data[, env] + data[, geno]:data[, env])
```

`r if(lc$c1 == 1 & lc$c2 == 1) {"You have fitted a linear model for a multi environment trial (MET) with a RCBD in each environment. The ANOVA table for your model is:"}`

```{r, echo = FALSE}
at
```

`r if(lc$c4 == 0) paste("You have some missing values (", format(lc$pmis * 100, digits = 3), "%) and they have been estimated before running ANOVA.")`

The p-values for your model are:

- `r format(at[1, 5], digits = 4)` for genotypes `r if(at[1, 5] < 0.05) {"which is significant at the 5% level."} else {"which is not significant at the 5% level."}`
- `r format(at[2, 5], digits = 4)` for environments `r if(at[2, 5] < 0.05) {"which is significant at the 5% level."} else {"which is not significant at the 5% level."}`
- `r format(at[4, 5], digits = 4)` for the genotypes by environments interaction `r if(at[4, 5] < 0.05) {"which is significant at the 5% level."} else {"which is not significant at the 5% level."}`

`r if(at[4, 5] < 0.05) {"Because interaction is significant you should want to run a stability analysis. Keep also in mind that a significant interaction means that the differences in response of the genotypes are not the same in all the environments. Therefore, on an individual analysis you could find significant differences among genotypes for some environments and non-significant differences for some others, and the difference for any pair of genotypes could be in different directions and magnitudes depending on the environment."}`

Below you can see a table of means for genotypes, environments, and interaction:

```{r, echo = FALSE}
tapply(data[, trait], data[, geno], mean)
tapply(data[, trait], data[, env], mean)
tapply(data[, trait], list(data[, geno], data[, env]), mean)
```

Don't forget the assumptions of the model. It is supposed that the error has a normal distribution with the same variance for all the genotypes and evironments. The following plots must help you evaluate this:

```{r, echo = FALSE, fig.height = 5, fig.width = 10}
par(mfrow = c(1, 2))
plot(model, which = 1)
plot(model, which = 2)
```

Funnel shapes for the first plot may suggest heterogeneity of variances while departures from the theoretical normal line are symptoms of lack of normality.
Loading

0 comments on commit 5d76f1e

Please sign in to comment.