diff --git a/DESCRIPTION b/DESCRIPTION index 46beaed6..4a11692e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,21 +18,21 @@ Depends: R (>= 3.0) Imports: dplyr, - tidyr -Suggests: - rmarkdown, - knitr, - testthat, - pander, + tidyr, DT, leaflet, - formattable, ggplot2, gridExtra, grid, shiny, data.table, RColorBrewer +Suggests: + rmarkdown, + testthat, + pander, + formattable, + knitr VignetteBuilder: knitr BuildVignettes: true LazyLoad: yes diff --git a/NAMESPACE b/NAMESPACE index 717122c6..24b58766 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -8,9 +8,36 @@ export(chemSummBasic) export(endPointInfo) export(endPointSumm) export(endPointToxCreate) +export(explore_endpoints) export(siteSumm) export(totalSamples) -import(dplyr) -importFrom(tidyr,gather) -importFrom(tidyr,gather_) -importFrom(tidyr,separate) +import(DT) +import(RColorBrewer) +import(data.table) +import(ggplot2) +import(grid) +import(gridExtra) +import(tidyr) +importFrom(dplyr,arrange) +importFrom(dplyr,desc) +importFrom(dplyr,distinct) +importFrom(dplyr,filter) +importFrom(dplyr,filter_) +importFrom(dplyr,group_by) +importFrom(dplyr,group_by_) +importFrom(dplyr,left_join) +importFrom(dplyr,mutate) +importFrom(dplyr,mutate_) +importFrom(dplyr,rename) +importFrom(dplyr,rename_) +importFrom(dplyr,right_join) +importFrom(dplyr,select) +importFrom(dplyr,select_) +importFrom(dplyr,summarise) +importFrom(dplyr,summarize) +importFrom(leaflet,addCircles) +importFrom(leaflet,addLegend) +importFrom(leaflet,clearControls) +importFrom(leaflet,clearShapes) +importFrom(leaflet,leaflet) +importFrom(shiny,runApp) diff --git a/R/chemSumm.R b/R/chemSumm.R index d67e0be4..64e69c36 100644 --- a/R/chemSumm.R +++ b/R/chemSumm.R @@ -8,7 +8,6 @@ #' @param classCol column name of chemical class #' @param siteCol column name of site #' @param dateCol column name of date -#' @import dplyr #' @export #' @examples #' wData <- wData @@ -73,10 +72,7 @@ chemSumm <- function(chemicalSummary,EAR.key="EAR",chnmCol="chnm", #' @param code_pCode character name of code column in pCodeInfo #' @param casrn_ep character name of class column in endPoint #' @return chemicalSummary data frame -#' @import dplyr -#' @importFrom tidyr gather_ -#' @importFrom tidyr gather -#' @importFrom tidyr separate +#' @import tidyr #' @export #' @examples #' wData <- wData @@ -114,7 +110,6 @@ chemSummBasic <- function(wData, pCodeInfoDF,endPoint, #' @param units_pCode character name of units column in pCodeInfo #' @param mlWt_pCode character name of molecular weight column in pCodeInfo #' @return endPoint data frame -#' @import dplyr #' @export #' @examples #' pCodeInfo <- pCodeInfo diff --git a/R/endPointSumm.R b/R/endPointSumm.R index d90d8f8d..178f6fde 100644 --- a/R/endPointSumm.R +++ b/R/endPointSumm.R @@ -8,15 +8,16 @@ #' @param endPointInfo dataframe #' @param endPointInfo.Key column name of endpoint #' @param EAR.key column name in chemicalSummary of EAR -#' @import dplyr #' @export #' @examples +#' \dontrun{ #' wData <- wData #' pCodeInfo <- pCodeInfo #' endPoint <- endPointToxCreate(pCodeInfo) #' chemicalSummary <- chemSummBasic(wData,pCodeInfo,endPoint) #' endPointInfo <- endPointInfo #' epSumm <- endPointSumm(chemicalSummary, endPointInfo=endPointInfo) +#' } endPointSumm <- function(chemicalSummary, chemicalSummary.Key="endPoint",chemicalSummary.site="site", endPointInfo, endPointInfo.Key = "assay_component_endpoint_name", EAR.key="EAR"){ diff --git a/R/explore_endpoints.R b/R/explore_endpoints.R new file mode 100644 index 00000000..cb72553c --- /dev/null +++ b/R/explore_endpoints.R @@ -0,0 +1,22 @@ +#' Explore endpoint groupings +#' +#' Open an interactive app +#' +#' @param browse use browser for map rendering +#' @export +#' @importFrom shiny runApp +#' @importFrom leaflet leaflet +#' @importFrom leaflet addLegend +#' @importFrom leaflet addCircles +#' @importFrom leaflet clearControls +#' @importFrom leaflet clearShapes +#' @import tidyr +#' @import DT +#' @import ggplot2 +#' @import data.table +#' @import RColorBrewer +#' @import grid +#' @import gridExtra +explore_endpoints <- function(browse=TRUE){ + runApp(system.file('shiny', package='toxEval'), launch.browser = browse) +} \ No newline at end of file diff --git a/R/siteSumm.R b/R/siteSumm.R index bf510b1d..a43129ea 100644 --- a/R/siteSumm.R +++ b/R/siteSumm.R @@ -4,9 +4,9 @@ #' #' @param chemicalSummary data frame returned from \code{chemSummBasic} #' @param newSiteKey named vector -#' @import dplyr #' @export #' @examples +#' \dontrun{ #' wData <- wData #' pCodeInfo <- pCodeInfo #' packagePath <- system.file("extdata", package="toxEval") @@ -16,6 +16,7 @@ #' endPoint <- endPointToxCreate(pCodeInfo) #' chemicalSummary <- chemSummBasic(wData,pCodeInfo,endPoint) #' siteSummary <- siteSumm(chemicalSummary,newSiteKey) +#' } siteSumm <- function(chemicalSummary,newSiteKey){ siteSummary <- chemicalSummary %>% diff --git a/R/totalSamples.R b/R/totalSamples.R index 9f227ac2..90d75e1b 100644 --- a/R/totalSamples.R +++ b/R/totalSamples.R @@ -5,7 +5,6 @@ #' @param chemicalSummary data frame returned from \code{chemSummBasic} #' @param chemicalSummary.Key character column name for grouping by (default = "endPoint") #' @param chemicalSummary.site character column name for group by site -#' @import dplyr #' @export #' @examples #' wData <- wData diff --git a/R/toxEval.R b/R/toxEval.R index 50338183..d4ab9812 100644 --- a/R/toxEval.R +++ b/R/toxEval.R @@ -21,6 +21,23 @@ #' #' @name toxEval-package #' @docType package +#' @importFrom dplyr filter +#' @importFrom dplyr rename +#' @importFrom dplyr group_by +#' @importFrom dplyr summarize +#' @importFrom dplyr summarise +#' @importFrom dplyr select +#' @importFrom dplyr arrange +#' @importFrom dplyr distinct +#' @importFrom dplyr left_join +#' @importFrom dplyr right_join +#' @importFrom dplyr desc +#' @importFrom dplyr filter_ +#' @importFrom dplyr rename_ +#' @importFrom dplyr mutate +#' @importFrom dplyr group_by_ +#' @importFrom dplyr select_ +#' @importFrom dplyr mutate_ #' @author Steven Corsi \email{srcorsi@@usgs.gov}, Laura De Cicco \email{ldecicco@@usgs.gov} #' @keywords ToxCast NULL diff --git a/inst/doc/SummaryToxCast.R b/inst/doc/SummaryToxCast.R index e4efa92f..097480e8 100644 --- a/inst/doc/SummaryToxCast.R +++ b/inst/doc/SummaryToxCast.R @@ -10,6 +10,7 @@ library(leaflet) library(formattable) library(ggplot2) library(gridExtra) +library(data.table) pCodeInfo <- pCodeInfo wData <- wData @@ -119,7 +120,10 @@ chemicalSummary_passive <- passiveData %>% select(-mlWt, -conversion, -casrn, -Units) %>% gather(endPoint, endPointValue, -class, -site, -measuredValue, -chnm) %>% filter(!is.na(endPointValue)) %>% - mutate(EAR=measuredValue/endPointValue) + mutate(EAR=measuredValue/endPointValue) %>% + mutate(hits = as.numeric(EAR > 0.1), + endPoint=as.character(endPoint)) %>% + filter(!is.na(EAR)) chemicalSummary_passive <- chemicalSummary_passive %>% mutate(site=paste0("USGS-",gsub("[^0-9]", "", as.character(site))))%>% @@ -220,7 +224,6 @@ datatable(chemSum2[,-6], rownames = FALSE, chemSum3 <- chemicalSummary %>% - mutate(hits= as.numeric(EAR > 0.1)) %>% group_by(chnm, class, site, endPoint) %>% summarize(hits=as.numeric(any(hits > 0)), maxEAR=max(EAR)) %>% @@ -228,10 +231,11 @@ chemSum3 <- chemicalSummary %>% summarize(freq=sum(hits)/n_distinct(site), nSites=sum(hits), maxEAR=max(maxEAR)) %>% - mutate(endPoint=as.character(endPoint))%>% - left_join(endPointInfo, by=c("endPoint"="assay_component_endpoint_name")) %>% + rename(assay_component_endpoint_name=endPoint) %>% + data.table() %>% + left_join(data.table(endPointInfo), by="assay_component_endpoint_name") %>% select(chnm, maxEAR, freq, nSites, - endPoint, class, contains("intended_target_")) %>% + endPoint=assay_component_endpoint_name, class, contains("intended_target_")) %>% rename(type=intended_target_type, type_sub=intended_target_type_sub, family=intended_target_family, family_sub=intended_target_family_sub) %>% select(-contains("intended_target_")) %>% @@ -244,24 +248,9 @@ chemSum3 <- chemicalSummary %>% formatRound(c("maxEAR", "freq"), digits = 2) -totalSamples_ep <- select(chemicalSummary,site,endPoint) %>% - distinct()%>% - group_by(endPoint) %>% - summarise(totalSites=n())%>% - mutate(endPoint=as.character(endPoint)) +endpointSummary <- endPointSumm(chemicalSummary, endPointInfo=endPointInfo) -endpointSummary <- chemicalSummary %>% - mutate(hits= as.numeric(EAR > 0.1)) %>% - group_by(site, endPoint) %>% - summarize(hits=as.numeric(any(hits > 0)), - maxEAR=max(EAR)) %>% - group_by(endPoint) %>% - summarize(nSites=sum(hits), - maxEAR=max(maxEAR)) %>% - mutate(endPoint=as.character(endPoint))%>% - left_join(endPointInfo, by=c("endPoint"="assay_component_endpoint_name")) %>% - left_join(totalSamples_ep, by=c("endPoint")) %>% - mutate(freq=nSites/totalSites)%>% +endpointSummary <- endpointSummary %>% select(endPoint, maxEAR, freq, nSites, endPoint, contains("intended_target_")) %>% rename(type=intended_target_type, type_sub=intended_target_type_sub, @@ -394,8 +383,8 @@ datatable(chemSum2_passive_dt, rownames = FALSE, chemSum3_passive <- chemicalSummary_passive %>% - group_by(chnm, class, site, endPoint) %>% - summarize(hits= as.numeric(any(EAR > 0.1))) %>% +# group_by(chnm, class, site, endPoint) %>% +# summarize(hits= as.numeric(any(EAR > 0.1))) %>% group_by(chnm, class, endPoint) %>% summarize(freq=sum(hits)/n_distinct(site), nSites=sum(hits)) diff --git a/inst/doc/SummaryToxCast.Rmd b/inst/doc/SummaryToxCast.Rmd index aab864c2..8753786a 100644 --- a/inst/doc/SummaryToxCast.Rmd +++ b/inst/doc/SummaryToxCast.Rmd @@ -25,6 +25,7 @@ library(leaflet) library(formattable) library(ggplot2) library(gridExtra) +library(data.table) pCodeInfo <- pCodeInfo wData <- wData @@ -136,7 +137,10 @@ chemicalSummary_passive <- passiveData %>% select(-mlWt, -conversion, -casrn, -Units) %>% gather(endPoint, endPointValue, -class, -site, -measuredValue, -chnm) %>% filter(!is.na(endPointValue)) %>% - mutate(EAR=measuredValue/endPointValue) + mutate(EAR=measuredValue/endPointValue) %>% + mutate(hits = as.numeric(EAR > 0.1), + endPoint=as.character(endPoint)) %>% + filter(!is.na(EAR)) chemicalSummary_passive <- chemicalSummary_passive %>% mutate(site=paste0("USGS-",gsub("[^0-9]", "", as.character(site))))%>% @@ -294,7 +298,6 @@ This table focuses on the individual endpoint/compound combinations and the prev chemSum3 <- chemicalSummary %>% - mutate(hits= as.numeric(EAR > 0.1)) %>% group_by(chnm, class, site, endPoint) %>% summarize(hits=as.numeric(any(hits > 0)), maxEAR=max(EAR)) %>% @@ -302,10 +305,11 @@ chemSum3 <- chemicalSummary %>% summarize(freq=sum(hits)/n_distinct(site), nSites=sum(hits), maxEAR=max(maxEAR)) %>% - mutate(endPoint=as.character(endPoint))%>% - left_join(endPointInfo, by=c("endPoint"="assay_component_endpoint_name")) %>% + rename(assay_component_endpoint_name=endPoint) %>% + data.table() %>% + left_join(data.table(endPointInfo), by="assay_component_endpoint_name") %>% select(chnm, maxEAR, freq, nSites, - endPoint, class, contains("intended_target_")) %>% + endPoint=assay_component_endpoint_name, class, contains("intended_target_")) %>% rename(type=intended_target_type, type_sub=intended_target_type_sub, family=intended_target_family, family_sub=intended_target_family_sub) %>% select(-contains("intended_target_")) %>% @@ -318,24 +322,9 @@ chemSum3 <- chemicalSummary %>% formatRound(c("maxEAR", "freq"), digits = 2) -totalSamples_ep <- select(chemicalSummary,site,endPoint) %>% - distinct()%>% - group_by(endPoint) %>% - summarise(totalSites=n())%>% - mutate(endPoint=as.character(endPoint)) +endpointSummary <- endPointSumm(chemicalSummary, endPointInfo=endPointInfo) -endpointSummary <- chemicalSummary %>% - mutate(hits= as.numeric(EAR > 0.1)) %>% - group_by(site, endPoint) %>% - summarize(hits=as.numeric(any(hits > 0)), - maxEAR=max(EAR)) %>% - group_by(endPoint) %>% - summarize(nSites=sum(hits), - maxEAR=max(maxEAR)) %>% - mutate(endPoint=as.character(endPoint))%>% - left_join(endPointInfo, by=c("endPoint"="assay_component_endpoint_name")) %>% - left_join(totalSamples_ep, by=c("endPoint")) %>% - mutate(freq=nSites/totalSites)%>% +endpointSummary <- endpointSummary %>% select(endPoint, maxEAR, freq, nSites, endPoint, contains("intended_target_")) %>% rename(type=intended_target_type, type_sub=intended_target_type_sub, @@ -504,8 +493,8 @@ This table focuses on the individual endpoint/compound combinations, and the pre chemSum3_passive <- chemicalSummary_passive %>% - group_by(chnm, class, site, endPoint) %>% - summarize(hits= as.numeric(any(EAR > 0.1))) %>% +# group_by(chnm, class, site, endPoint) %>% +# summarize(hits= as.numeric(any(EAR > 0.1))) %>% group_by(chnm, class, endPoint) %>% summarize(freq=sum(hits)/n_distinct(site), nSites=sum(hits)) diff --git a/inst/doc/SummaryToxCast.html b/inst/doc/SummaryToxCast.html index f1b72b87..8fe03539 100644 --- a/inst/doc/SummaryToxCast.html +++ b/inst/doc/SummaryToxCast.html @@ -15,9 +15,9 @@ - + - + @@ -39,7 +39,7 @@
@@ -199,27 +199,27 @@

