This tutorial guides the user through the process of doing Multiple Linear regression and data exploration on 16 MAP38 kinase inhibitors within the software package R. Explorative data analysis is carried out on this dataset, containing precalculated physicochemical descriptors. Multiple linear regression and correlation analysis are utilized to identify descriptors influencing koff.
In addition the following R packages are needed for this tutorial.
The code snippet below installs all packages needed.
For advanced classification and regression analysis, the R package caret developed by Max Kuhne is recommended. More on this topic
The input file has to be provided as a csv file. Each row represents a compound and the columns describe its physicochemical and kinetic parameters.
We extracted kinetic parameters for 16 MAP 38 alpha inhibitors from Regan et al. For these 16 inhibitors we calculated a set of five physicochemical descriptors using the MOE software. However any non-proprietary software can be used to generate the descriptors of interest, e.g. RDkit. This data is stored in the map38.csv file.
|compound_key||compound identifier taken from Regan et al.|
|pkon||−log10 transformed kon value, as reported in Regan et al.|
|pkoff||−log10 transformed koff value, as reported in Regan et al.|
|pkD||−log10 transformed KD value, as reported in Regan et al.|
|vsa_positiv||postitive surface area; descr. Q_VSA_POS in MOE|
|vsa_negative||negative surface area; descr. Q_VSA_NEG in MOE|
|vsa_polar||polar surface area; descr. Q_VSA_POL in MOE|
|lipophilicity||lipophilicity; descr. logP(o/w) in MOE|
|weight||Molecular weight, Weight in MOE|
The pipe operator %>% is handy way to run a sequence of functions. The broom::tidy function provides us with a summary of the dataset. The dplyr::select function is used to select a set of columns, it can also be used to exclude columns using the "-" sign as a prefix, e.g. select(-compound_key)
Copy the code snippet below into R or R Studio. The output of this section is a kinetic map, plotting pkon values on the x-axis against pkoff values on the y-axis. This is a quick way to draw a kinetic map, using ggplot2 . It allows visual inspection of the kinetic data distribution and facilitates the detection of outliers. Values of xintercept and yintercept can be altered according to covered pkon and pkoff ranges.
ggplot2::geom_abline draws diagonal lines
ggplot2::geom_vline draws vertical lines
ggplot2::geom_hline draws horizontal lines
ggplot2::ggrepel::geom_text_repel is used to avoid olverlapping labels
The following code snippets provides a routine to standardise your data using scale.
To prepare for the boxplot the data needs to be transformed using the tidyr::gather function. More on data transformation in R can be found here
A scatterplot matrix can be used to identify correlations between variables. The R package GGally provides the ggpairs function which outputs a scatterplot and correlation matrix from a data frame.
The leaps package includes the regsubsets function which provides forward, backward and exhaustive search for the best variable subset of a linear regression model. In this example we used the exhaustive method which tries all possible variable combinations. The output of the regbusbets function can be forwarded to the plot function, which sorts the variable combinations according to the adjusted R2.
According to the regsubsets function the best variable combination for a linear model is vsa_polar and weight.
This combination yields in an adjusted R2 = 0.79.
The R function lm returns a linear regression model. From the regsubsets function in the prior step, we found that weight and vsa_polar yielded in the best adjusted R2.
The model shows significant coefficients, however due to the strong intercorrelation between weight and vsa_polar one should be careful about interpretation. The ggcoef function can be used to visualize the coeffients of a regression model, including their standard errors.
This plot can only be viewed in HTML mode and WebGL enabled browsers.
An excellent introduction on regression diagnostics can be found here. More on regression diagnostics in R. The stastistical significance tests for the coefficients and the regression model are based on assumptions of the underlying data and error terms. The ggfortify provides a set of diagnostic plots to evaluate our obtained regression model.