drugTimeResponseCurve: Compares viabilities at a given dose over different...

Description Usage Arguments Value Examples

View source: R/drugTimeResponseCurve.R

Description

This function generates a plot visualizing the relationship between gene expression, time and dose level for the selected tSet. The plot is generated with ggplot2 and can be customized using ggplot plot + function() syntax.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
drugTimeResponseCurve(
  tSet,
  duration = NULL,
  cell_lines = NULL,
  dose = NULL,
  drugs = NULL,
  summarize_replicates = TRUE,
  line_width = 1,
  point_size = 2.5,
  verbose = TRUE,
  ggplot_args = NULL
)

Arguments

tSet

ToxicoSet A ToxicoSet to be plotted in this figure

duration

character A vector of durations to include in the plot.

cell_lines

character A vector of cell lines to include in the plot.

dose

character A vector of dose levels to be included in the plot. Default to include all dose levels available for a drug. Must include at minimum two dose levels, one of witch is "Control".

drugs

character A drugs or pair of drugs to be plotted.

summarize_replicates

logical If TRUE will average viability across replicates for each unique drug-dose-duration combination.

line_width

numeric A number specifying the thickness of lines in the plot, as passed to size in geom_line(). Defaults to 1.

point_size

numeric A number specifying how large points should be in the plot, as passed to size in geom_point(). Defaults to 2.5.

verbose

boolean Should warning messages about the data passed in be printed?

ggplot_args

list A list of ggplot2 functions which can be called using the plot + function() syntax. This allows arbitrary customization of the plot including changing the title, axis labels, colours, etc. Please see the included examples for basic usage or ggplot2 documentation for advanced customization. Alternatively, you could assign the return value to a variable and add the customization yourself using plot + function().

Value

Plot of the viabilities for each drugs vs time of exposure

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  library(ggplot2)

  # Default settings
  plot <- drugTimeResponseCurve(TGGATESsmall, cell_lines = "Hepatocyte",
  dose = c("Control", "Low", "Middle"), drugs = drugNames(TGGATESsmall)[6],
  duration = c("2", "8", "24"))

  # Customize title, x/y labels, x/y limits, colour palette and define
  # custom ticks for x axis using the function argument ggplot2_args
  customizations <- list(labs(title= 'My Custom Title', ylab = 'The y-axis'),
                         xlim(c(2, 24)), ylim(c(99,105)),
                         scale_color_brewer(palette="Set1"),
                         scale_x_continuous(breaks=c(2, 8, 24),
                           labels = c("Two", "Eight", "Twenty-Four"))
                         )

   if(interactive()) {
      drugTimeResponseCurve(TGGATESsmall, cell_lines = "Hepatocyte",
        dose = c("Control", "Low", "Middle"),
        drugs = drugNames(TGGATESsmall)[6], duration = c("2", "8", "24"),
        ggplot_args = customizations)
   }

   # Customize the plot using standard ggplot2 syntax
   if(interactive()) {
      plot + labs(title= 'My Custom Title', ylab = 'The y-axis') +
        xlim(c(2, 24)) + ylim(c(99,105)) + scale_color_brewer(palette="Set1")
   }

ToxicoGx documentation built on Jan. 20, 2020, 5:06 p.m.