2 ToxCast, Water Sample Data

2.1 ToxCast, Water Samples: Detection Levels

As an initial exploration of limitations of using ToxCast with the water sample data, ToxCast endpoints were compared with detection levels for each analyzed compound. The exposure:activity ratio (EAR) for a concentration at the detection level for the endpoint with the minimum AC50 for that chemical is presented in this table. Only compounds with detection levels great than 10% of the lowest AC50 are included.

-

-

+

+

2.2 ToxCast, Water Samples: Chemical Summary Tables

This table focuses on the individual compounds and the prevalence of potential adverse biological effects (57 total sites). The table can be sorted by the fraction of sites with hits, maximum EAR, and number of endpoints with hits to evaluate results based on different priorities. “Hits” are defined as EAR > 0.1, indicating that the measured concentration is 10% of the AC50 or greater.

-

-

+

+

2.2.1 ToxCast, Water Samples: Individual EndPoints

This table focuses on the individual endpoint/compound combinations and the prevalence of potential adverse biological effects (57 total sites). The table can be sorted by the fraction of sites with hits, maximum EAR, endpoints with hits, and several variables that describe the ToxCast endpoints to evaluate results based on different priorities. “Hits” are defined as EAR > 0.1, indicating that the measured concentration is 10% of the AC50 or greater.

