Package 'ezmtt'

Title: Easy MTT Assay Tidying and Plotting
Description: This package automates the analysis and plotting of standard MTT workflows.
Authors: Kai Aragaki [aut, cre]
Maintainer: Kai Aragaki <[email protected]>
License: MIT + file LICENSE
Version: 0.2.0
Built: 2025-02-02 05:42:40 UTC
Source: https://github.com/KaiAragaki/ezmtt

Help Index


Plot MTT data

Description

Plot MTT data

Usage

GeomMtt

geom_mtt(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  n = 1000,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,
  ...
)

Arguments

mapping

Set of aesthetic mappings created by aes(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

The data to be displayed in this layer. There are three options:

If NULL, the default, the data is inherited from the plot data as specified in the call to ggplot().

A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See fortify() for which variables will be created.

A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).

stat

The statistical transformation to use on the data for this layer. When using a ⁠geom_*()⁠ function to construct a layer, the stat argument can be used the override the default coupling between geoms and stats. The stat argument accepts the following:

  • A Stat ggproto subclass, for example StatCount.

  • A string naming the stat. To give the stat as a string, strip the function name of the stat_ prefix. For example, to use stat_count(), give the stat as "count".

  • For more information and other ways to specify the stat, see the layer stat documentation.

position

A position adjustment to use on the data for this layer. This can be used in various ways, including to prevent overplotting and improving the display. The position argument accepts the following:

  • The result of calling a position function, such as position_jitter(). This method allows for passing extra arguments to the position.

  • A string naming the position adjustment. To give the position as a string, strip the function name of the position_ prefix. For example, to use position_jitter(), give the position as "jitter".

  • For more information and other ways to specify the position, see the layer position documentation.

n

How many line segments should be used to draw an MTT curve?

na.rm

Remove NA values?

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders().

...

Additional arguments passed to ggplot2::layer params

Format

An object of class GeomMtt (inherits from Geom, ggproto, gg) of length 5.


Example data from an MTT

Description

A dataset including absorbance data at 562nm and 660nm

Usage

mtt

Format

A spectramax object

data

a gp object containing absorbance values

Details

There are four conditions on this plate. The plate is divided into quadrants. Concentrations of drug increase from left to right (0, 1nM, 10nM, 100nM, 1uM, 10uM).


Calculate normalized ODs without fitting

Description

It can be useful to calculate normalized ODs without fitting, particularly if you would like to use geom_mtt, or need to manipulate your data downstream.

Usage

mtt_calc(
  data,
  signal = "nm562",
  background = "nm660",
  dose = "dose",
  out = "div",
  .by = NULL
)

Arguments

data

A data.frame of absorbances, containing at least the signal, background, and dose columns (see below)

signal

The name of the column that contains the signal absorbances

background

The name of the column that contains the background absorbances. If NULL, will just use signal.

dose

The name of the column containing the concentrations of the drug. Will use the lowest concentration as the baseline.

out

The name of the output column

.by

Character vector of columns to summarize by. Other columns will be dropped


Fit an curve through MTT data

Description

Fit an curve through MTT data

Usage

mtt_fit(x, model, ...)

## Default S3 method:
mtt_fit(x, model = NULL, ...)

## S3 method for class 'gp'
mtt_fit(x, model = NULL, ...)

## S3 method for class 'data.frame'
mtt_fit(x, model = NULL, ...)

## S3 method for class 'spectramax'
mtt_fit(x, conditions, model = NULL, ...)

Arguments

x

An object of class gplate::gp, data.frame, or mop::spectramax. See details.

model

A character vector of models that should be used to fit the data. If NULL, will start with a 4-parameter log-logistic model and fall back using a linear model. Options for supplying a vector include NA, "lm", and "ll". See details.

...

Unused

conditions

A named list of numerics of length 4. Contains doses per quadrant. Names are the drug. If quadrant should be omitted, supply NA. Quadrants go from left to right, top to bottom. Identical names are allowed.

Details

If a data.frame or gplate::gp is supplied, it should have columns condition, dose, nm562 and nm660

This function will first attempt to fit the data using a 4-parameter log-logistic model, then use a linear model as a fallback if fitting fails.

The model argument can be used to specify a model manually by supplying a character vector with length equal to the number of unique conditions. Valid values for the character vector include:

  • NA: Fitting will start with log-logistic, fallback on linear

  • "ll": Only (try to) fit with log-logistic

  • "lm": Only fit with lm


Plot MTT fits

Description

Plot MTT fits

Usage

mtt_plot(fits, ic_pct = NULL, ...)

Arguments

fits

a list of fits, usually the output from mtt_fit

ic_pct

Numeric. If NULL, no IC will be plotted. Otherwise, will plot ic_pct% IC the % IC supplied.

...

Arguments passed to drc::ED

Value

a ggplot


Tidy mtt data

Description

A convenience function for tidying mtt data. For data that do not follow the standard format of 'one condition per quadrant', consider tidying the data using gplate. See the "Using ezmtt" vignette for more information.

Usage

mtt_tidy(x, ...)

Arguments

x

Object to be tidied

...

Additional arguments passed to appropriate methods

conditions

A named list of length 4, where the name is the name of the condition, and the values are the doses. If a quadrant of the plate was not used, use NA.


Plot MTT data

Description

Plot MTT data

Usage

stat_ic_mtt(
  mapping = NULL,
  data = NULL,
  geom = "point",
  position = "identity",
  ...,
  ic = 50,
  show.legend = NA,
  inherit.aes = TRUE
)

Arguments

mapping

Set of aesthetic mappings created by aes(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

The data to be displayed in this layer. There are three options:

If NULL, the default, the data is inherited from the plot data as specified in the call to ggplot().

A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See fortify() for which variables will be created.

A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).

geom

The geometric object to use to display the data for this layer. When using a ⁠stat_*()⁠ function to construct a layer, the geom argument can be used to override the default coupling between stats and geoms. The geom argument accepts the following:

  • A Geom ggproto subclass, for example GeomPoint.

  • A string naming the geom. To give the geom as a string, strip the function name of the geom_ prefix. For example, to use geom_point(), give the geom as "point".

  • For more information and other ways to specify the geom, see the layer geom documentation.

position

A position adjustment to use on the data for this layer. This can be used in various ways, including to prevent overplotting and improving the display. The position argument accepts the following:

  • The result of calling a position function, such as position_jitter(). This method allows for passing extra arguments to the position.

  • A string naming the position adjustment. To give the position as a string, strip the function name of the position_ prefix. For example, to use position_jitter(), give the position as "jitter".

  • For more information and other ways to specify the position, see the layer position documentation.

...

Additional arguments passed to ggplot2::layer params

ic

The IC percentage that should be calculated

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders().