Skip to content

Commit

Permalink
Merge pull request #267 from ldecicco-USGS/master
Browse files Browse the repository at this point in the history
vignettes and version
  • Loading branch information
ldecicco-USGS authored May 14, 2018
2 parents 8efc8f9 + e2a88b3 commit 1fe1e23
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 28 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: toxEval
Type: Package
Title: ToxCast Evaluations
Version: 0.3.9.9000
Version: 0.3.9.9001
Date: 2018-01-04
Authors@R: c( person("Steven", "Corsi", role = c("aut"),
email = "[email protected]"),
Expand Down
6 changes: 3 additions & 3 deletions inst/doc/Introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ vignette: >

The `toxEval` R-package includes a set of functions to analyze, visualize, and organize measured concentration data as it relates to ToxCast data (default) or other user-selected chemical-biological interaction benchmark data such as water quality criteria. The intent of these analyses is to develop a better understanding of the potential biological relevance of environmental chemistry data. Results can be used to prioritize which chemicals at which sites may be of greatest concern. These methods are meant to be used as a screening technique to predict potential for biological influence from chemicals that ultimately need to be validated with direct biological assays.

The functions within this package allow great flexibly for exploring the potential biological affects of measured chemicals. Also included in the package is a browser-based application made from the `shiny` R-package (the app). The app is based on functions within the R-package and includes many convenient analyses and visualization options for users to choose. Use of the functions within the R-package allows for additional flexibility within the functions beyond what the app offers and provides options for the user to interact more directly with the data. The overview in this document focuses on the R-package. Documentation for the app is provided in the [shinyApp vignette](shinyApp.html).
The functions within this package allow great flexibly for exploring the potential biological affects of measured chemicals. Also included in the package is a browser-based application made from the `Shiny` R-package (the app). The app is based on functions within the R-package and includes many convenient analyses and visualization options for users to choose. Use of the functions within the R-package allows for additional flexibility within the functions beyond what the app offers and provides options for the user to interact more directly with the data. The overview in this document focuses on the R-package. Documentation for the app is provided in the [ShinyApp vignette](shinyApp.html).

This vignette provides a general overview of the concepts within `toxEval`, definitions of common terminology used throughout the package, and links to information to help understand fundamentals of the ToxCast database used within `toxEval`. In addition, instructions are provided for installing and updating the package from the Geological Survey R Archive Network (GRAN).

Expand Down Expand Up @@ -56,7 +56,7 @@ The default grouping of ToxCast endPoints is "intended_target_family", but depen

The functions in `toxEval` summarize the data as follows:

First, individual EAR values are calculated for each chemical:endPoint combination. Then, the EAR values are summed together by samples (a sample is defined as a unique site/date) based on the grouping picked in the "category" argument. Categories include "Biological", "Chemical Class", or "Chemical". "Biological" refers to the chosen ToxCast annotation as defined in the `groupCol` argument of the `filter_groups` function. "Chemical Class" refers to the groupings of chemicals as defined in the "Class" column of the "Chemicals" tab of the input file. "Chemical" refers to the individual chemical as defined by a unique CAS value. Finally, the maximum or mean EAR is calculated per site (based on the `mean_logic` option). This ensures that each site is represented equally regardless of how many samples are available per site.
First, individual EAR values are calculated for each chemical:endPoint combination. Then, the EAR values are summed together by samples (a sample is defined as a unique site/date) based on the grouping picked in the "category" argument. Categories include "Biological", "Chemical Class", or "Chemical". "Biological" refers to the chosen ToxCast annotation as defined in the `groupCol` argument of the `filter_groups` function. "Chemical Class" refers to the groupings of chemicals as defined in the "Class" column of the "Chemicals" sheet of the input file. "Chemical" refers to the individual chemical as defined by a unique CAS value. Finally, the maximum or mean EAR is calculated per site (based on the `mean_logic` option). This ensures that each site is represented equally regardless of how many samples are available per site.

Some functions will also include a calculation for a "hit". A threshold is defined by the user, and if the mean or maximum EAR (calculated as described above) is greater than the threshold, that is considered a "hit".

Expand Down Expand Up @@ -104,7 +104,7 @@ install.packages("toxEval")

<img style="float: right;" src="update.png">

Regularly, it is a good idea to update *ALL* of installed packages in R. If using RStudio, this is done by using the Update button in the "Packages" tab. Selecting this option checks CRAN and GRAN for updates.
Regularly, it is a good idea to update *ALL* of installed packages in R. If using RStudio, this is done by using the Update button in the "Packages" tab in RStudio. Selecting this option checks CRAN and GRAN for updates.


Within the R-console, packages can be updated with the command:
Expand Down
8 changes: 4 additions & 4 deletions inst/doc/Introduction.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/doc/PrepareData.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


<h1 class="title toc-ignore">Preparing toxEval Data</h1>
<h4 class="date"><em>11 May, 2018</em></h4>
<h4 class="date"><em>14 May, 2018</em></h4>


<div id="TOC">
Expand Down
2 changes: 1 addition & 1 deletion inst/doc/basicWorkflow.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The `create_toxEval` function will check that required columns are included, and

# Setup Analysis

The next step for exploring the data in `toxEval` is to create a data frame that includes the EAR calculations for each measurement. This data frame (`chemicalSummary`) is required for most functions within `toxEval`. Since one chemical may have many more than one "endPoint", this data frame may be much larger then the "Data" tab in the Excel file. The general workflow for creating this data frame is:
The next step for exploring the data in `toxEval` is to create a data frame that includes the EAR calculations for each measurement. This data frame (`chemicalSummary`) is required for most functions within `toxEval`. Since one chemical may have many more than one "endPoint", this data frame may be much larger then the "Data" sheet in the Excel file. The general workflow for creating this data frame is:

```{r chemicalSummary}
ACClong <- get_ACC(tox_list$chem_info$CAS)
Expand Down
4 changes: 2 additions & 2 deletions inst/doc/basicWorkflow.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@


<h1 class="title toc-ignore">Basic Workflow</h1>
<h4 class="date"><em>11 May, 2018</em></h4>
<h4 class="date"><em>14 May, 2018</em></h4>


<div id="TOC">
Expand Down Expand Up @@ -142,7 +142,7 @@ <h1>Load Data</h1>
</div>
<div id="setup-analysis" class="section level1">
<h1>Setup Analysis</h1>
<p>The next step for exploring the data in <code>toxEval</code> is to create a data frame that includes the EAR calculations for each measurement. This data frame (<code>chemicalSummary</code>) is required for most functions within <code>toxEval</code>. Since one chemical may have many more than one “endPoint”, this data frame may be much larger then the “Data” tab in the Excel file. The general workflow for creating this data frame is:</p>
<p>The next step for exploring the data in <code>toxEval</code> is to create a data frame that includes the EAR calculations for each measurement. This data frame (<code>chemicalSummary</code>) is required for most functions within <code>toxEval</code>. Since one chemical may have many more than one “endPoint”, this data frame may be much larger then the “Data” sheet in the Excel file. The general workflow for creating this data frame is:</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">ACClong &lt;-<span class="st"> </span><span class="kw">get_ACC</span>(tox_list<span class="op">$</span>chem_info<span class="op">$</span>CAS)
ACClong &lt;-<span class="st"> </span><span class="kw">remove_flags</span>(ACClong)

Expand Down
6 changes: 3 additions & 3 deletions inst/doc/shinyApp.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ The "Group" choice will group all of the endPoints that have similar groupings b

The "Chemical" choice will group all of the endPoints in a single chemical (as defined by unique CAS).

The "Class" choice will group all of the endpoints in all of the chemicals for each chemical class as defined in the "Chemical" tab in the Excel file.
The "Class" choice will group all of the endpoints in all of the chemicals for each chemical class as defined in the "Chemical" sheet in the Excel file.

### C. Mean and Maximum: Summarize by site

The options are "MeanEAR" and "MaxEAR", and they dictate how to summarize the EARs per site. Each site may have different numbers of collected samples. Mean or max can be chosen based on the objectives of specific analyses.

### D. Download benchmarks

Clicking on this button will download the current set of benchmarks that is currently being used for `toxEval` computations as a comma delimited (csv) file. This file is formateed such that it could be used in the "Benchmark" tab (as described in the "Prepare Data" vignette). The provided columns are "CAS", "Chemical" (name), "flags", "endPoint", "ACC", "MlWt", "Value", "groupCol", and "assaysFull".
Clicking on this button will download the current set of benchmarks that is currently being used for `toxEval` computations as a comma delimited (csv) file. This file is formated such that it could be used in the "Benchmark" sheet (as described in the "Prepare Data" vignette). The provided columns are "CAS", "Chemical" (name), "flags", "endPoint", "ACC", "MlWt", "Value", "groupCol", and "assaysFull".

The "ACC" column is in log(μM), and the "Value" column is the conversion from that log(μM) to μg/L.
The "ACC" column is in log($\mu$M), and the "Value" column is the ACC converted to units of $\mu$g/L.

### E. Assay

Expand Down
8 changes: 4 additions & 4 deletions inst/doc/shinyApp.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@


<h1 class="title toc-ignore">Shiny App</h1>
<h4 class="date"><em>11 May, 2018</em></h4>
<h4 class="date"><em>14 May, 2018</em></h4>


<div id="TOC">
Expand Down Expand Up @@ -126,16 +126,16 @@ <h3>B. ‘Group By’ option</h3>
<p>The “Group By” radio buttons affect all output in the application. For each function, the data will be summarized by summing individual EARs. How summations are grouped depends on this choice.</p>
<p>The “Group” choice will group all of the endPoints that have similar groupings based on the options as determined by the designated “Annotation”. The default annotation is “intended_target_family”. With that choice, the “Group” radio button groups all EARs by the unique categories in the “intended_target_family” category.</p>
<p>The “Chemical” choice will group all of the endPoints in a single chemical (as defined by unique CAS).</p>
<p>The “Class” choice will group all of the endpoints in all of the chemicals for each chemical class as defined in the “Chemical” tab in the Excel file.</p>
<p>The “Class” choice will group all of the endpoints in all of the chemicals for each chemical class as defined in the “Chemical” sheet in the Excel file.</p>
</div>
<div id="c.-mean-and-maximum-summarize-by-site" class="section level3">
<h3>C. Mean and Maximum: Summarize by site</h3>
<p>The options are “MeanEAR” and “MaxEAR”, and they dictate how to summarize the EARs per site. Each site may have different numbers of collected samples. Mean or max can be chosen based on the objectives of specific analyses.</p>
</div>
<div id="d.-download-benchmarks" class="section level3">
<h3>D. Download benchmarks</h3>
<p>Clicking on this button will download the current set of benchmarks that is currently being used for <code>toxEval</code> computations as a comma delimited (csv) file. This file is formateed such that it could be used in the “Benchmark” tab (as described in the “Prepare Data” vignette). The provided columns are “CAS”, “Chemical” (name), “flags”, “endPoint”, “ACC”, “MlWt”, “Value”, “groupCol”, and “assaysFull”.</p>
<p>The “ACC” column is in log(μM), and the “Value” column is the conversion from that log(μM) to μg/L.</p>
<p>Clicking on this button will download the current set of benchmarks that is currently being used for <code>toxEval</code> computations as a comma delimited (csv) file. This file is formated such that it could be used in the “Benchmark” sheet (as described in the “Prepare Data” vignette). The provided columns are “CAS”, “Chemical” (name), “flags”, “endPoint”, “ACC”, “MlWt”, “Value”, “groupCol”, and “assaysFull”.</p>
<p>The “ACC” column is in log(<span class="math inline">\(\mu\)</span>M), and the “Value” column is the ACC converted to units of <span class="math inline">\(\mu\)</span>g/L.</p>
</div>
<div id="e.-assay" class="section level3">
<h3>E. Assay</h3>
Expand Down
8 changes: 7 additions & 1 deletion inst/shiny/boxPlot.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
boxPlots_create <- reactive({

catType = as.numeric(input$radioMaxGroup)

include_thresh <- as.logical(input$plot_thres_box)
hitThres <- ifelse(include_thresh, hitThresValue(),NA)
plot_ND = input$plot_ND
chemicalSummary <- chemicalSummary()
category <- c("Biological","Chemical","Chemical Class")[catType]
Expand All @@ -14,6 +15,7 @@ boxPlots_create <- reactive({
mean_logic = mean_logic,
sum_logic = sum_logic,
plot_ND = plot_ND,
hit_threshold = hitThres,
font_size = 18,
title = genericTitle())
return(bioPlot)
Expand Down Expand Up @@ -110,13 +112,16 @@ boxCode <- reactive({
sum_logic <- as.logical(input$sumEAR)
plot_ND = input$plot_ND

include_thresh <- as.logical(input$plot_thres_box)
hitThres <- ifelse(include_thresh, hitThresValue(),NA)
category <- c("Biological","Chemical","Chemical Class")[catType]

if(sum_logic){
bioPlotCode <- paste0(rCodeSetup(),"
bio_plot <- plot_tox_boxplots(chemicalSummary,
category = '",category,"',
mean_logic = ",mean_logic,",
hit_threshold = ",hitThres,",
title = '",genericTitle(),"',
plot_ND = ",plot_ND,")
bio_plot")
Expand All @@ -125,6 +130,7 @@ bio_plot")
bio_plot <- plot_tox_boxplots(chemicalSummary,
category = '",category,"',
mean_logic = ",mean_logic,",
hit_threshold = ",hitThres,",
sum_logic = FALSE,
title = '",genericTitle(),"',
plot_ND = ",plot_ND,")
Expand Down
8 changes: 5 additions & 3 deletions inst/shiny/endpointGraph.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
endpointGraph_create <- reactive({

filterBy <- epDF[['epGroup']]
hitThres <- hitThresValue()
include_thresh <- as.logical(input$plot_thres_ep)
hitThres <- ifelse(include_thresh, hitThresValue(),NA)
chemicalSummary <- chemicalSummary()
catType <- as.numeric(input$radioMaxGroup)
mean_logic <- as.logical(input$meanEAR)
Expand All @@ -12,7 +13,7 @@ endpointGraph_create <- reactive({
category = category,
mean_logic = mean_logic,
sum_logic = sum_logic,
hit_threshold = hitThresValue(),
hit_threshold = hitThres,
filterBy = filterBy,
title = genericTitle(),
font_size = 18)
Expand Down Expand Up @@ -90,7 +91,8 @@ epGraphCode <- reactive({

catType = as.numeric(input$radioMaxGroup)
category <- c("Biological","Chemical","Chemical Class")[catType]
hitThres <- hitThresValue()
include_thresh <- as.logical(input$plot_thres_ep)
hitThres <- ifelse(include_thresh, hitThresValue(),NA)
filterBy <- epDF[['epGroup']]
mean_logic <- as.logical(input$meanEAR)
sum_logic <- as.logical(input$sumEAR)
Expand Down
14 changes: 9 additions & 5 deletions inst/shiny/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ body <- dashboardBody(
),
tabPanel(title = tagList("Box Plots", shiny::icon("bar-chart")),
value="summary",
checkboxInput("plot_thres_box", "Consider Threshold?", FALSE),
uiOutput("graphGroup.ui", width = "100%"),
checkboxInput("plot_ND", "Plot ND's?", TRUE),
fluidRow(
Expand Down Expand Up @@ -211,11 +212,14 @@ body <- dashboardBody(
),
tabPanel(title = tagList("Endpoint", shiny::icon("bar-chart")),
value="endpoint",
selectInput("epGroup", label = "Choose Chemical",
choices = "All",
multiple = FALSE,
selected = "All"),
div(style = 'overflow-y: scroll', uiOutput("endpointGraph.ui")),
fluidRow(
column(3,selectInput("epGroup", label = "Choose Chemical",
choices = "All",
multiple = FALSE,
selected = "All")),
column(3, checkboxInput("plot_thres_ep", "Consider Threshold?", FALSE))
),
uiOutput("endpointGraph.ui"),
fluidRow(
column(3, downloadButton('downloadEndpoint', 'Download PNG')),
column(3, downloadButton('downloadEndpoint_csv', 'Download CSV'))
Expand Down

0 comments on commit 1fe1e23

Please sign in to comment.