-

-
-

+

+
+

2.3 ToxCast, Water Samples: Site Summaries

This table focuses on the individual sites and the prevalence of potential adverse biological effects (39 total chemicals included in ToxCast). The table can be sorted by the fraction of samples with hits, number of chemicals with hits, number of endpoints with hits, maximum EAR, and land cover attributes to evaluate results based on different priorities. “Hits” are defined as EAR > 0.1, indicating that the measured concentration is 10% of the AC50 or greater.

-

-

+

+

2.4 ToxCast, Water Sample: Boxplots by Site

@@ -274,28 +274,26 @@

3 ToxCast, Passive Data

3.1 ToxCast, Passive: Detection Levels

As an initial exploration of limitations of using ToxCast with the passive data, ToxCast endpoints were compared with detection levels (MQL) for each analyzed compound. The exposure:activity ratio (EAR) for a concentration at the detection level is presented in this table. Only compounds with detection levels great than 10% of the lowest AC50 are included.

-

-

+

+

3.2 ToxCast, Passive: Chemical Summary Tables

This table focuses on the individual compounds, and the prevalence of potential adverse biological effects (57 total sites). The table can be sorted by the fraction of sites with hits, maximum exposure:activity ratio (EAR), and number of endpoints with hits to evaluate results based on different priorities. “Hits” are defined as EAR > 0.1, indicating that the measured concentration is 10% of the AC50 or greater.

-

-

+

+

3.2.1 ToxCast, Passive: Individual EndPoints

This table focuses on the individual endpoint/compound combinations, and the prevalence of potential adverse biological effects (57 total sites). The table can be sorted by the fraction of sites with hits, maximum exposure:activity ratio (EAR), endpoints with hits, and several variables that describe the ToxCast endpoints to evaluate results based on different priorities. “Hits” are defined as EAR > 0.1, indicating that the measured concentration is 10% of the AC50 or greater.

-
## Warning in left_join_impl(x, y, by$x, by$y): joining character vector and
-## factor, coercing into character vector
-

-

+

+

3.3 ToxCast, Passive: Site Summaries

This table focuses on the individual sites, and the prevalence of potential adverse biological effects (51 total chemicals included in ToxCast). The table can be sorted by number of chemicals with hits, number of endpoints with hits, maximum exposure:activity ratio (EAR), and land cover attributes to evaluate results based on different priorities. “Hits” are defined as EAR > 0.1, indicating that the measured concentration is 10% of the AC50 or greater.

-

-

+

+

3.4 ToxCast, Passive: Boxplots by Sites

@@ -319,20 +317,20 @@

4 Water Quality Guidelines, Water

4.1 Water Quality Guidelines, Water Samples: Detection Levels

