Vignette of package bioassays"

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(bioassays)

Introduction

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.

prerequisite

The output reading from the instrument (eg.spectrophotometer) should be in a matrix format. An example data (csv format) is shown below. If the data is in .xls/.xlsx format read_excel function in 'readxl' package can be used.

data(rawdata96)
head(rawdata96)

A metadata is needed for the whole experiment. "row" and "col" columns are must in the metafile to indicate the location of well. An example is given below.

data(metafile96)
head(metafile96)

Functions

1. Function: extract_filename

extract_filename help 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="")

2. Function: rmodd_summary

rmodd_summary help to remove the outliers and summarise the values from a given set of function. 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 those values above/below 1.5 IQR is omitted (outliers omitted). If strict = TRUE more aggresive outlier removal is used to bring %cv below cutoff. n is the minimum number of samples you need per group if more aggresive outlier removal is used.

For e.g.

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)

3. Function: data2plateformat

data2plateformat convert the data (eg: readings from a 96 well plate) to 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, 384 values to represent the corresponding multiwell.

For e.g. To rename columns and rows of 'rawdata96' to right format.

rawdata<-data2plateformat(rawdata96,platetype = 96)
head(rawdata)

4. Function: plate2df

plate2df format matrix type 2D data of multi well plates as a dataframe. The function uses column names and row names of 'datamatrix' (2D data of a mutli well plate) and generate a dataframe with row, col (column) and position indices. The 'value' column represent 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)

5. Function: matrix96

matrix96 help to convert a dataframe in to a matrix format. Syntax is matrix96(dataframe,column,rm="FALSE"). dataframe is the dataframe to be formatted. The dataframe should have a "row" and "col" columns to function smoothly. column is the name of column that need be converted as a matrix.. If rm= "TRUE" then -ve and NA are assigned as 0.

For e.g.

matrix96(OD_df,"value")
matrix96(OD_df,"position")

6. Function: plate_metadata

plate_metadata combine the plate specific information (like compound used, standard concentration, dilution of samples, etc) and metadata, to produce unique plate metadata. Syntax is plate_metadata(plate_details, metadata,mergeby="type"). plate details is the plate specific information that need to be added to metadata. metadata is the metadata for whole experiment. mergeby is the column that is common to both metadata and plate_meta (this column will be used for merging 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 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, innerjoin (is a dplyr function) can be used.

data_DF<- dplyr::inner_join(OD_df,plate_meta,by=c("row","col","position"))

head(data_DF)

7. Function: heatplate

heatplate help to create a heatmap of 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 'matrix96' 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 give a heatmap of normalized values if the 'variable' is numeric. If it is a factorial variable, 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)

8. Function: reduceblank

reduceblank help to reduce blank values from the readings.

The syntax is reduceblank (dataframe,x_vector,blank_vector,y). dataframe is the data. x_vector is the entries for which the blank has to be reduced. If all entries has to reduced use "All". x_vector should be in a vector format eg: c("drug1","drug2",drug3" etc). blank_vector is the vector of blank names whose value has to be reduced (should be in a vector format eg: c("blank1","blank2","blank3","blank4")). This function will reduce 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 in nature. 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)

9. Function: estimate

estimate help to estimate the 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 need to be evaluated. colname is the column name for which the values has to be estimated. fitformula is the filling formula used. methord is to specify 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)

10. Function: dfsummary

dfsummary() help to summarize the dataframe (based on a column). It has additional controls to group samples and to omit variables not needed. 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, based on which samples are grouped. The order of elements in grp_vector determines the order of grouping. rm_vector is the vector of items need to be omitted before summarizing. nickname is the name that has to be given to the output dataframe. rm="FALSE" if outliers has not to be removed. If outliers has to be removed then rm ="TRUE". For more stringent methord for removing outlier the parameters are provided in a vector param. param has to be entered in the format c(strict="TRUE",cutoff=40,n=12). For details please refer rmodd_summary function.

For eg. 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 not omitted (rm="FALSE"). 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

11. Function: pvalue

pvalue() help to calculate the significance by t-test on the result dataframe. 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 eg.

pval<-pvalue(result, control="S8", sigval=0.05)
head(pval)


Try the bioassays package in your browser

Any scripts or data that you put into this service are public.

bioassays documentation built on Oct. 23, 2020, 6:48 p.m.