drc_4p_plot: Plotting of four-parameter dose response curves

View source: R/drc_4p_plot.R

drc_4p_plotR Documentation

Plotting of four-parameter dose response curves

Description

Function for plotting four-parameter dose response curves for each group (precursor, peptide or protein), based on output from fit_drc_4p function.

Usage

drc_4p_plot(
  data,
  grouping,
  response,
  dose,
  targets,
  unit = "uM",
  y_axis_name = "Response",
  facet = TRUE,
  scales = "free",
  x_axis_scale_log10 = TRUE,
  export = FALSE,
  export_name = "dose-response_curves"
)

Arguments

data

a data frame that is obtained by calling the fit_drc_4p function.

grouping

a character column in the data data frame that contains the precursor, peptide or protein identifiers.

response

a numeric column in a nested data frame called plot_points that is part of the data data frame. This column contains the response values, e.g. log2 transformed intensities.

dose

a numeric column in a nested data frame called plot_points that is part of the data data frame. This column contains the dose values, e.g. the treatment concentrations.

targets

a character vector that specifies the names of the precursors, peptides or proteins (depending on grouping) that should be plotted. This can also be "all" if plots for all curve fits should be created.

unit

a character value specifying the unit of the concentration.

y_axis_name

a character value specifying the name of the y-axis of the plot.

facet

a logical value that indicates if plots should be summarised into facets of 20 plots. This is recommended for many plots.

scales

a character value that specifies if the scales in faceted plots (if more than one target was provided) should be "free" or "fixed".

x_axis_scale_log10

a logical value that indicates if the x-axis scale should be log10 transformed.

export

a logical value that indicates if plots should be exported as PDF. The output directory will be the current working directory. The name of the file can be chosen using the export_name argument. If only one target is selected and export = TRUE, the plot is exported and in addition returned in R.

export_name

a character value providing the name of the exported file if export = TRUE.

Value

If targets = "all" a list containing plots for every unique identifier in the grouping variable is created. Otherwise a plot for the specified targets is created with maximally 20 facets.

Examples


set.seed(123) # Makes example reproducible

# Create example data
data <- create_synthetic_data(
  n_proteins = 2,
  frac_change = 1,
  n_replicates = 3,
  n_conditions = 8,
  method = "dose_response",
  concentrations = c(0, 1, 10, 50, 100, 500, 1000, 5000),
  additional_metadata = FALSE
)

# Perform dose response curve fit
drc_fit <- fit_drc_4p(
  data = data,
  sample = sample,
  grouping = peptide,
  response = peptide_intensity_missing,
  dose = concentration,
  retain_columns = c(protein)
)

str(drc_fit)

# Plot dose response curves
if (!is.null(drc_fit)) {
  drc_4p_plot(
    data = drc_fit,
    grouping = peptide,
    response = peptide_intensity_missing,
    dose = concentration,
    targets = c("peptide_2_1", "peptide_2_3"),
    unit = "pM"
  )
}


protti documentation built on Jan. 22, 2023, 1:11 a.m.