As an initial exploration of limitations of using water quality guidelines with the water sample data, water quality guidelines endpoints were compared with detection levels for each analyzed compound. The exposure:activity ratio (EAR) for a concentration at the detection level is presented in this table. Only compounds with detection levels great than 10% of the lowest AC50 are included.

-

-

+

+

4.2 Water Quality Guidelines, Water Samples: Chemical Summary Tables

This table focuses on the individual compounds, and the prevalence of potential adverse biological effects (57 total sites). The table can be sorted by the fraction of sites with hits, maximum EAR, and number of endpoints with hits to evaluate results based on different priorities.“Hits” are defined as EAR > 0.1, indicating that the measured concentration is 10% of the AC50 or greater.

-

-

+

+

4.3 Water Quality Guidelines, Water Samples: Site Summaries

This table focuses on the individual endpoint/compound combinations, and the prevalence of potential adverse biological effects (57 total sites). The table can be sorted by the fraction of sites with hits, maximum EAR, endpoints with hits, and several variables that describe the water quality benchmark endpoints to evaluate results based on different priorities.“Hits” are defined as EAR > 0.1, indicating that the measured concentration is 10% of the AC50 or greater.

-

-

+

+

4.4 Water Quality Guidelines, Water Samples: Boxplots by Site

@@ -535,22 +533,22 @@

6 Maps

6.1 ToxCast, Water Samples: Map

This map summarizes the water sample ToxCast results by showing maximum exposure:activity ratio (EAR) for each site as the color scale, and number of chemicals with hits as the symbol size. Additional information is available by clicking on the points.

Color: Maximum EAR
Size: Number of chemicals with hits (0-19)

-

-

+

+

6.2 ToxCast, Passive: Map

This map summarizes the passive ToxCast results by showing maximum exposure:activity ratio (EAR) for each site as the color scale, and number of chemicals with hits as the symbol size. Additional information is available by clicking on the points.

Color: Maximum EAR
Size: Number of chemicals with hits (0-3)

-

-

+

+

6.3 Water Quality Guidelines, Water Samples: Map

This map summarizes the passive water quality guideline results by showing maximum exposure:activity ratio (EAR) for each site as the color scale, and number of chemicals with hits as the symbol size. Additional information is available by clicking on the points.

Color: Maximum EAR
Size: Number of chemicals with hits (0-10)

-

-

+

+

