Package 'standartox'

Title: Ecotoxicological Information from the Standartox Database
Description: The Standartox database offers cleaned, harmonized and aggregated ecotoxicological test data, which can be used for assessing effects and risks of chemical concentrations found in the environment.
Authors: Andreas Scharmüller [aut, cre] (ORCID: <https://orcid.org/0000-0002-9290-3965>), Hannes Reinwald [ctb] (ORCID: <https://orcid.org/0000-0003-3133-679X>)
Maintainer: Andreas Scharmüller <[email protected]>
License: MIT + file LICENSE
Version: 1.0.0
Built: 2026-05-22 07:27:34 UTC
Source: https://github.com/andschar/standartox

Help Index


Retrieve Standartox Data Catalog

Description

Retrieves a catalog of all possible values for variables that can be used for filtering in stx_query(). This is useful for discovering valid inputs for parameters like endpoint_group, effect, or tax_group.

Usage

stx_catalog(silent = FALSE, stx_dir = file.path(tempdir(), "standartox"))

Arguments

silent

logical; If TRUE, suppresses messages during the download process. Default is FALSE.

stx_dir

character; Directory where the catalog file is stored. If the file doesn't exist, it will be downloaded to this location. Defaults to a "standartox" subdirectory within the session's temporary directory (tempdir()).

Value

Returns a list where each element is a character vector containing the unique values for a specific data field available for querying.

Author(s)

Andreas Scharmueller [email protected]

Hannes Reinwald

Examples

# This function might fail if there is no internet connection or Zenodo.org is not available

# Basic function call to retrieve the catalog
catalog_data <- stx_catalog()

# View the names of available fields in the catalog
names(catalog_data)

# See all possible values for 'endpoint_group'
print(catalog_data$endpoint_group)

# Get verbose output from the function
catalog_verbose <- stx_catalog(silent = FALSE)

# Specify a permanent directory to download and cache the catalog file.
# This speeds up future calls as the file won't need to be re-downloaded when starting a new session.
my_dir <- file.path("~","my_stx_data")
catalog_cached <- stx_catalog(stx_dir = my_dir, silent = FALSE)

Retrieve the Standartox Chemical Properties Table

Description

Provides direct access to the 'phch' data table, which contains chemical identifiers and physicochemical properties for all compounds in the Standartox database.

Usage

stx_chem(silent = FALSE, stx_dir = file.path(tempdir(), "standartox"))

Arguments

silent

logical; If 'TRUE', suppresses progress messages during download. Defaults to 'FALSE'.

stx_dir

character; Directory where the chemical data file is stored or should be downloaded. Defaults to a "standartox" subdirectory within the session's temporary directory (file.path(tempdir(), "standartox")).

Details

This function is a simple wrapper for stx_download(data_type = 'phch'). It is designed for users who want to explore the chemical inventory of the database, for instance, to find CAS numbers for use with stx_query.

Like other download functions in this package, it caches the data file locally to avoid re-downloading on subsequent calls.

Value

A data.table containing chemical information, including columns such as CAS number, chemical name, and other identifiers.

Author(s)

Andreas Scharmueller [email protected]

Hannes Reinwald

Examples

# This function may fail if there is no internet connection or Zenodo.org is not available

# Basic function call to retrieve the chemical data table
chem_data <- stx_chem()

# Inspect the first few rows and column names to see what's available
head(chem_data)
colnames(chem_data)

# Example of using a permanent directory to cache the data file
# The "Retrieving..." message will only appear on the first download.
my_dir <- file.path("~", "my_stx_data")
cached_chem_data <- stx_chem(stx_dir = my_dir, silent = FALSE)

Retrieve the Core Standartox Toxicity Data Table

Description

Provides direct access to the main 'test_fin' data table from the Standartox database, which contains the raw toxicity results.

Usage

stx_data(silent = FALSE, stx_dir = file.path(tempdir(), "standartox"))

Arguments

silent

logical; If 'TRUE', suppresses progress messages during download. Defaults to 'FALSE'.

stx_dir

character; Directory where the data file is stored or should be downloaded. Defaults to a "standartox" subdirectory within the session's temporary directory (file.path(tempdir(), "standartox")).

Details

This function is a simple wrapper for stx_download(data_type = 'test_fin'). It is designed for users who want the primary data table of toxicity test results without the additional chemical or detailed taxonomic information that stx_query automatically appends.

Like other download functions in this package, it caches the data file locally to avoid re-downloading on subsequent calls.

Value

A data.table containing the core toxicity test results, with columns for endpoints, duration, concentration, effect, etc.

Author(s)

Andreas Scharmueller [email protected]

Hannes Reinwald

Examples

# This function may fail if there is no internet connection or Zenodo.org is not available

# Basic function call to retrieve the main data table
tox_data <- stx_data()

# Inspect the first few rows and column names to understand the structure
head(tox_data)
colnames(tox_data)

# Example of using a permanent directory to cache the data
# The message "Retrieving Standartox data.." will only appear on the first download.
my_dir <- file.path("~", "my_stx_data")
cached_data <- stx_data(stx_dir = my_dir, silent = FALSE)

Retrieve meta data

Description

Retrieve meta data

Usage

stx_meta(silent = FALSE, stx_dir = file.path(tempdir(), "standartox"))

Arguments

silent

logical; If TRUE, suppresses messages. Default is FALSE.

stx_dir

character; Directory to which the meta information should be downloaded. Default is a temporary directory.#'

Value

Returns a data.table containing meta informaiton on Standartox.

Author(s)

Andreas Scharmueller [email protected]

Hannes Reinwald

Examples

# might fail if there is no internet connection or Zenodo.org not not available
# basic function call
df = stx_meta()

# to get verbose output from the function
df = stx_meta(silent = FALSE)

# to specify a directory to which the taxa information should be downloaded
df = stx_meta(silent = FALSE, stx_dir = "~/tmp")
# This will create a directory under ~/tmp and download the respective standartox file to that directory.
# The files are then permanently stored in that directory and can be directly read when restarting your R session.

Query and Filter Standartox Toxicity Data

Description

Retrieves and filters toxicity data from the Standartox database (https://doi.org/10.5281/zenodo.3785030). This function acts as a powerful front-end for subsetting the database based on chemical, experimental, and taxonomic criteria.

Usage

stx_query(
  cas_number = NULL,
  endpoint_group = c("XX50", "NOEX", "LOEX"),
  endpoint_qualifier = "=",
  endpoint = NULL,
  exposure = NULL,
  effect = NULL,
  measurement = NULL,
  duration = c(0, Inf),
  duration_unit = "h",
  concentration_unit = NULL,
  concentration_type = NULL,
  organism_lifestage = NULL,
  tax_columns = c("tax_group", "tax_taxon", "tax_genus", "tax_family"),
  tax_genus = NULL,
  tax_family = NULL,
  tax_order = NULL,
  tax_class = NULL,
  tax_group = NULL,
  include_reference = FALSE,
  rm_NR = TRUE,
  verbose = FALSE,
  ...
)

Arguments

cas_number

character; Optional vector of CAS numbers to filter by (e.g., c("1071-83-6", "63-25-2")). If 'NULL' (default), results for all chemicals are returned.

endpoint_group

character; Optional vector of endpoint groups to filter results. See stx_catalog()$endpoint_group for all possible values. Defaults to c("XX50", "NOEX", "LOEX").

endpoint_qualifier

character; Optional vector of endpoint value qualifiers (e.g., c(">", "<=")). Common values are "=", ">", "<", "~", "<=", ">=". Defaults to "=". Set to 'NULL' to include all qualifiers.

endpoint

character; Optional vector of specific endpoints to filter by (e.g., "LC50", "NOEC"). If 'NULL' (default), no endpoint filtering is applied.

exposure

character; Optional vector of exposure types. See stx_catalog()$exposure. If 'NULL' (default), no exposure type filtering is applied.

effect

character; Optional vector of observed effects. See stx_catalog()$effect. If 'NULL' (default), no effect filtering is applied.

measurement

character; Optional vector of measurement types. See stx_catalog()$measurement. If 'NULL' (default), no measurement filtering is applied.

duration

numeric; A numeric vector of length two specifying the duration range (in hours) to filter by, e.g., c(24, 96). Defaults to c(0, Inf), including all durations.

duration_unit

character; Filter by the unit of duration. See stx_catalog()$duration_unit. Defaults to "h" (hours). Set to 'NULL' to keep all units.

concentration_unit

character; Optional vector of concentration units. See stx_catalog()$concentration_unit. If 'NULL' (default), no filtering is applied.

concentration_type

character; Optional vector of concentration types. See stx_catalog()$concentration_type. If 'NULL' (default), no filtering is applied.

organism_lifestage

character; Optional vector of organism lifestages. See stx_catalog()$organism_lifestage. If 'NULL' (default), no lifestage filtering is applied.

tax_columns

character; A vector of taxonomic column names to append to the results. See colnames(stx_taxa()) for all options. Defaults to c("tax_group", "tax_taxon", "tax_genus", "tax_family").

tax_genus

character; Optional vector of genera to filter by. See stx_catalog()$genus. If 'NULL' (default), no genus filtering is applied.

tax_family

character; Optional vector of families to filter by. See stx_catalog()$family. If 'NULL' (default), no family filtering is applied.

tax_order

character; Optional vector of orders to filter by. See stx_catalog()$order. If 'NULL' (default), no order filtering is applied.

tax_class

character; Optional vector of classes to filter by. See stx_catalog()$class. If 'NULL' (default), no class filtering is applied.

tax_group

character; Optional vector of ecotoxicological groups to filter by. See stx_catalog()$tax_group for valid inputs (e.g., "invertebrate", "fish"). If 'NULL' (default), no group filtering is applied.

include_reference

logical; If 'TRUE', reference information (author, year, title) is appended to the results. Defaults to FALSE.

rm_NR

logical; If 'TRUE' (default), rows with "NR" (not reported) values in the critical 'endpoint' and 'duration_unit' columns are removed early in the query process. Note that at the end of the query, all remaining "NR" values in any character column are converted to 'NA'.

verbose

logical; If 'TRUE', prints messages detailing the query progress. Defaults to FALSE.

...

Additional arguments to be passed on to stx_download, such as 'stx_dir' to specify a cache directory.

Details

The function operates in a sequential process: 1. It first downloads the necessary data tables ('test_fin', 'phch', 'taxa', and optionally 'refs') using stx_download. 2. It performs initial, fast filtering based on 'endpoint_group', 'endpoint_qualifier', and 'duration_unit'. 3. It then appends chemical and taxonomic information, filtering by 'cas_number' and the 'tax_*' parameters. 4. Finally, it applies the remaining experimental filters ('effect', 'duration', 'concentration_unit', etc.).

By default, filters are combined with a logical "AND". For example, specifying a 'tax_genus' and an 'effect' will return only records that match both criteria.

‘stx_catalog()' is a helper function that provides a list of all valid filter values for many of this function’s parameters.

Value

A data.table containing the filtered Standartox toxicity data. If the query results in zero matches, the function returns 'NULL' and issues a warning.

Author(s)

Hannes Reinwald

Examples

# This function may fail if there is no internet connection or Zenodo.org is not available

# Basic query using default filters (XX50, NOEX, LOEX endpoints in hours)
# Using verbose=TRUE to see the process
results_default <- stx_query(verbose = TRUE)

# To see available filter options, use the catalog function
catalog <- stx_catalog()
print(catalog$endpoint_group)

# Query for a specific CAS number and multiple specific endpoints for key taxonomic groups
q1 <- stx_query(
  cas_number = "1071-83-6", # Glyphosate
  endpoint = c("LC50", "EC50", "LOEC", "NOEC"),
  duration = c(0, 120), # Up to 120 hours
  tax_group = c("invertebrate", "fish", "algae")
)

# Get all >LC50 values for Zebra fish (Danio rerio) embryos or larvae,
# including reference information
q2 <- stx_query(
  endpoint = "LC50",
  endpoint_qualifier = ">",
  duration = c(72, 120),
  tax_genus = "Danio",
  organism_lifestage = c("Embryo", "Larva"),
  include_reference = TRUE,
  verbose = TRUE
)

# Get all XX50 acute toxicity values for the family Daphniidae related to mobility
q3 <- stx_query(
  endpoint_group = "XX50",
  duration = c(24, 48),
  measurement = c("immobile", "mobility", "swimming"),
  tax_family = "Daphniidae",
  include_reference = TRUE
)

Retrieve the Standartox Taxonomy Table

Description

Provides direct access to the 'taxa' data table, which contains the complete taxonomic classification for every species in the Standartox database.

Usage

stx_taxa(silent = FALSE, stx_dir = file.path(tempdir(), "standartox"))

Arguments

silent

logical; If 'TRUE', suppresses progress messages during download. Defaults to 'FALSE'.

stx_dir

character; Directory where the taxonomy data file is stored or should be downloaded. Defaults to a "standartox" subdirectory within the session's temporary directory (file.path(tempdir(), "standartox")).

Details

This function is a simple wrapper for stx_download(data_type = 'taxa'). It is designed for users who want to explore the full taxonomic scope of the database or find valid inputs for the 'tax_genus', 'tax_family', and 'tax_group' parameters in stx_query.

Like other download functions in this package, it caches the data file locally to avoid re-downloading on subsequent calls.

Value

A data.table containing taxonomic classifications, with columns such as 'tax_genus', 'tax_family', 'tax_order', and 'tax_group'.

Author(s)

Andreas Scharmueller [email protected]

Hannes Reinwald

Examples

# This function may fail if there is no internet connection or Zenodo.org is not available

# Basic function call to retrieve the taxonomy data table
taxa_data <- stx_taxa()

# Inspect the first few rows and see all available columns
head(taxa_data)
colnames(taxa_data)

# Find all unique ecotoxicological groups in the database
if (nrow(taxa_data) > 0) {
  print(unique(taxa_data$tax_group))
}

# Example of using a permanent directory to cache the data file
my_dir <- file.path("~", "my_stx_data")
cached_taxa_data <- stx_taxa(stx_dir = my_dir, silent = FALSE)