Practical applications using Rcurvep package"

  collapse = TRUE,
  comment = "#>"
# has to move project rmd_knit_tem

Install the package

# the development version from GitHub:
# install.packages("devtools")
devtools::install_github("moggces/Rcurvep", build_vignettes = TRUE)

Load the library


Load the sample dataset

zfishdev a subset of data from a 32-compound screen using zebrafish developmental assays. Our goal is to decide whether a compound is active in a particular toxicity endpoint. The active is determined by if the responses is monotonic (as the increase of concentration). In addition, the maximum response has to be larger than a certain response threshold.

# More details of the dataset can be found ?zfishdev.

Rcurvep method

The Rcurvep is a tool to decide whether responses are monotonic (as the increase of concentration) based on a set of pre-defined parameters. The default setting of those parameters can be obtained through curvep_defaults(). The TRSH is the threshold parameter, below which, all responses are considered as noise. This threshold is particularly important for toxicologists, since the point-of-departure (POD) can be defined as the concentration at which response equivalent to this threshold. The threshold can also be called as benchmark response (BMR).

#For details of parameters, see ?curvep.

Run Rcurvep on datasets using combi_run_rcurvep()

Since zfishdev does not contain a column with responses, create_dataset() can be used to generate the responses for this particular type of data. However, this function is already incorporated.

  combi_run_rcurvep(zfishdev, RNGE = 1000000),
  combi_run_rcurvep(create_dataset(zfishdev), RNGE = 1000000)

Run Rcurvep when there is a preferred BMR

If there is a preferred BMR, you can run the dataset using the threshold. The act_set in the result contains potency and efficacy information of the concentration-response data (aka curve).

out <- combi_run_rcurvep(
  TRSH = 25, # BMR = 25
  RNGE = 1000000 # increasing direction

Summarize activity data from Rcurvep

The results of the summary is saved in the tibble, act_summary.

sum_out <- summarize_rcurvep_output(out)

Add confidence interval for activity data from Rcurvep

The confidence interval is calculated using simulated datasets created by bootstrapping the original responses. By setting the parameter, n_samples, number of curves are simulated. The same summarize_rcurvep_output() can be used to summarize the results.

out <- combi_run_rcurvep(
  n_samples = 10, # often 1000 samples are preferred
  TRSH = 25,
  RNGE = 1000000,
  keep_sets = "act_set"
sum_out <- summarize_rcurvep_output(out)

Run Rcurvep when an optimal/preferred BMR is unknown

The optimal BMR may be defined as the threshold at which the potency estimation is more accurate. The concept can be translated as the lowest threshold (which gives the highest potency), at which a decrease of variance in potency estimation is stabilized. By using the simulated datasets, the pooled variance across chemicals at a certain threshold can be estimated.

# The combi_run_rcurvep() can be used for a combination of Curvep parameters. 
# finishing the code will take some time. 


zfishdev_act <- combi_run_rcurvep(

  n_samples = 100, 
  keep_sets = c("act_set"),
  TRSH = seq(5, 95, by = 5), # test all candidates, 5 to 95
  RNGE = 1000000, 
  CARR = 20

Estimate the BMR

For the two endpoints, BMR = 25 (in bmr_ori column) is suggested for the percent_affected_96 endpoint with an OK comment but for the percent_mortality_96 endpoint, check is noted.

bmr_out <- estimate_dataset_bmr(zfishdev_act, plot = FALSE)

Display the diagnostic curves for BMR estimation

It turns out for the percent_mortality_96 endpoint, the shape is not in the right form (as the percent_affected_96 endpoint).


Run parametric fitting on datasets

Since zfishdev does not contain a column with responses, create_dataset() needs to be used to generate the responses for this particular type of data. Unlike combi_run_rcurvep(), create_dataset() has to be called explicitly.

fitd <- run_fit(create_dataset(zfishdev), hill_pdir = 1, modls = "hill")

Summarize parametric fitting results using a preferred BMR

The results of the summary is saved in the tibble, act_summary.

fitd_sum_out <- summarize_fit_output(fitd, thr_resp  = 25)

Add confidence interval for activity data from parametric fitting (strictly to Hill equation)

fitd <- run_fit(create_dataset(zfishdev), hill_pdir = 1, n_samples = 10, modls = "hill")

Try the Rcurvep package in your browser

Any scripts or data that you put into this service are public.

Rcurvep documentation built on Jan. 8, 2021, 2:37 a.m.