diff --git a/inst/doc/endPointExploration.R b/inst/doc/endPointExploration.R new file mode 100644 index 00000000..894a2dde --- /dev/null +++ b/inst/doc/endPointExploration.R @@ -0,0 +1,108 @@ +## ----message=FALSE, echo=TRUE, results='asis'---------------------------- +library(toxEval) +library(DT) +library(dplyr) +library(tidyr) + +wData <- wData +pCodeInfo <- pCodeInfo + +packagePath <- system.file("extdata", package="toxEval") +filePath <- file.path(packagePath, "stationINFO.RData") +load(file=filePath) + +endPoint <- endPointToxCreate(pCodeInfo) +chemicalSummary <- chemSummBasic(wData,pCodeInfo,endPoint) +endPointInfo <- endPointInfo +# epSumm <- endPointSumm(chemicalSummary, endPointInfo=endPointInfo) + +siteKey <- setNames(stationINFO$shortName, stationINFO$fullSiteID) +summary <- siteSumm(chemicalSummary,siteKey) + + +## ------------------------------------------------------------------------ +group <- "transcription factor" +groupCol <- "intended_target_type_sub" +chemicalSummary.site <- "site" +chemicalSummary.Key <- "endPoint" +chemicalSummary.Date <- "date" +funcToSummerise <- "sumEAR" + +endPointInfoSub <- select_(endPointInfo, "assay_component_endpoint_name", groupCol) %>% + unique() + +chemicalSummary <- chemicalSummary %>% + filter(endPoint %in% endPointInfoSub$assay_component_endpoint_name ) %>% + left_join(endPointInfoSub, + by=c("endPoint"="assay_component_endpoint_name")) + +groupSumm <- chemicalSummary %>% + group_by(site) %>% + summarise(nChem = length(unique(chnm)), + nEndPoints = length(unique(endPoint))) %>% + select(nChem,nEndPoints) %>% + mutate(nChem = median(nChem), + nEndPoints = median(nEndPoints)) %>% + unique() + +endpointSummary <- chemicalSummary %>% + filter_(paste0(groupCol," == '", group, "'")) %>% + select_("hits","EAR","endPoint", + chemicalSummary.site,chemicalSummary.Date,groupCol) %>% + group_by_(chemicalSummary.site, chemicalSummary.Date) %>% + summarise(sumEAR = sum(EAR), + nHits = sum(hits)) + +statsOfSum <- endpointSummary%>% + group_by_(chemicalSummary.site) %>% + summarise_(meanEAR = paste0("mean(",funcToSummerise,")"), + # medianEAR = paste0("median(",funcToSummerise,")"), + maxEAR = paste0("max(",funcToSummerise,")"), + sumHits = "sum(nHits)", + nSamples = "n()")%>% + data.frame()%>% + mutate(site = siteKey[site]) + + + + + +datatable(statsOfSum, rownames = FALSE, + caption=paste("Summary of", funcToSummerise, "of",group)) %>% + formatRound(c("meanEAR","maxEAR","sumHits","nSamples"), + digits = 1) + + + +## ----fig.width=7, fig.height=7------------------------------------------- +library(ggplot2) + +siteLimits <- stationINFO %>% + mutate(lakeCat = factor(Lake, + levels=c("Lake Superior","Lake Michigan", + "Lake Huron", "St. Lawrence River", + "Detroit River and Lake St. Clair","Lake Erie","Lake Ontario"))) %>% + arrange(lakeCat) %>% + mutate(lakeColor = c("red","black","green","brown","brown","brown","blue")[as.numeric(lakeCat)] ) %>% + filter(fullSiteID %in% unique(endpointSummary$site)) + + +endPointSummBP <- endpointSummary %>% + data.frame()%>% + mutate(site = siteKey[site]) %>% + mutate(site = factor(site, levels=siteLimits$Station.shortname)) + +sToxWS <- ggplot(endPointSummBP, aes(x=site, y=sumEAR)) + + geom_boxplot() + + theme(axis.text.x = element_text(angle = 90, hjust = 1,vjust=0.25, colour=siteLimits$lakeColor), + legend.position = "none")+ + scale_x_discrete(limits=siteLimits$Station.shortname) + + # scale_y_log10(limits=c(0.03,5000)) + + # labs(x = "Site") + + geom_text(data=data.frame(), aes(x=c(5, 18,31,45,56), + y=-.5, label=c("Superior","Michigan","Huron","Erie","Ontario")), + colour=factor(c("red","black","green","brown","blue"), + levels=c("red","black","green","brown","blue")), size=3) + +sToxWS + diff --git a/inst/doc/endPointExploration.Rmd b/inst/doc/endPointExploration.Rmd new file mode 100644 index 00000000..83d73433 --- /dev/null +++ b/inst/doc/endPointExploration.Rmd @@ -0,0 +1,127 @@ +--- +title: "EndpointExploration" +author: "USGS: Steve Corsi, Laura DeCicco, Austin Baldwin, David Alvarez, Peter Lenaker
USEPA: Anthony Schroeder, Dan Villeneuve, Brett Blackwell, Gerald Ankley" +date: "`r format(Sys.time(), '%d %B, %Y')`" +output: + rmarkdown::html_vignette: + toc: true + number_sections: true + fig_caption: yes +vignette: > + %\VignetteEngine{knitr::rmarkdown} + %\VignetteIndexEntry{ToxEval Summary} + \usepackage[utf8]{inputenc} +--- + +```{r message=FALSE, echo=TRUE, results='asis'} +library(toxEval) +library(DT) +library(dplyr) +library(tidyr) + +wData <- wData +pCodeInfo <- pCodeInfo + +packagePath <- system.file("extdata", package="toxEval") +filePath <- file.path(packagePath, "stationINFO.RData") +load(file=filePath) + +endPoint <- endPointToxCreate(pCodeInfo) +chemicalSummary <- chemSummBasic(wData,pCodeInfo,endPoint) +endPointInfo <- endPointInfo +# epSumm <- endPointSumm(chemicalSummary, endPointInfo=endPointInfo) + +siteKey <- setNames(stationINFO$shortName, stationINFO$fullSiteID) +summary <- siteSumm(chemicalSummary,siteKey) + +``` + + +```{r } +group <- "transcription factor" +groupCol <- "intended_target_type_sub" +chemicalSummary.site <- "site" +chemicalSummary.Key <- "endPoint" +chemicalSummary.Date <- "date" +funcToSummerise <- "sumEAR" + +endPointInfoSub <- select_(endPointInfo, "assay_component_endpoint_name", groupCol) %>% + unique() + +chemicalSummary <- chemicalSummary %>% + filter(endPoint %in% endPointInfoSub$assay_component_endpoint_name ) %>% + left_join(endPointInfoSub, + by=c("endPoint"="assay_component_endpoint_name")) + +groupSumm <- chemicalSummary %>% + group_by(site) %>% + summarise(nChem = length(unique(chnm)), + nEndPoints = length(unique(endPoint))) %>% + select(nChem,nEndPoints) %>% + mutate(nChem = median(nChem), + nEndPoints = median(nEndPoints)) %>% + unique() + +endpointSummary <- chemicalSummary %>% + filter_(paste0(groupCol," == '", group, "'")) %>% + select_("hits","EAR","endPoint", + chemicalSummary.site,chemicalSummary.Date,groupCol) %>% + group_by_(chemicalSummary.site, chemicalSummary.Date) %>% + summarise(sumEAR = sum(EAR), + nHits = sum(hits)) + +statsOfSum <- endpointSummary%>% + group_by_(chemicalSummary.site) %>% + summarise_(meanEAR = paste0("mean(",funcToSummerise,")"), + # medianEAR = paste0("median(",funcToSummerise,")"), + maxEAR = paste0("max(",funcToSummerise,")"), + sumHits = "sum(nHits)", + nSamples = "n()")%>% + data.frame()%>% + mutate(site = siteKey[site]) + + + + + +datatable(statsOfSum, rownames = FALSE, + caption=paste("Summary of", funcToSummerise, "of",group)) %>% + formatRound(c("meanEAR","maxEAR","sumHits","nSamples"), + digits = 1) + + +``` + + +```{r fig.width=7, fig.height=7,} +library(ggplot2) + +siteLimits <- stationINFO %>% + mutate(lakeCat = factor(Lake, + levels=c("Lake Superior","Lake Michigan", + "Lake Huron", "St. Lawrence River", + "Detroit River and Lake St. Clair","Lake Erie","Lake Ontario"))) %>% + arrange(lakeCat) %>% + mutate(lakeColor = c("red","black","green","brown","brown","brown","blue")[as.numeric(lakeCat)] ) %>% + filter(fullSiteID %in% unique(endpointSummary$site)) + + +endPointSummBP <- endpointSummary %>% + data.frame()%>% + mutate(site = siteKey[site]) %>% + mutate(site = factor(site, levels=siteLimits$Station.shortname)) + +sToxWS <- ggplot(endPointSummBP, aes(x=site, y=sumEAR)) + + geom_boxplot() + + theme(axis.text.x = element_text(angle = 90, hjust = 1,vjust=0.25, colour=siteLimits$lakeColor), + legend.position = "none")+ + scale_x_discrete(limits=siteLimits$Station.shortname) + + # scale_y_log10(limits=c(0.03,5000)) + + # labs(x = "Site") + + geom_text(data=data.frame(), aes(x=c(5, 18,31,45,56), + y=-.5, label=c("Superior","Michigan","Huron","Erie","Ontario")), + colour=factor(c("red","black","green","brown","blue"), + levels=c("red","black","green","brown","blue")), size=3) + +sToxWS +``` diff --git a/inst/doc/endPointExploration.html b/inst/doc/endPointExploration.html new file mode 100644 index 00000000..7e8c0eee --- /dev/null +++ b/inst/doc/endPointExploration.html @@ -0,0 +1,185 @@ + + + + + + + + + + + + + +EndpointExploration + + + + + + + + + + + + + + + + + + + + + + + + + +
library(toxEval)
+library(DT)
+library(dplyr)
+library(tidyr)
+
+wData <- wData
+pCodeInfo <- pCodeInfo
+
+packagePath <- system.file("extdata", package="toxEval")
+filePath <- file.path(packagePath, "stationINFO.RData")
+load(file=filePath)
+
+endPoint <- endPointToxCreate(pCodeInfo)
+chemicalSummary <- chemSummBasic(wData,pCodeInfo,endPoint)
+endPointInfo <- endPointInfo
+# epSumm <- endPointSumm(chemicalSummary, endPointInfo=endPointInfo)
+
+siteKey <- setNames(stationINFO$shortName, stationINFO$fullSiteID)
+summary <- siteSumm(chemicalSummary,siteKey)
+
group <- "transcription factor"
+groupCol <- "intended_target_type_sub"
+chemicalSummary.site <- "site"
+chemicalSummary.Key <- "endPoint"
+chemicalSummary.Date <- "date"
+funcToSummerise <- "sumEAR"
+
+endPointInfoSub <- select_(endPointInfo, "assay_component_endpoint_name", groupCol) %>%
+  unique()
+
+chemicalSummary <- chemicalSummary %>%
+  filter(endPoint %in% endPointInfoSub$assay_component_endpoint_name ) %>%
+  left_join(endPointInfoSub,
+            by=c("endPoint"="assay_component_endpoint_name"))
+
+groupSumm <- chemicalSummary %>%
+  group_by(site) %>%
+  summarise(nChem = length(unique(chnm)),
+            nEndPoints = length(unique(endPoint))) %>%
+      select(nChem,nEndPoints) %>%
+      mutate(nChem = median(nChem),
+             nEndPoints = median(nEndPoints)) %>%
+      unique()
+
+endpointSummary <- chemicalSummary %>%
+  filter_(paste0(groupCol," == '", group, "'")) %>%
+  select_("hits","EAR","endPoint",
+          chemicalSummary.site,chemicalSummary.Date,groupCol) %>%
+  group_by_(chemicalSummary.site, chemicalSummary.Date) %>%
+  summarise(sumEAR = sum(EAR),
+            nHits = sum(hits)) 
+
+statsOfSum <- endpointSummary%>%
+  group_by_(chemicalSummary.site) %>%
+  summarise_(meanEAR = paste0("mean(",funcToSummerise,")"),
+             # medianEAR = paste0("median(",funcToSummerise,")"),
+             maxEAR = paste0("max(",funcToSummerise,")"),
+             sumHits = "sum(nHits)",
+             nSamples = "n()")%>%
+  data.frame()%>%
+  mutate(site = siteKey[site])
+  
+
+
+
+
+datatable(statsOfSum, rownames = FALSE, 
+          caption=paste("Summary of", funcToSummerise, "of",group))  %>% 
+    formatRound(c("meanEAR","maxEAR","sumHits","nSamples"), 
+                digits = 1)
+

