knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(bioassays)
In a cell culture lab various cellular assays are performed. The package "bioassays" will help to analyse the results of these experiments performed in multiwell plates. The usage of various functions in the "bioassays" package is provided in this article.
The functions in this package can be used to summarise data from any multiwell plate, and by incorporating them in a loop several plates can be analyzed automatically. Two examples are also provided in the article.
The output reading from the instrument (eg.spectrophotometer) should be in a
matrix format. An example data file (csv format) is shown below. If the data is
in .xls/.xlsx format read_excel
function from the readxl
package can be used.
data(rawdata96) head(rawdata96)
A metadata file is needed for the whole experiment. The row
and col
columns
must be present in the metadata file to indicate the location of well. An
example is given below.
data(metafile96) head(metafile96)
extract_filename
helps to extract information from the file name. syntax is
extract_filename(filename,split = " ",end = ".csv", remove = " ", sep="-")
.
filename is the file name. split is the portions at which the name has
to be split (default is space " "). end is the extension of file name that
need to be removed (default is ".csv"). remove is the portion from the file
name that need to be omitted after splitting (default is space " "). sep add
a symbol between separate sections, default is "-".
This function is useful for extracting specific information from file names, like compound name, plate number etc, to provide appropriate analysis.
For e.g.
extract_filename("L HEPG2 P3 72HRS.csv")
extract_filename("L HEPG2 P3 72HRS.csv", split=" ",end=".csv",remove="L",sep="")
rmodd_summary
helps to remove outliers and summarises the values from a given
set of values. The syntax is rmodd_summary(x, rm = "FALSE", strict= "FALSE",
cutoff=80,n=3)
. x is a numeric vector. rm = TRUE if want to remove
outliers. If strict = FALSE values above/below 1.5 IQR are omitted (outliers
omitted). If strict = TRUE more aggresive outlier removal is used to bring
the %cv below the cutoff. n is the minimum number of samples you need
per group if more aggressive outlier removal is used.
For example:
x<- c(1.01,0.98,0.6,0.54,0.6,0.6,0.4,3) rmodd_summary(x, rm = "FALSE", strict= "FALSE", cutoff=80,n=3)
rmodd_summary(x, rm = "TRUE", strict= "FALSE", cutoff=80,n=3)
rmodd_summary(x, rm = "TRUE", strict= "TRUE", cutoff=20,n=5)
data2plateformat
converts the data (eg: readings from a 96 well plate) to an
appropriate matrix format. Syntax is data2plateformat(data, platetype = 96)
.
data is the data to be formatted. platetype is the plate from which the
data is coming. It can take 6, 12, 24, 96 or 384 values to represent the
corresponding multiwell plate type.
For e.g. To rename columns and rows of rawdata96
to right format.
rawdata<-data2plateformat(rawdata96,platetype = 96) head(rawdata)
plate2df
coereces a matrix with values from multiwell plates into data.frame.
The function uses column names and row names of datamatrix
(2D data of a
mutliwell plate) and generates a dataframe with row, col (column) and position
indices. The value
column represents the corresponding value in the
datamarix
.
Syntax is plate2df(datamatrix)
. datamatrix is the data in matrix format.
For eg.
OD_df <- plate2df(rawdata) head(OD_df)
matrix96
helps to convert a data.frame into a matrix. The syntax is
matrix96(dataframe,column,rm="FALSE")
. dataframe is the data.frame to be
formatted. The data.frame must contain row
and col
columns. column is the
name of column that needs to be converted into a matrix. If rm= "TRUE" then
-ve and NA are set to 0.
For e.g.
matrix96(OD_df,"value")
matrix96(OD_df,"position")
plate_metadata
combines the plate-specific information (like compound used,
standard concentration, dilution of samples, etc) and metadata into unique plate
metadata. The syntax is plate_metadata(plate_details,
metadata,mergeby="type")
. plate details is the plate specific information
that needs to be added to metadata. metadata is the metadata for the whole
experiment. mergeby is the column that is common to both metadata and
plate_meta
(this column will be used to merge the information).
For eg. An incomplete meta data
head(metafile96)
Plate specific details are.
plate_details <- list("compound" = "Taxol", "concentration" = c(0.00,0.01,0.02,0.05,0.10,1.00,5.00,10.00), "type" = c("S1","S2","S3","S4","S5","S6","S7","S8"), "dilution" = 1)
Using the plate-specific info, the metadata can be filled by calling
plate_metadata
function.
plate_meta<-plate_metadata(plate_details,metafile96,mergeby="type") head(plate_meta)
To join both plate_meta and OD_df, the dplyr::inner_join
function can be used.
data_DF<- dplyr::inner_join(OD_df,plate_meta,by=c("row","col","position")) head(data_DF)
heatplate
creates a heatmap representation of a multiwell plate. The syntax is heatplate(datamatrix,name,size=7.5)
. datamatrix is the data in matrix
format. An easy way to create this is by calling the matrix96
function, as
explained before. name is the name to be given for heatmap,
size is the size of each well in the heatmap (default is 7.5).
This function will produce a heatmap of normalized values if the variable
is
numeric. If it is a factor, it will simple provide a coloured categorical plot.
eg 1. Categorical plot
datamatrix<-matrix96(metafile96,"id") datamatrix
heatplate(datamatrix,"Plate 1", size=5)
eg 2. Heatmap
rawdata<-data2plateformat(rawdata96,platetype = 96) OD_df<- plate2df(rawdata) data<-matrix96(OD_df,"value") data
heatplate(data,"Plate 1", size=5)
reduceblank
helps to reduce blank values from the readings.
The syntax is reduceblank (dataframe,x_vector,blank_vector,y)
. dataframe
is the data. x_vector are the entries for which the blank has to be
subtracted If all entries have to subtracted, then use "All". x_vector should be
a vector eg: c("drug1","drug2",drug3" etc). blank_vector is a vector of
blank names whose value has to be subtracted eg:
c("blank1","blank2","blank3","blank4")). This function will subtract the first
blank vector element from first x_vector element and so on. y is the column
name where the action will take place. y should be numeric. The results will
appear as a new column named blankminus
.
For eg.
data_DF<-reduceblank(data_DF, x_vector =c("All"), blank_vector = c("Blank"), "value") head(data_DF)
estimate
estimates an unknown variable (eg: concentration) based on the
standard curve. Syntax is
estimate(data=dataframe,colname="blankminus",fitformula=fit,
methord="linear/nplr")
. data is the dataframe which needs to be evaluated.
colname is the column name for which the values has to be estimated.
fitformula represents the model to be fit methord specifies if linear or
nonparametric logistic curve was used for the fitformula.
For eg: data_DF is a dataframe for which the concentration has to be estimated based on the value of blankminus.
For filtering the standards
std<- dplyr::filter(data_DF, data_DF$id=="STD") std<- aggregate(std$blankminus ~ std$concentration, FUN = mean ) colnames (std) <-c("con", "OD") head(std)
To fit a standard curve:
fit1 is the 3 parameter logistic curve model and fit2 is the linear regression model. The appropriate one for your experiment can be used.
fit2<-stats::lm(formula = con ~ OD,data = std)# linear model fit1<-nplr::nplr(std$con,std$OD,npars=3,useLog = FALSE)# nplr, 3 parameter model
For estimating the concentration using linear model
estimated<-estimate(data_DF,colname="blankminus",fitformula=fit2,method="linear") head(estimated)
For estimating the concentration using nplr methord
estimated2<-estimate(data_DF,colname="blankminus",fitformula=fit1,method="nplr") head(estimated2)
dfsummary()
summarizes the data.frame (based on a column). It has additional
controls to group samples and to omit variables not needed. The syntax is
dfsummary(dataframe,y,grp_vector,rm_vector,nickname,rm="FALSE",param)
.
dataframe is the data. y is the numeric variable (column name) that has
to be summarized. grp_vector is a vector of column names, determining which
samples will be grouped. The order of the elements in grp_vector determines the
order of grouping. rm_vector is the vector of items to be omitted before
summarizing. nickname is the name for the output data.frame. Set
rm="FALSE" if outliers should not be removed. To apply more stringent
thresholds for removing outliers, parameters can be provided in the param
vector. param has to be entered in the format
c(strict="TRUE",cutoff=40,n=12)
. For details please refer to the
rmodd_summary
function.
In the following example, the data has to be summarized based on the "type" column. "estimated" values are summarized. Samples are grouped as per "id". "STD" and "Blank" values need to be omitted. Outliers are retained (rm="FALSE"). The nickname for the plate is "plate1".
result<-dfsummary(estimated,"estimated",c("id","type"), c("STD","Blank"),"plate1", rm="FALSE", param=c(strict="FALSE",cutoff=40,n=12)) result
The pvalue()
function applies a t-test to the result dataframe. The syntax is
pvalue(dataframe,control,sigval)
. dataframe is the result of dfsummary.
control is the group that is considered as control, sigval is the pvalue
cutoff (a value below this is considered as significant).
For example:
pval<-pvalue(result, control="S8", sigval=0.05) head(pval)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.