diff --git a/DESCRIPTION b/DESCRIPTION index 0b865614..7a76500f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 = "srcorsi@usgs.gov"), diff --git a/inst/doc/Introduction.Rmd b/inst/doc/Introduction.Rmd index e430f157..4d038e23 100644 --- a/inst/doc/Introduction.Rmd +++ b/inst/doc/Introduction.Rmd @@ -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). @@ -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". @@ -104,7 +104,7 @@ install.packages("toxEval") -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: diff --git a/inst/doc/Introduction.html b/inst/doc/Introduction.html index 88c3ca93..6cda60da 100644 --- a/inst/doc/Introduction.html +++ b/inst/doc/Introduction.html @@ -67,7 +67,7 @@

Introduction to toxEval

-

11 May, 2018

+

14 May, 2018

@@ -92,7 +92,7 @@

11 May, 2018

Introduction

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.

+

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.

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).

The U.S. EPA’s Toxicity Forecaster ToxCast includes a database of chemical:biological interactions that contains information from hundreds of assays on thousands of chemicals, providing a means to assess biological relevance to measured concentrations. The toxEval package attempts to simplify the workflow for exploring data as it relates to these assay endpoints (benchmark data). The workflow uses ToxCast as a default for evaluation of chemical:biological interactions, but the user may also define alternative benchmarks for a custom or more traditional approach to biological relevance evaluation. This is also a useful capability for efficient comparison of ToxCast evaluation results with those from other toxicity benchmark databases.

When using the ToxCast endPoints for analysis, it is important to have at least a minimal understanding of what ToxCast data is, and which ToxCast data is relevant to any given study. There are many useful resources here. There is also a tool called the ToxCast Dashboard that has a wealth of information on ToxCast data.

@@ -119,7 +119,7 @@

Grouping options

Summarizing the data

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”.

@@ -155,7 +155,7 @@

Installation of toxEval

Update toxEval

-

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:

update.packages()
diff --git a/inst/doc/PrepareData.html b/inst/doc/PrepareData.html index a572dea3..b76b2823 100644 --- a/inst/doc/PrepareData.html +++ b/inst/doc/PrepareData.html @@ -29,7 +29,7 @@

Preparing toxEval Data

-

11 May, 2018

+

14 May, 2018

diff --git a/inst/doc/basicWorkflow.Rmd b/inst/doc/basicWorkflow.Rmd index d120f6c5..dd7c0966 100644 --- a/inst/doc/basicWorkflow.Rmd +++ b/inst/doc/basicWorkflow.Rmd @@ -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) diff --git a/inst/doc/basicWorkflow.html b/inst/doc/basicWorkflow.html index ac50acde..94c24fbf 100644 --- a/inst/doc/basicWorkflow.html +++ b/inst/doc/basicWorkflow.html @@ -91,7 +91,7 @@

Basic Workflow

-

11 May, 2018

+

14 May, 2018

@@ -142,7 +142,7 @@

Load Data

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:

ACClong <- get_ACC(tox_list$chem_info$CAS)
 ACClong <- remove_flags(ACClong)
 
diff --git a/inst/doc/shinyApp.Rmd b/inst/doc/shinyApp.Rmd
index 2e80779c..bedd281c 100644
--- a/inst/doc/shinyApp.Rmd
+++ b/inst/doc/shinyApp.Rmd
@@ -71,7 +71,7 @@ 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
 
@@ -79,9 +79,9 @@ The options are "MeanEAR" and "MaxEAR", and they dictate how to summarize the EA
 
 ### 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
 
diff --git a/inst/doc/shinyApp.html b/inst/doc/shinyApp.html
index 70dcdd4b..a7a1e4b2 100644
--- a/inst/doc/shinyApp.html
+++ b/inst/doc/shinyApp.html
@@ -67,7 +67,7 @@
 
 
 

Shiny App

-

11 May, 2018

+

14 May, 2018

@@ -126,7 +126,7 @@

B. ‘Group By’ option

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.

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.

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

@@ -134,8 +134,8 @@

C. Mean and Maximum: Summarize by site

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”.

-

The “ACC” column is in log(μM), and the “Value” column is the conversion from that log(μM) to μg/L.

+

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(\(\mu\)M), and the “Value” column is the ACC converted to units of \(\mu\)g/L.

E. Assay

diff --git a/inst/shiny/boxPlot.R b/inst/shiny/boxPlot.R index 5355241b..e22f7e8b 100644 --- a/inst/shiny/boxPlot.R +++ b/inst/shiny/boxPlot.R @@ -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] @@ -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) @@ -110,6 +112,8 @@ 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){ @@ -117,6 +121,7 @@ boxCode <- reactive({ bio_plot <- plot_tox_boxplots(chemicalSummary, category = '",category,"', mean_logic = ",mean_logic,", + hit_threshold = ",hitThres,", title = '",genericTitle(),"', plot_ND = ",plot_ND,") bio_plot") @@ -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,") diff --git a/inst/shiny/endpointGraph.R b/inst/shiny/endpointGraph.R index e27a958d..faa25813 100644 --- a/inst/shiny/endpointGraph.R +++ b/inst/shiny/endpointGraph.R @@ -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) @@ -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) @@ -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) diff --git a/inst/shiny/ui.R b/inst/shiny/ui.R index 6d8ea54e..2611f15f 100644 --- a/inst/shiny/ui.R +++ b/inst/shiny/ui.R @@ -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( @@ -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'))