+

+
library(ggplot2)
+
+siteLimits <- stationINFO %>%
+  mutate(lakeCat = factor(Lake, 
+            levels=c("Lake Superior","Lake Michigan",
+                     "Lake Huron", "St. Lawrence River",
+                     "Detroit River and Lake St. Clair","Lake Erie","Lake Ontario"))) %>%
+  arrange(lakeCat) %>%
+  mutate(lakeColor = c("red","black","green","brown","brown","brown","blue")[as.numeric(lakeCat)] ) %>%
+  filter(fullSiteID %in% unique(endpointSummary$site))
+  
+
+endPointSummBP <- endpointSummary %>%
+  data.frame()%>%
+  mutate(site = siteKey[site]) %>%
+  mutate(site = factor(site, levels=siteLimits$Station.shortname)) 
+
+sToxWS <- ggplot(endPointSummBP, aes(x=site, y=sumEAR)) +
+  geom_boxplot() +
+  theme(axis.text.x = element_text(angle = 90, hjust = 1,vjust=0.25, colour=siteLimits$lakeColor), 
+        legend.position = "none")+
+  scale_x_discrete(limits=siteLimits$Station.shortname) +
+  # scale_y_log10(limits=c(0.03,5000)) +
+  # labs(x = "Site")  +
+  geom_text(data=data.frame(), aes(x=c(5, 18,31,45,56),
+                                   y=-.5, label=c("Superior","Michigan","Huron","Erie","Ontario")),
+                                   colour=factor(c("red","black","green","brown","blue"),
+                                                 levels=c("red","black","green","brown","blue")), size=3) 
+
+sToxWS
+
+ + +
+ + + + + + + + diff --git a/inst/doc/siteTables.html b/inst/doc/siteTables.html index d95eaf9a..0a0548d8 100644 --- a/inst/doc/siteTables.html +++ b/inst/doc/siteTables.html @@ -27,7 +27,7 @@
diff --git a/inst/shiny/server.R b/inst/shiny/server.R index 8f4f7210..09e9bb92 100644 --- a/inst/shiny/server.R +++ b/inst/shiny/server.R @@ -72,12 +72,16 @@ shinyServer(function(input, output) { chemicalSummary <- rbind(chemicalSummaryWS, chemicalSummaryPS) } + chemicalSummary$grouping <- chemicalSummary$chnm + chemicalSummary }) chemicalSummaryFiltered <- reactive({ + chemicalSummary <- chemicalSummary() + if(is.null(input$groupCol)){ groupCol <- names(endPointInfo)[20] } else { @@ -87,7 +91,7 @@ shinyServer(function(input, output) { endPointInfoSub <- select_(endPointInfo, "assay_component_endpoint_name", groupCol) %>% distinct() - chemicalSummaryFiltered <- chemicalSummary() %>% + chemicalSummaryFiltered <- chemicalSummary %>% rename(assay_component_endpoint_name=endPoint) %>% filter(assay_component_endpoint_name %in% endPointInfoSub$assay_component_endpoint_name ) %>% data.table()%>% @@ -135,11 +139,25 @@ shinyServer(function(input, output) { siteToFind <- input$sites } + if(is.null(input$radio)){ + radio <- 1 + } else { + radio <- input$radio + } + + if(radio == 2){ + chemicalSummaryFiltered <- chemicalSummaryFiltered %>% + mutate(grouping=class) + } else { + chemicalSummaryFiltered <- chemicalSummaryFiltered %>% + mutate(grouping=chnm) + } + chemSiteSumm <- chemicalSummaryFiltered %>% filter_(paste0(groupCol," == '", group, "'")) %>% mutate(site = siteKey[site]) %>% filter(site %in% siteToFind) %>% - group_by(chnm, date) %>% + group_by(grouping, date) %>% summarise(sumEAR = sum(EAR), nHits = sum(hits)) @@ -168,11 +186,25 @@ shinyServer(function(input, output) { siteToFind <- input$sites } + if(is.null(input$radio)){ + radio <- 1 + } else { + radio <- input$radio + } + + if(radio == 2){ + chemicalSummaryFiltered <- chemicalSummaryFiltered %>% + mutate(grouping=class) + } else { + chemicalSummaryFiltered <- chemicalSummaryFiltered %>% + mutate(grouping=chnm) + } + groupSiteSumm <- chemicalSummaryFiltered %>% filter_(paste0(groupCol," == '", group, "'")) %>% mutate(site = siteKey[site]) %>% filter(site %in% siteToFind) %>% - group_by(chnm, date) %>% + group_by(grouping, date) %>% summarise(sumEAR = sum(EAR), nHits = sum(hits)) @@ -223,9 +255,9 @@ shinyServer(function(input, output) { statsOfChem <- reactive({ chemSiteSumm <- chemSiteSumm() - + statsOfChem <- chemSiteSumm %>% - group_by(chnm) %>% + group_by(grouping) %>% summarise(meanEAR = mean(sumEAR), maxEAR = max(sumEAR), sumHits = sum(nHits), @@ -252,6 +284,12 @@ shinyServer(function(input, output) { groupCol <- input$groupCol } + if(is.null(input$radio)){ + radio <- 1 + } else { + radio <- input$radio + } + statsOfColumn <- chemicalSummary %>% rename(assay_component_endpoint_name=endPoint) %>% filter(assay_component_endpoint_name %in% endPointInfo$assay_component_endpoint_name ) %>% @@ -264,11 +302,15 @@ shinyServer(function(input, output) { if(length(siteToFind) == 1){ # statsOfColumn <- filter_(statsOfColumn, paste0("site == '", siteToFind, "'")) - statsOfColumn <- filter(statsOfColumn, site %in% siteToFind) %>% - mutate(site = chnm) + statsOfColumn <- filter(statsOfColumn, site %in% siteToFind) + if(radio == 2){ + statsOfColumn <- mutate(statsOfColumn, site = class) + } else { + statsOfColumn <- mutate(statsOfColumn, site = chnm) + } } - + statsOfColumn <- statsOfColumn %>% group_by(site, date,choices) %>% summarise(sumEAR = sum(EAR), @@ -294,6 +336,12 @@ shinyServer(function(input, output) { groupCol <- input$groupCol } + if(is.null(input$radio)){ + radio <- 1 + } else { + radio <- input$radio + } + chemGroup <- chemicalSummary %>% rename(assay_component_endpoint_name=endPoint) %>% filter(assay_component_endpoint_name %in% endPointInfo$assay_component_endpoint_name ) %>% @@ -303,6 +351,15 @@ shinyServer(function(input, output) { mutate(site = siteKey[site]) %>% rename(endPoint=assay_component_endpoint_name) %>% select_("hits","EAR","chnm","class","site","date","choices"=groupCol) + + if(radio == 2){ + chemGroup <- chemGroup %>% + mutate(grouping=class) + } else { + chemGroup <- chemGroup %>% + mutate(grouping=chnm) + } + }) statsOfGroup <- reactive({ @@ -324,12 +381,12 @@ shinyServer(function(input, output) { stats2 <- chemGroup %>% filter(site %in% siteToFind) %>% group_by(site,choices) %>% - summarise(nChem = length(unique(chnm[EAR > 0.1]))) + summarise(nChem = length(unique(grouping[EAR > 0.1]))) statsOfGroup <- chemGroup %>% filter(site %in% siteToFind) %>% group_by(site, date,choices) %>% - summarise(nChemWithHits = length(unique(chnm[EAR > 0.1]))) %>% + summarise(nChemWithHits = length(unique(grouping[EAR > 0.1]))) %>% group_by(site,choices) %>% summarise(maxChem = max(nChemWithHits), meanChem = mean(nChemWithHits)) %>% @@ -352,23 +409,33 @@ shinyServer(function(input, output) { }) output$TableHeader <- renderUI({ - HTML(paste("

Table of summations summaries:",input$group,"-",input$data,"

")) + HTML(paste("

Table of summations summaries:", + input$group,"-",input$data,": ",input$sites, + "

")) }) output$BoxHeader <- renderUI({ - HTML(paste("

Boxplot summaries:",input$group,"-",input$data,"

")) + HTML(paste("

", + input$group,"-",input$data,": ",input$sites, + "

")) }) output$TableHeaderColumns <- renderUI({ - HTML(paste("

Table of summations summaries:",input$groupCol,"-",input$data,"

")) + HTML(paste("

Table of summations summaries:", + input$groupCol,"-",input$data,": ",input$sites, + "

")) }) output$TableHeaderColumns2 <- renderUI({ - HTML(paste("

Table of chemical summaries:",input$groupCol,"-",input$data,"

")) + HTML(paste("

Table of chemical summaries:", + input$groupCol,"-",input$data,": ",input$sites, + "

")) }) output$BoxHeaderColumns <- renderUI({ - HTML(paste("

Boxplot summaries:",input$groupCol,"-",input$data,"

")) + HTML(paste("

Boxplot summaries:", + input$groupCol,"-",input$data,": ",input$sites, + "

")) }) output$table <- DT::renderDataTable({ @@ -414,6 +481,12 @@ shinyServer(function(input, output) { siteToFind <- input$sites } + if(is.null(input$radio)){ + radio <- 1 + } else { + radio <- input$radio + } + if(length(siteToFind) > 1){ statsOfGroup <- statsOfGroup %>% @@ -438,6 +511,10 @@ shinyServer(function(input, output) { colors <- brewer.pal(length(maxChem),"Blues") #"RdYlBu" + if(radio == 2){ + names(statsOfGroup) <- gsub("Chem","Class",names(statsOfGroup)) + } + tableGroup <- DT::datatable(statsOfGroup, rownames = FALSE, filter = 'top', @@ -595,27 +672,28 @@ shinyServer(function(input, output) { siteLimits <- stationINFO %>% filter(shortName %in% unique(chemGroup$site)) - + chemGroupBP <- chemGroup %>% filter(EAR >= 0.1) %>% - select(EAR, chnm, site, choices, date) %>% + select(EAR, grouping, site, choices, date) %>% data.frame() %>% filter_(paste0("choices == '", group, "'")) %>% select(-choices) %>% - mutate(chnm=factor(chnm, levels=unique(chnm))) %>% + mutate(grouping=factor(grouping, levels=unique(grouping))) %>% mutate(date = factor(as.numeric(date) - min(as.numeric(date))))%>% - arrange(chnm) + arrange(grouping) - uniqueChms <- as.character(unique(chemGroupBP$chnm)) + uniqueChms <- as.character(unique(chemGroupBP$grouping)) if(length(siteToFind) > 1){ - sToxWS <- ggplot(chemGroupBP, aes(x=site, y=EAR, fill = chnm)) + + sToxWS <- ggplot(chemGroupBP, aes(x=site, y=EAR, fill = grouping)) + geom_bar(stat="identity") + theme(axis.text.x = element_text(angle = 90, hjust = 1,vjust=0.25, colour=siteLimits$lakeColor)) + scale_x_discrete(limits=siteLimits$Station.shortname) + - xlab("") + xlab("") + + scale_fill_discrete("") } else { @@ -623,15 +701,15 @@ shinyServer(function(input, output) { filter_(paste0("site == '", siteToFind, "'")) %>% select(-site) - levels(chemGroupBPOneSite$chnm) <- uniqueChms + levels(chemGroupBPOneSite$grouping) <- uniqueChms - sToxWS <- ggplot(chemGroupBPOneSite, aes(x=date, y=EAR, fill = chnm)) + + sToxWS <- ggplot(chemGroupBPOneSite, aes(x=date, y=EAR, fill = grouping)) + geom_bar(stat="identity") + theme(axis.text.x=element_blank(), axis.ticks=element_blank())+ xlab("Individual Samples") + - scale_fill_discrete(drop=FALSE) - + scale_fill_discrete(drop=FALSE) + + labs(fill="") } sToxWS @@ -641,10 +719,10 @@ shinyServer(function(input, output) { g <- ggplot_build(topPlots()) fillColors <- g$data[[1]]["fill"][[1]] - chnms <- g$plot$data$chnm + groupings <- g$plot$data$grouping - dfNames <- data.frame(chnm = names(table(chnms)[table(chnms) != 0]), - freq = as.numeric(table(chnms)[table(chnms) != 0]),stringsAsFactors = FALSE) + dfNames <- data.frame(grouping = names(table(groupings)[table(groupings) != 0]), + freq = as.numeric(table(groupings)[table(groupings) != 0]),stringsAsFactors = FALSE) dfCol <- data.frame(colors = names(table(fillColors)), freq = as.numeric(table(fillColors)),stringsAsFactors = FALSE) @@ -701,7 +779,9 @@ shinyServer(function(input, output) { scale_y_log10("Summation of EAR per sample") + coord_cartesian(ylim = c(0.1, 1.1*max(endPointSummBP$sumEARnoZero))) + xlab("") + } else { + chemSiteSumm <- chemSiteSumm() %>% mutate(sumEARnoZero = sumEAR) @@ -710,21 +790,21 @@ shinyServer(function(input, output) { if(is.finite(ndLevel)){ chemSiteSumm$sumEARnoZero[chemSiteSumm$sumEARnoZero == 0] <- ndLevel - chemicals <- unique(chemSiteSumm$chnm)[!(unique(chemSiteSumm$chnm) %in% colorKey$chnm)] + chemicals <- unique(chemSiteSumm$grouping)[!(unique(chemSiteSumm$grouping) %in% colorKey$grouping)] - noFill <- data.frame(chnm=chemicals, + noFill <- data.frame(grouping=chemicals, colors=rep("#FFFFFF",length(chemicals)), stringsAsFactors = FALSE) - fillTotal <- rbind(colorKey[,c('colors','chnm')], noFill) + fillTotal <- rbind(colorKey[,c('colors','grouping')], noFill) sToxWS <- ggplot(chemSiteSumm) if(!is.null(input$data) && input$data != "Passive Samples"){ - sToxWS <- sToxWS + geom_boxplot(aes(x=chnm, y=sumEAR, - fill=chnm)) + - scale_fill_manual(values=setNames(fillTotal$colors,fillTotal$chnm)) + sToxWS <- sToxWS + geom_boxplot(aes(x=grouping, y=sumEAR, + fill=grouping)) + + scale_fill_manual(values=setNames(fillTotal$colors,fillTotal$grouping)) } else { - sToxWS <- sToxWS + geom_point(aes(x=chnm, y=sumEAR)) + sToxWS <- sToxWS + geom_point(aes(x=grouping, y=sumEAR)) } sToxWS <- sToxWS + theme(axis.text.x = element_text(angle = 90, hjust = 1,vjust=0.25), legend.position = "none")+ diff --git a/inst/shiny/ui.R b/inst/shiny/ui.R index e6d829e6..8e0d402e 100644 --- a/inst/shiny/ui.R +++ b/inst/shiny/ui.R @@ -24,7 +24,10 @@ shinyUI( tags$div(class="header", checked=NA, tags$p("For annotation information, see: "), tags$a(href="http://www.epa.gov/ncct/toxcast/files/ToxCast%20Assays/ToxCast_Assay_Annotation_Data_Users_Guide_20141021.pdf", - "ToxCast")) + "ToxCast")), + radioButtons("radio", label = "", + choices = list("Chemical" = 1, "Class" = 2), + selected = 1) ), column(8, leaflet::leafletOutput("mymap") @@ -42,9 +45,9 @@ shinyUI( DT::dataTableOutput('tableSumm')), tabPanel("Chemical Tally Summary", htmlOutput("TableHeaderColumns2"), - h4("maxChem = Maximum (chemicals with hits per sample)"), - h4("meanChem = Mean (chemicals with hits per sample)"), - h4("nChem = Number of individual chemicals that have >= 1 hit"), + h4("maxChem = Maximum (chemicals/class with hits per sample)"), + h4("meanChem = Mean (chemicals/class with hits per sample)"), + h4("nChem = Number of individual chemicals/classes that have >= 1 hit"), DT::dataTableOutput('tableGroupSumm')), tabPanel("Visualizations", h3("To Do")) @@ -65,9 +68,11 @@ shinyUI( plotOutput("stackBar"), h3("All EARs"), plotOutput("graph") + ) + ) ) - ) + ) ) ) diff --git a/man/endPointSumm.Rd b/man/endPointSumm.Rd index 7188be6f..b50e1b36 100644 --- a/man/endPointSumm.Rd +++ b/man/endPointSumm.Rd @@ -25,6 +25,7 @@ endPointSumm(chemicalSummary, chemicalSummary.Key = "endPoint", Create chemical summary } \examples{ +\dontrun{ wData <- wData pCodeInfo <- pCodeInfo endPoint <- endPointToxCreate(pCodeInfo) @@ -32,4 +33,5 @@ chemicalSummary <- chemSummBasic(wData,pCodeInfo,endPoint) endPointInfo <- endPointInfo epSumm <- endPointSumm(chemicalSummary, endPointInfo=endPointInfo) } +} diff --git a/man/explore_endpoints.Rd b/man/explore_endpoints.Rd new file mode 100644 index 00000000..dff7852f --- /dev/null +++ b/man/explore_endpoints.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/explore_endpoints.R +\name{explore_endpoints} +\alias{explore_endpoints} +\title{Explore endpoint groupings} +\usage{ +explore_endpoints(browse = TRUE) +} +\arguments{ +\item{browse}{use browser for map rendering} +} +\description{ +Open an interactive app +} + diff --git a/man/siteSumm.Rd b/man/siteSumm.Rd index 39340a27..f6d6be84 100644 --- a/man/siteSumm.Rd +++ b/man/siteSumm.Rd @@ -15,6 +15,7 @@ siteSumm(chemicalSummary, newSiteKey) Create site summary } \examples{ +\dontrun{ wData <- wData pCodeInfo <- pCodeInfo packagePath <- system.file("extdata", package="toxEval") @@ -25,4 +26,5 @@ endPoint <- endPointToxCreate(pCodeInfo) chemicalSummary <- chemSummBasic(wData,pCodeInfo,endPoint) siteSummary <- siteSumm(chemicalSummary,newSiteKey) } +}