Title: | Tools and Plots for Multi-Well Plates |
---|---|
Description: | Collection of functions for working with multi-well microtitre plates, mainly 96, 384 and 1536 well plates. |
Authors: | Scott Warchal [aut, cre] |
Maintainer: | Scott Warchal <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.6 |
Built: | 2025-03-02 03:48:15 UTC |
Source: | https://github.com/swarchal/platetools |
Transforms numerical values using the b-score normalisation process to account for row and column effects. Uses well and plate labels to plot the normalised values in the form of microtitre plates. Works for 96, 384 and 1536 well plates.
b_grid( data, well, plate_id, plate = 96, eps = 0.01, maxiter = 10, trace.iter = FALSE, na.rm = FALSE, ... )
b_grid( data, well, plate_id, plate = 96, eps = 0.01, maxiter = 10, trace.iter = FALSE, na.rm = FALSE, ... )
data |
Numerical values to be plotted |
well |
Vector of well identifiers e.g "A01" |
plate_id |
Vector of plate identifiers e.g "Plate_1" |
plate |
Number of wells in complete plate (96, 384 or 1536) |
eps |
real number greater than 0. A tolerance for divergence |
maxiter |
int, the maximum number of iterations |
trace.iter |
Boolean, should progress in convergence be reported? |
na.rm |
Boolean, should missing values be removed? |
... |
additional parameters to plot wrappers |
ggplot plot
df01 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 1) df02 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 2) df <- rbind(df01, df02) b_grid(data = df$vals, well = df$well, plate_id = df$plate, plate = 96)
df01 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 1) df02 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 2) df <- rbind(df01, df02) b_grid(data = df$vals, well = df$well, plate_id = df$plate, plate = 96)
Transforms numerical values using the b-score normalisation process to account for row and column effects. Uses well labels to plot the normalised values in the form of a microtitre plate. Works for 6, 12, 24, 48, 96, 384 or 1536 well plates
b_map( data, well, normalise = FALSE, plate = 96, eps = 0.01, maxiter = 10, trace.iter = FALSE, na.rm = TRUE, ... )
b_map( data, well, normalise = FALSE, plate = 96, eps = 0.01, maxiter = 10, trace.iter = FALSE, na.rm = TRUE, ... )
data |
Numerical values in the form of a vector to be normalised |
well |
Vector of well identifiers, e.g "A01" |
normalise |
Boolean, if TRUE then the residual values will be divded by the plate median absolute deviation as per Malo et al. |
plate |
integer, 6, 12, 24, 48, 96, 384 or 1536 |
eps |
real number greater than 0. A tolerance for divergence |
maxiter |
int, the maximum number of iterations |
trace.iter |
Boolean, should progress in convergence be reported? |
na.rm |
Boolean, should missing values be removed? |
... |
additional parameters to plot wrappers |
ggplot plot
df <- data.frame(well = num_to_well(1:96), vals = rnorm(96)) b_map(data = df$vals, well = df$well, plate = 96) df_384 <- data.frame( well = num_to_well(1:384, plate = 384), vals = rnorm(384)) b_map(data = df_384$vals, well = df_384$well, plate = 384)
df <- data.frame(well = num_to_well(1:96), vals = rnorm(96)) b_map(data = df$vals, well = df$well, plate = 96) df_384 <- data.frame( well = num_to_well(1:384, plate = 384), vals = rnorm(384)) b_map(data = df_384$vals, well = df_384$well, plate = 384)
2 way median polish to remove plate effects such as row/column/edge effects.
Given a dataframe containing alpha-numeric wellIDs and numerical values,
this b_score
will return a dataframe of the same structure after
a two-way median smooth.
b_score(data, well, plate, plate_id = NULL, normalise = FALSE)
b_score(data, well, plate, plate_id = NULL, normalise = FALSE)
data |
numeric data, either a vector or dataframe column |
well |
alpha-numeric wellIDs. e.g 'A01' |
plate |
numeric, number of wells within a plate |
plate_id |
Vector of plate_identifiers e.g "plate_01" |
normalise |
Boolean, whether or not to divide by ‘data'’s MAD |
df <- data.frame(well = num_to_well(1:96), vals = rnorm(96)) b_score(data = df$vals, well = df$well, plate = 96)
df <- data.frame(well = num_to_well(1:96), vals = rnorm(96)) b_score(data = df$vals, well = df$well, plate = 96)
Produces a platemap with colours indicating wells above or below selected threshold after normalising for systematic plate effects via B-score smooth. The threshold is definined calculated from a z-score, i.e plus or minus standard deviations from the plate mean.
bhit_map( data, well, plate = 96, threshold = 2, palette = "Spectral", eps = 0.01, maxiter = 10, trace.iter = FALSE, na.rm = TRUE, ... )
bhit_map( data, well, plate = 96, threshold = 2, palette = "Spectral", eps = 0.01, maxiter = 10, trace.iter = FALSE, na.rm = TRUE, ... )
data |
Vector of numerical values |
well |
Vector of well identifiers, e.g "A01" |
plate |
Number of wells in whole plate (96, 384 or 1536) |
threshold |
Standard deviations from the plate average to indicate a hit. default is set to +/- 2 SD. |
palette |
RColorBrewer palette |
eps |
real number greater than 0. A tolerance for divergence |
maxiter |
int, the maximum number of iterations |
trace.iter |
Boolean, should progress in convergence be reported? |
na.rm |
Boolean, should missing values be removed? |
... |
additional parameters to plot wrappers |
ggplot plot
df <- data.frame(vals = rnorm(384), well = num_to_well(1:384, plate = 384)) bhit_map(data = df$vals, well = df$well, plate = 384, threshold = 3)
df <- data.frame(vals = rnorm(384), well = num_to_well(1:384, plate = 384)) bhit_map(data = df$vals, well = df$well, plate = 384, threshold = 3)
checks plate input for dodgy well plate combinations
check_plate_input(well, plate)
check_plate_input(well, plate)
well |
vector of well labels |
plate |
integer, number of wells in full plate |
Produces distribution plots facetted in a plate-layout format.
dist_map(well, data)
dist_map(well, data)
well |
vector of alphanumeric wellIDs e.g 'A01' |
data |
numeric vector |
ggplot plot
Fills in missing wells with rows of NA values. Useful for any functions that require a complete plate such as 'b_score'.
fill_plate(df, well, plate = 96)
fill_plate(df, well, plate = 96)
df |
dataframe |
well |
Column containing well identifiers i.e "A01" |
plate |
Number of wells in complete plate (96, 384 or 1536) |
dataframe
vals <- rnorm(96) ; wells <- num_to_well(1:96) df <- data.frame(wells, vals) df_missing <- df[-c(1:10), ] fill_plate(df_missing, "wells")
vals <- rnorm(96) ; wells <- num_to_well(1:96) df <- data.frame(wells, vals) df_missing <- df[-c(1:10), ] fill_plate(df_missing, "wells")
Converts numerical values and well labels into 'hits' in the form of multiple plate maps. Hits are calculated as wells above or below a specified number of standard deviations from the overall average
hit_grid( data, well, plate_id, threshold = 2, ncols = 2, plate = 96, each = FALSE, scale_each = FALSE, palette = "Spectral", ... )
hit_grid( data, well, plate_id, threshold = 2, ncols = 2, plate = 96, each = FALSE, scale_each = FALSE, palette = "Spectral", ... )
data |
Numerical values to be scaled and plotted |
well |
Vector of well identifiers. e.g "A01" |
plate_id |
Vector of plate identifiers e.g "Plate_1" |
threshold |
Numerical value of standard deviations from the mean for a well to be classified as a 'hit'. Default it +/- 2 SD |
ncols |
Number of columns in the grid of plates |
plate |
Number of wells in the complete plates (96, 384 or 1536) |
each |
boolean, allowed for backwards compatibility, |
scale_each |
boolean, if true scales each plate individually, if false
will scale the pooled values of |
palette |
RColorBrewer palette |
... |
additional arguments for plot wrappers |
ggplot plot
df01 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 1) df02 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 2) df <- rbind(df01, df02) hit_grid(data = df$vals, well = df$well, plate_id = df$plate, plate = 96, each = FALSE)
df01 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 1) df02 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 2) df <- rbind(df01, df02) hit_grid(data = df$vals, well = df$well, plate_id = df$plate, plate = 96, each = FALSE)
Produces a plot in the form of a micro-titre layout, with colours indicating wells above or below a nominated threshold.
hit_map(data, well, plate = 96, threshold = 2, palette = "Spectral", ...)
hit_map(data, well, plate = 96, threshold = 2, palette = "Spectral", ...)
data |
Vector of numerical values to score |
well |
Vector of well identifiers e.g "A01" |
plate |
Number of wells in complete plate (6, 12, 24, 48, 96, 384 or 1536) |
threshold |
Numerical value of standard deviations from the mean for a well to be classified as a 'hit'. Default it +/- 2 SD |
palette |
RColorBrewer palette |
... |
additional parameters for plot wrappers |
ggplot plot
df <- data.frame(vals = rnorm(1:384), well = num_to_well(1:384, plate = 384)) hit_map(data = df$vals, well = df$well, plate = 384, threshold = 3)
df <- data.frame(vals = rnorm(1:384), well = num_to_well(1:384, plate = 384)) hit_map(data = df$vals, well = df$well, plate = 384, threshold = 3)
internal 1536 plate function for plate_map
is_1536(well)
is_1536(well)
well |
vector of alphanumeric well labels |
after ggplot2 v3.3.0, using scale_y_reverse() also reverses the order of the ylim arguments in coord_fixed()
is_old_ggplot()
is_old_ggplot()
Change the legend title. This can be done in ggplot but there are a million incomprehensible ways to do it.
legend_title(title)
legend_title(title)
title |
string new title |
ggplot object
Given a list of dataframes with the same columns, this function will row bind
them together, and if passed a col_name
arguement, will produce a
column containing their original element name
list_to_dataframe(l, col_name = NULL)
list_to_dataframe(l, col_name = NULL)
l |
list of dataframes to be converted into single dataframe |
col_name |
(optional) name of column to put element names under |
dataframe
Given a platemap produced by plate_map
, will return
a dataframe with after values have been transformed into
a matrix mirroring the plate structure and undergoing a
2-way median polish to remove row or column effects
med_smooth( platemap, plate, eps = 0.01, maxiter = 10, trace.iter = FALSE, na.rm = TRUE, normalise = FALSE )
med_smooth( platemap, plate, eps = 0.01, maxiter = 10, trace.iter = FALSE, na.rm = TRUE, normalise = FALSE )
platemap |
dataframe produced by |
plate |
numeric, number of wells in plate, either 96 or 384 |
eps |
real number greater than 0. A tolerance for divergence |
maxiter |
int, the maximum number of iterations |
trace.iter |
Boolean, should progress in convergence be reported? |
na.rm |
Boolean, should missing values be removed? |
normalise |
Boolean, should the data be divided by the MAD? |
A dataframe consisting of two column, wellID and polished numeric values
Returns a vector of wells that are missing from a complete plate.
missing_wells(df, well, plate = 96)
missing_wells(df, well, plate = 96)
df |
dataframe |
well |
Column containing well identifiers i.e "A01" |
plate |
Number of wells in complete plate (96 or 384) |
vector of missing wells
vals <- rnorm(96) ; wells <- num_to_well(1:96) df <- data.frame(vals, wells) df_missing <- df[-c(1:10), ] missing_wells(df_missing, "wells")
vals <- rnorm(96) ; wells <- num_to_well(1:96) df <- data.frame(vals, wells) df_missing <- df[-c(1:10), ] missing_wells(df_missing, "wells")
Converts numerical values to corresponding alpha-numeric well labels for 6, 12, 24, 48, 96, 384 or 1536 well plates. Note, it's advisable to specify the number of wells in 'plate'.
num_to_well(x, plate = 96)
num_to_well(x, plate = 96)
x |
Vector of numbers to be converted |
plate |
Number of wells in complete plate (96 or 384) |
Vector of alpha-numeric well labels
num_to_well(1:96) num_to_well(1:96, plate = 384) nums <- c(1:10, 20:40, 60:96) num_to_well(nums)
num_to_well(1:96) num_to_well(1:96, plate = 384) nums <- c(1:10, 20:40, 60:96) num_to_well(nums)
Converts multivariate data and well labels into a heatmap of the first principal component in the form of a grid of platemaps.
pc_grid(data, well, plate_id, ncols = 2, plate = 96, ...)
pc_grid(data, well, plate_id, ncols = 2, plate = 96, ...)
data |
Numerical values be transformed, scaled and plotted as a colour |
well |
Vector of well identifiers e.g "A01" |
plate_id |
Vector of plate labels or identifiers e.g "plate_1" |
ncols |
Number of columns to plot multiple platemaps |
plate |
Number of wells in complete plate (96, 384 or 1536) |
... |
additional arguments to be passed to z_grid |
ggplot plot
df01 <- data.frame( well = num_to_well(1:96), plate = 1, vals1 = rnorm(1:96), vals2 = rnorm(1:96)) df02 <- data.frame( well = num_to_well(1:96), plate = 2, vals1 = rnorm(1:96), vals2 = rnorm(1:96)) df <- rbind(df01, df02) pc_grid(data = df[, 3:4], well = df$well, plate_id = df$plate, plate = 96)
df01 <- data.frame( well = num_to_well(1:96), plate = 1, vals1 = rnorm(1:96), vals2 = rnorm(1:96)) df02 <- data.frame( well = num_to_well(1:96), plate = 2, vals1 = rnorm(1:96), vals2 = rnorm(1:96)) df <- rbind(df01, df02) pc_grid(data = df[, 3:4], well = df$well, plate_id = df$plate, plate = 96)
Takes the values and well identifiers, calculates the first principal component, scales and plots the component as a heatmap in the form of a 96 or 384-well plate. A way to quickly show variation of multi-parametric data within a plate.
pc_map(data, well, plate = 96, ...)
pc_map(data, well, plate = 96, ...)
data |
Vector of numerical data to calculate the first principal component |
well |
Vector of well identifiers e.g "A01" |
plate |
Number of wells in complete plate (96, 384 or 1536 |
... |
additional parameters to platetools::z_map |
gplot plot
df <- data.frame( well = num_to_well(1:96), vals1 = rnorm(1:96), vals2 = rnorm(1:96)) pc_map(data = df[, 2:3], well = df$well, plate = 96)
df <- data.frame( well = num_to_well(1:96), vals1 = rnorm(1:96), vals2 = rnorm(1:96)) pc_map(data = df[, 2:3], well = df$well, plate = 96)
Converts numerical values, well labels, and plate labels into multiple heatmaps of plates, with z-scored principal components coloured dependent on a specified threshold of standard deviations above or below the average.
pchit_grid(data, well, plate_id, ...)
pchit_grid(data, well, plate_id, ...)
data |
Numerical values, either a dataframe or a matrix |
well |
Vector of well identifers e.g "A01" |
plate_id |
Vector of plate identifiers e.g "Plate_1" |
... |
additional arguments to 'platetools::hit_grid()' |
ggplot plot
df01 <- data.frame( well = num_to_well(1:96), plate = 1, vals1 = rnorm(1:96), vals2 = rnorm(1:96)) df02 <- data.frame( well = num_to_well(1:96), plate = 2, vals1 = rnorm(1:96), vals2 = rnorm(1:96)) df <- rbind(df01, df02) pchit_grid(data = df[,3:4], well = df$well, plate_id = df$plate, plate = 96)
df01 <- data.frame( well = num_to_well(1:96), plate = 1, vals1 = rnorm(1:96), vals2 = rnorm(1:96)) df02 <- data.frame( well = num_to_well(1:96), plate = 2, vals1 = rnorm(1:96), vals2 = rnorm(1:96)) df <- rbind(df01, df02) pchit_grid(data = df[,3:4], well = df$well, plate_id = df$plate, plate = 96)
Converts numerical values and plate labels intoa plate heatmap with z-scored principal components coloured dependent on a specified threshold of standard deviations above or below the average.
pchit_map(data, well, plate = 96, threshold = 2, palette = "Spectral", ...)
pchit_map(data, well, plate = 96, threshold = 2, palette = "Spectral", ...)
data |
Numerical values, either a dataframe or a matrix |
well |
Vector of well identifers e.g "A01" |
plate |
Number of wells in complete plate (96, 384 or 1536) |
threshold |
Threshold of +/- standard deviations form the average to determine a hit |
palette |
RColorBrewer palette |
... |
additional arguments to platetools::hit_map |
ggplot plot
v1 <- rnorm(1:96) v2 <- rnorm(1:96) v3 <- rnorm(1:96) wells <- num_to_well(1:96) df <- data.frame(wells, v1, v2, v3) pchit_map(data = df[, 2:4], well = df$wells, threshold = 1.5)
v1 <- rnorm(1:96) v2 <- rnorm(1:96) v3 <- rnorm(1:96) wells <- num_to_well(1:96) df <- data.frame(wells, v1, v2, v3) pchit_map(data = df[, 2:4], well = df$wells, threshold = 1.5)
Given a platemap produced by plate_map
, this will perform
a two way median smooth, and return the results of medpolish
.
Useful for row and column effects, as well as the raw residuals.
plate_effect(platemap, plate)
plate_effect(platemap, plate)
platemap |
platemap produced by |
plate |
integer, the number of wells in a single plate |
internal function
plate_map(data, well)
plate_map(data, well)
data |
numeric data to be used as colour scale |
well |
alpha-numeric well IDs, e.g 'A01' |
dataframe
internal function
plate_map_grid(data, well, plate_id)
plate_map_grid(data, well, plate_id)
data |
numerical data to be used as colour scale |
well |
alpha-numeric wellIDs, e.g 'A01' |
plate_id |
plate identifers e.g 'plate_1' |
dataframe
internal function
plate_map_grid_scale(data, well, plate_id, each)
plate_map_grid_scale(data, well, plate_id, each)
data |
numerical data to be used as colour scale |
well |
alpha-numeric wellIDs, e.g 'A01' |
plate_id |
plate identifers e.g 'plate_1' |
each |
boolean, if true scales each plate individually, if false will
scale the pooled values of |
dataframe
Generates a dataframe for multiple features, given a wellID column and multiple features
plate_map_multiple(data, well)
plate_map_multiple(data, well)
data |
vector or dataframe of numeric data |
well |
vector of alphanumeric well IDs e.g 'A01' |
internal function
plate_map_scale(data, well)
plate_map_scale(data, well)
data |
numeric data to be used as colour scale |
well |
alpha-numeric well IDs, e.g 'A01' |
dataframe
Given a dataframe of alpha-numeric well IDs e.g ("A01"), and values, this function will produce a matrix in the form of a plate layout.
plate_matrix(data, well, plate = 96)
plate_matrix(data, well, plate = 96)
data |
vector of data to be placed in matrix |
well |
vector of alphanumeric well IDs. e.g ("A01") |
plate |
number of wells in plate (6, 12, 24, 48, 96 or 384, 1536) |
matrix
a <- 1:96 wells <- num_to_well(1:96) plate_matrix(data = a, well = wells) x <- rnorm(384) wells <- num_to_well(1:384, plate = 384) plate_matrix(data = x, well = wells, plate = 384)
a <- 1:96 wells <- num_to_well(1:96) plate_matrix(data = a, well = wells) x <- rnorm(384) wells <- num_to_well(1:384, plate = 384) plate_matrix(data = x, well = wells, plate = 384)
internal function
plt12( platemap, size = 38, shape = 21, na_fill = "white", na_alpha = 0.1, na_size_ratio = 0.9 )
plt12( platemap, size = 38, shape = 21, na_fill = "white", na_alpha = 0.1, na_size_ratio = 0.9 )
platemap |
platemap dataframe produced by |
size |
int, size parameter for ggplot2::geom_point |
shape |
int, shape parameter for ggplot2::geom_point |
na_fill |
string, fill colour for na or missing values |
na_alpha |
float, alpha transparancy for missing or na values |
na_size_ratio |
float, size ratio for missing values, set to 1 for same size as normal values. |
ggplot object
internal function
plt1536( platemap, size = 3.5, shape = 22, na_fill = "white", na_size_ratio = 0.95, na_alpha = 0.1 )
plt1536( platemap, size = 3.5, shape = 22, na_fill = "white", na_size_ratio = 0.95, na_alpha = 0.1 )
platemap |
platemap dataframe produced by |
size |
int, size parameter for ggplot2::geom_point |
shape |
int, shape parameter for ggplot2::geom_point |
na_fill |
string, fill colour for na or missing values |
na_size_ratio |
float, size ratio for missing values, set to 1 for same size as normal values. |
na_alpha |
float, alpha transparancy for missing or na values |
ggplot object
internal function
plt24( platemap, size = 26, shape = 21, na_fill = "white", na_size_ratio = 0.9, na_alpha = 0.1 )
plt24( platemap, size = 26, shape = 21, na_fill = "white", na_size_ratio = 0.9, na_alpha = 0.1 )
platemap |
platemap dataframe produced by |
size |
int, size parameter for ggplot2::geom_point |
shape |
int, shape parameter for ggplot2::geom_point |
na_fill |
string, fill colour for na or missing values |
na_size_ratio |
float, size ratio for missing values, set to 1 for same size as normal values. |
na_alpha |
float, alpha transparancy for missing or na values |
ggplot object
internal function
plt384( platemap, size = 5, shape = 22, na_fill = "white", na_size_ratio = 0.95, na_alpha = 0.1 )
plt384( platemap, size = 5, shape = 22, na_fill = "white", na_size_ratio = 0.95, na_alpha = 0.1 )
platemap |
platemap dataframe produced by |
size |
int, size parameter for ggplot2::geom_point |
shape |
int, shape parameter for ggplot2::geom_point |
na_fill |
string, fill colour for na or missing values |
na_size_ratio |
float, size ratio for missing values, set to 1 for same size as normal values. |
na_alpha |
float, alpha transparancy for missing or na values |
ggplot object
internal function
plt48( platemap, size = 18, shape = 21, na_fill = "white", na_size_ratio = 0.9, na_alpha = 0.1 )
plt48( platemap, size = 18, shape = 21, na_fill = "white", na_size_ratio = 0.9, na_alpha = 0.1 )
platemap |
platemap dataframe produced by |
size |
int, size parameter for ggplot2::geom_point |
shape |
int, shape parameter for ggplot2::geom_point |
na_fill |
string, fill colour for na or missing values |
na_size_ratio |
float, size ratio for missing values, set to 1 for same size as normal values. |
na_alpha |
float, alpha transparancy for missing or na values |
ggplot object
internal function
plt6( platemap, size = 50, shape = 21, na_fill = "white", na_alpha = 0.1, na_size_ratio = 0.9 )
plt6( platemap, size = 50, shape = 21, na_fill = "white", na_alpha = 0.1, na_size_ratio = 0.9 )
platemap |
platemap dataframe produced by |
size |
int, size parameter for ggplot2::geom_point |
shape |
int, shape parameter for ggplot2::geom_point |
na_fill |
string, fill colour for na or missing values |
na_alpha |
float, alpha transparancy for missing or na values |
na_size_ratio |
float, size ratio for missing values, set to 1 for same size as normal values. |
ggplot object
internal function
plt96( platemap, size = 10, shape = 21, na_fill = "white", na_size_ratio = 0.9, na_alpha = 0.1 )
plt96( platemap, size = 10, shape = 21, na_fill = "white", na_size_ratio = 0.9, na_alpha = 0.1 )
platemap |
platemap dataframe produced by |
size |
int, size parameter for ggplot2::geom_point |
shape |
int, shape parameter for ggplot2::geom_point |
na_fill |
string, fill colour for na or missing values |
na_size_ratio |
float, size ratio for missing values, set to 1 for same size as normal values. |
na_alpha |
float, alpha transparancy for missing or na values |
ggplot object
Converts numerical values. well labels, and plate labels into multiple plate heatmaps
raw_grid(data, well, plate_id, ncols = 2, plate = 96, ...)
raw_grid(data, well, plate_id, ncols = 2, plate = 96, ...)
data |
Numerical values to be plotted |
well |
Vector of well identifiers e.g "A01" |
plate_id |
Vector of plate identifiers e.g "Plate_1" |
ncols |
Number of columns to display multiple heatmaps |
plate |
Number of wells in complete plate (96, 384 or 1536) |
... |
additional parameters to plot wrappers |
ggplot plot
df01 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 1) df02 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 2) df <- rbind(df01, df02) raw_grid(data = df$vals, well = df$well, plate_id = df$plate, plate = 96)
df01 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 1) df02 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 2) df <- rbind(df01, df02) raw_grid(data = df$vals, well = df$well, plate_id = df$plate, plate = 96)
Converts numerical values and well labels into multiple plate heatmaps
raw_map(data, well, plate = 96, ...)
raw_map(data, well, plate = 96, ...)
data |
Numerical values to be plotted |
well |
Vector of well identifiers e.g "A01" |
plate |
Number of wells in complete plate (6, 12, 24, 48, 96, 384 or 1536) |
... |
additional parameters to plot wrappers |
ggplot plot
df <- data.frame(vals = rnorm(1:384), well = num_to_well(1:384, plate = 384)) raw_map(data = df$vals, well = df$well, plate = 384)
df <- data.frame(vals = rnorm(1:384), well = num_to_well(1:384, plate = 384)) raw_map(data = df$vals, well = df$well, plate = 384)
Annotates a dataframe containined well identifiers with metadata in the form of a platemap matrix, matching the existing well-labels to the well position in the platemap
read_map(data, map, verbose = TRUE, new_col_name = "header")
read_map(data, map, verbose = TRUE, new_col_name = "header")
data |
existing daatframe, with wellIDs under the column name of 'well' |
map |
Matrix of metadata to be added to the dataframe, N.B NO MISSING WELLS! |
verbose |
Boolean, if TRUE will add row and column numbers to dataframe |
new_col_name |
What to call the added metadata |
dataframe with new column named after 'new_col_name'
example data in a plate map form
readmap_data
readmap_data
96 integers structured in a the form of a 96-well plate
none
If someone (no names) puts in a plate upside down, this function
will rotate a plate matrix produced by plate_matrix
to be
the correct way up. I.e if A01 is in the bottom right hand corner rather
than the top left.
rotate_plate(m)
rotate_plate(m)
m |
matrix |
matrix
Updates a table representing a multiwell plate, by setting a given value for all wells in a block or a list of blocks defined by the well coordinates of their upper-left and bottom-right corners.
set_block(plate, block, what, value)
set_block(plate, block, what, value)
plate |
A table representing a multiwell plate, with one column named “well” representing the well identifiers. |
block |
Coordinates of a rectangular block (such as “A01~B02”), or a vector of coordinates. |
what |
A column name in the table. |
value |
The value to set. |
Returns the ‘plate
’ table, where the values for
the wells indicated in the blocks have been updated.
Charles Plessy
p <- data.frame(well = num_to_well(1:96)) head(p) p <- set_block(p, c("A01~B02", "A05~D05"), "dNTP", 0.25) p <- set_block(p, "A03", "dNTP", 0.50) head(p) # Be careful with the column names p <- set_block(p, "A01~H12", "Mg2+", 3.0) head(p) ## Not run: # Chained updates with magrittr p %<>% setBlock("A01~C04", "dNTP", 0.5) %>% setBlock("A01~C04", "Mg", 3.0) ## End(Not run)
p <- data.frame(well = num_to_well(1:96)) head(p) p <- set_block(p, c("A01~B02", "A05~D05"), "dNTP", 0.25) p <- set_block(p, "A03", "dNTP", 0.50) head(p) # Be careful with the column names p <- set_block(p, "A01~H12", "Mg2+", 3.0) head(p) ## Not run: # Chained updates with magrittr p %<>% setBlock("A01~C04", "dNTP", 0.5) %>% setBlock("A01~C04", "Mg", 3.0) ## End(Not run)
Converts alpha-numeric well labels to numbers corresponding to positions within a microtitre plate. Either 96 or 384 well plate, in column-wise order or in a column snaking pattern.
well_to_num(wells, style = "normal", plate = 96)
well_to_num(wells, style = "normal", plate = 96)
wells |
Vector of well identifiers e.g "A01" |
style |
Either normal, starting at the left hand column at each row or in a snaking fashion. ('normal' or 'snake') |
plate |
Number of wells in the complete plate (96 or 384) |
Vector of numbers
well_to_num("A01") well_to_num("P12", plate = 384) well_to_num("P12", plate = 384, style = "snake") wells <- c("A01", "A02", "A03") well_to_num(wells)
well_to_num("A01") well_to_num("P12", plate = 384) well_to_num("P12", plate = 384, style = "snake") wells <- c("A01", "A02", "A03") well_to_num(wells)
Converts numerical values. well labels, and plate labels into multiple plate heatmaps
z_grid( data, well, plate_id, ncols = 2, plate = 96, each = FALSE, scale_each = FALSE, ... )
z_grid( data, well, plate_id, ncols = 2, plate = 96, each = FALSE, scale_each = FALSE, ... )
data |
Numerical values to be plotted |
well |
Vector of well identifiers e.g "A01" |
plate_id |
Vector of plate identifiers e.g "Plate_1" |
ncols |
Number of columns to display multiple heatmaps |
plate |
Number of wells in complete plate (96, 384 or 1569) |
each |
boolean, allowed for backwards compatibility, |
scale_each |
boolean, if true scales each plate individually, if false
will scale the pooled values of |
... |
additional parameters to plot wrappers |
ggplot plot
df01 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 1) df02 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 2) df <- rbind(df01, df02) z_grid(data = df$vals, well = df$well, plate_id = df$plate, plate = 96)
df01 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 1) df02 <- data.frame(well = num_to_well(1:96), vals = rnorm(96), plate = 2) df <- rbind(df01, df02) z_grid(data = df$vals, well = df$well, plate_id = df$plate, plate = 96)
Converts numerical values and well labels into multiple plate heatmaps
z_map(data, well, plate = 96, ...)
z_map(data, well, plate = 96, ...)
data |
Numerical values to be plotted |
well |
Vector of well identifiers e.g "A01" |
plate |
Number of wells in complete plate (6, 12, 24, 48, 96, 384 or 1536)) |
... |
additional parameters to plot wrappers |
ggplot plot
df <- data.frame(vals = rnorm(1:384), well = num_to_well(1:384, plate = 384)) z_map(data = df$vals, well = df$well, plate = 384)
df <- data.frame(vals = rnorm(1:384), well = num_to_well(1:384, plate = 384)) z_map(data = df$vals, well = df$well, plate = 384)