Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
^docs$
^pkgdown$
^CRAN-SUBMISSION$
^revdep$
^vignettes/articles$
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: GeoTox
Title: Spatiotemporal Mixture Risk Assessment
Version: 0.2.0.9002
Version: 0.3.0
Authors@R: c(
person("Skylar", "Marvel", , "skylar.marvel@nih.gov", role = c("aut"),
comment = c(ORCID = "0000-0002-2971-9743")),
Expand Down Expand Up @@ -49,5 +49,6 @@ Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
BugReports: https://github.com/NIEHS/GeoTox/issues
Config/Needs/website: rmarkdown
12 changes: 7 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# GeoTox (development version)
# GeoTox 0.3.0

* Fixed a bug that affected sensitivity analysis. The column order of C_ss
values used for sensitivity analysis is now explicitly ordered similar to other
functions.
* `compute_sensitivity()` and the wrapper `sensitivity_analysis()` now use fixed
Css data with column orders explicitly set to match other functions. The column
orders are now enforced in the underlying functions `get_fixed_age()`,
`get_fixed_obesity()`, and `get_fixed_params()`.

* Added set_population() function.
* Added `set_population()`, which allows for age and/or obesity status to be set
directly and not require simulation.

* The simulate\_\* functions can now handle population sizes that vary
across regions.
Expand Down
45 changes: 25 additions & 20 deletions R/GeoTox.R
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
#' GeoTox S3 object
#'
#'
#' @description
#' An S3 object that can be used to help organize the data and results of a
#' GeoTox analysis.
#'
#' @return a GeoTox S3 object
#' @export
#'
#'
#' @examples
#' # See the vignette for a full example:
#' # vignette("introduction", package = "geotox")
#'
#' \dontrun{
#' # Use a subset of the package data for demonstration purposes
#' set.seed(2357)
#' n <- 10 # Population size
#' m <- 5 # Number of regions
#' m <- 2 # Number of regions
#' idx <- if (m < 100) sample(1:100, m) else 1:100
#'
#' geoTox <- GeoTox() |>
#'
#' geoTox <- GeoTox() |>
#' # Set region and group boundaries (for plotting)
#' set_boundaries(region = geo_tox_data$boundaries$county,
#' group = geo_tox_data$boundaries$state) |>
#' group = geo_tox_data$boundaries$state) |>
#' # Simulate populations for each region
#' simulate_population(age = split(geo_tox_data$age, ~FIPS)[idx],
#' obesity = geo_tox_data$obesity[idx, ],
#' exposure = split(geo_tox_data$exposure, ~FIPS)[idx],
#' simulated_css = geo_tox_data$simulated_css,
#' n = n) |>
#' n = n) |>
#' # Estimated Hill parameters
#' set_hill_params(geo_tox_data$dose_response |>
#' fit_hill(assay = "endp", chem = "casn") |>
#' fit_hill(assay = "endp", chem = "casn") |>
#' dplyr::filter(!tp.sd.imputed, !logAC50.sd.imputed)) |>
#' # Calculate response
#' calculate_response() |>
#' # Perform sensitivity analysis
#' sensitivity_analysis()
#'
#'
#' # Print GeoTox object
#' geoTox
#'
#'
#' # Plot hill fits
#' plot(geoTox, type = "hill")
#' # Plot exposure data
Expand All @@ -46,6 +50,7 @@
#' plot(geoTox,
#' type = "sensitivity",
#' assay = "TOX21_H2AX_HTRF_CHO_Agonist_ratio")
#' }
GeoTox <- function() {
structure(
list(
Expand All @@ -69,7 +74,7 @@ GeoTox <- function() {

#' @export
print.GeoTox <- function(x, ...) {

# Get n_assay and n_chem from GeoTox()$hill_params
if (is.null(x$hill_params)) {
n_assay <- 0
Expand All @@ -86,7 +91,7 @@ print.GeoTox <- function(x, ...) {
n_chem <- 1
}
}

# Categorize different GeoTox() fields
names_data_vec <- c("age", "IR", "obesity")
names_data_mat <- c("C_ext", "C_ss")
Expand Down Expand Up @@ -130,19 +135,19 @@ print.GeoTox <- function(x, ...) {
}
data.frame(Name = name, Size = size)
}

# Get size info for each type of field
info_data <- dplyr::bind_rows(
purrr::map(names_data_vec, \(name) get_info_vec(name)),
purrr::map(names_data_mat, \(name) get_info_mat(name))) |>
purrr::map(names_data_mat, \(name) get_info_mat(name))) |>
dplyr::filter(.data$Size != "")

info_computed <- dplyr::bind_rows(
purrr::map(names_computed_mat, \(name) get_info_mat(name)),
purrr::map(names_computed_df, \(name) get_info_df(name)),
purrr::map(names_computed_list, \(name) get_info_list(name))) |>
purrr::map(names_computed_list, \(name) get_info_list(name))) |>
dplyr::filter(.data$Size != "")

# Get population size from GeoTox()$par$n
if (is.null(x$par$n)) {
n_pop <- 0
Expand All @@ -151,13 +156,13 @@ print.GeoTox <- function(x, ...) {
} else {
n_pop <- paste0("[", paste(range(x$par$n), collapse = ", "), "]")
}

# Get number of regions from potential data fields
n_region <- purrr::map_int(c(names_data_vec, names_data_mat,
names_computed_mat, names_computed_df),
\(name) length(x[[name]])) |>
\(name) length(x[[name]])) |>
max()

# Output info
cat("GeoTox object\n")
cat("Assays: ", n_assay, "\n", sep = "")
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Figure 1 below shows the steps in the source-to-outcome-continuum or GeoTox mode

## Getting Started

Please refer to the [introduction vignette](https://niehs.github.io/GeoTox/articles/introduction.html) for a detailed description of how to use `GeoTox`.
Please refer to the [package website](https://niehs.github.io/GeoTox/) for a detailed description of how to use `GeoTox`.

## Citation

Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ modeling. The package, methods, and case-studies are described in
[Messier, Reif, and Marvel, 2025, Human
Genomics](https://doi.org/10.1186/s40246-024-00711-8).


The GeoTox framework was first described in [Eccles et al. A geospatial
modeling approach to quantifying the risk of exposure to environmental
chemical mixtures via a common molecular target. Sci Total Environ. 2023
Expand Down Expand Up @@ -65,9 +64,8 @@ Overview of the steps in the GeoTox framework</em>

## Getting Started

Please refer to the [introduction
vignette](https://niehs.github.io/GeoTox/articles/introduction.html) for
a detailed description of how to use `GeoTox`.
Please refer to the [package website](https://niehs.github.io/GeoTox/)
for a detailed description of how to use `GeoTox`.

## Citation

Expand Down
6 changes: 4 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## R CMD check results

0 errors | 0 warnings | 1 note
0 errors | 0 warnings | 0 notes

* This is a new release.
## revdepcheck results

There are currently no downstream dependencies for this package
Loading