The identification of novel compound-protein interaction (CPI) is important in drug discovery. Revealing unknown compound-protein interactions is useful to design a new drug for a target protein by screening candidate compounds. The accurate CPI prediction assists in effective drug discovery process. To identify potential CPI effectively, prediction methods based on machine learning and deep learning have been developed. Data for sequences are provided as discrete symbolic data. In the data, compounds are represented as SMILES (simplified molecular-input line-entry system) strings and proteins are sequences in which the characters are amino acids. The outcome is defined as a variable that indicates how strong two molecules interact with each other or whether there is an interaction between them. In this package, a deep-learning based model that takes only sequence information of both compounds and proteins as input and the outcome as output is used to predict CPI. The model is implemented by using compound and protein encoders with useful features. The CPI model also supports other modeling tasks, including protein-protein interaction (PPI), chemical-chemical interaction (CCI), or single compounds and proteins. Although the model is designed for proteins, DNA and RNA can be used if they are represented as sequences.
Multilayer perceptron (MLP) is the simplest form of neural networks consisting only of fully connected layers. Convolutional Neural Network (CNN) has convolutional layers instead of fully connected layers in the initial phase of the network. Recurrent neural network (RNN) are distinguished from other classes by presence of components with memory, containing long short term memory (LSTM) and gated recurrent units (GRU). The graph neural network (GNN) is a class of deep learning methods designed to perform inference on graph data. The graph convolutional network (GCN) is a type of GNN that can work directly on graphs and take advantage of their structural information. The GCN enables to learn hidden layer representations that capture both graph structure and node features. Compounds are represented as graphs and GCN can be used to learn compound-protein interactions. In molecular graph representations, nodes represent atoms and edges represent bonds. Besides graphs, a molecular fingerprint can be extracted from SMILES strings. A molecular fingerprint is a way of encoding the structural features of a molecule. Fingerprints are special kinds of descriptors that characterize a molecule and its properties as a binary bit vector that represents the presence or absence of particular substructure in the molecule. The Chemistry Development Kit (CDK) is an open source toolkit for bioinformatics and cheminformatics. It can accept the SMILES notation of a molecule as input to calculate molecular descriptors and fingerprints or get structural information. It can be implemented in R by the rcdk package.
The “example_cpi” dataset has compound-protein pairs and their interactions. Each line has a SMILES string, an amino acid sequence, and a label. Here, the label 1 means that the pair of SMILES and amino acid sequences has interaction and 0 means that the pair does not have interaction. In order to avoid overfitting, the data is split into a training sample and a validation sample. The training sample is used to estimate parameters or weights of the deep learning models. The validation sample is an independent sample, set aside to monitor the misclassification error. Here, 70% of the data are used for training and 30% for validation.
if (keras::is_keras_available() & reticulate::py_available()) {
library(DeepPINCS)
example_cpi <- example_cpi[1:500,]
validation_split <- 0.3
idx <- sample(seq_len(length(example_cpi[,1])))
train_idx <- seq_len(length(example_cpi[,1])) %in%
idx[seq_len(round(length(example_cpi[,1]) * (1 - validation_split)))]
}
## Loading required package: keras
The input sequences are fed into encoders. We need to provide the list of arguments for compound and protein encoder networks and for fully connected layer. For compound and protein networks, input and output tensors of encoders are required. Here, we can choose the graph convolutional network (GCN), recurrent neural network (RNN), convolutional neural network (CNN), and multilayer perceptron (MLP) as encoders. Additionally, we can use our own encoders. Note that the GCN is only available for compounds. The arguments for the “compound” and “protein” are the function of encoders with input and output tensors. The “compound_arg” and “protein_arg” are the arguments of the functions. The compound and protein encoders are concatenated and they are passed to the dense layer. A dense layer is a fully connected layer. We now need to compile the model, this step configures the learning process for our neural network architecture. We need to provide three arguments including the optimization algorithm to be used, the loss function to be optimized and metrics for evaluation.
if (keras::is_keras_available() & reticulate::py_available()) {
net_args <- list(
compound = "gcn_in_out",
compound_args = list(
gcn_units = c(128, 64),
gcn_activation = c("relu", "relu"),
fc_units = c(10),
fc_activation = c("relu")),
protein = "cnn_in_out",
protein_args = list(
cnn_filters = c(32),
cnn_kernel_size = c(3),
cnn_activation = c("relu"),
fc_units = c(10),
fc_activation = c("relu")),
fc_units = c(1),
fc_activation = c("sigmoid"),
loss = "binary_crossentropy",
optimizer = keras::optimizer_adam(),
metrics = "accuracy")
}
For example, consider the GCN for compounds and the CNN for proteins. For the GCN, we have to set the maximum number of atoms since every compound has not the same number of atoms. The degree of an atom in the graph representation and the atomic symbol and implicit hydrogen count for an atom are used as molecular features. Similarly, we define the maximum number of amino acids because there will be proteins of different lengths. In other words, naturally, some of the proteins are shorter and longer. The layer for embeddings to help us map strings to vectors. For them, we need to provide the dimension of the dense embedding. The n-gram is available only for protein sequences. We can use “callbacks”. The callback functions can terminate the training process, modify the learning rate, and save snapshots of the best version of our model during the training process.
if (keras::is_keras_available() & reticulate::py_available()) {
compound_max_atoms <- 50
protein_embedding_dim <- 16
protein_length_seq <- 100
gcn_cnn_cpi <- fit_cpi(
smiles = example_cpi[train_idx, 1],
AAseq = example_cpi[train_idx, 2],
outcome = example_cpi[train_idx, 3],
compound_type = "graph",
compound_max_atoms = compound_max_atoms,
protein_length_seq = protein_length_seq,
protein_embedding_dim = protein_embedding_dim,
protein_ngram_max = 2,
protein_ngram_min = 1,
smiles_val = example_cpi[!train_idx, 1],
AAseq_val = example_cpi[!train_idx, 2],
outcome_val = example_cpi[!train_idx, 3],
net_args = net_args,
epochs = 20,
batch_size = 64,
callbacks = keras::callback_early_stopping(
monitor = "val_accuracy",
patience = 10,
restore_best_weights = TRUE))
ttgsea::plot_model(gcn_cnn_cpi$model)
}
## checking sequences...
## preprocessing for compounds...
## preprocessing for proteins...
## fitting model...
## Epoch 1/20
## 6/6 - 2s - loss: 0.6910 - accuracy: 0.4943 - val_loss: 0.6857 - val_accuracy: 0.5067 - 2s/epoch - 320ms/step
## Epoch 2/20
## 6/6 - 0s - loss: 0.6851 - accuracy: 0.5314 - val_loss: 0.6817 - val_accuracy: 0.5133 - 108ms/epoch - 18ms/step
## Epoch 3/20
## 6/6 - 0s - loss: 0.6799 - accuracy: 0.6057 - val_loss: 0.6760 - val_accuracy: 0.5733 - 71ms/epoch - 12ms/step
## Epoch 4/20
## 6/6 - 0s - loss: 0.6744 - accuracy: 0.6343 - val_loss: 0.6719 - val_accuracy: 0.6133 - 70ms/epoch - 12ms/step
## Epoch 5/20
## 6/6 - 0s - loss: 0.6692 - accuracy: 0.6543 - val_loss: 0.6678 - val_accuracy: 0.6667 - 70ms/epoch - 12ms/step
## Epoch 6/20
## 6/6 - 0s - loss: 0.6635 - accuracy: 0.6800 - val_loss: 0.6624 - val_accuracy: 0.6600 - 68ms/epoch - 11ms/step
## Epoch 7/20
## 6/6 - 0s - loss: 0.6575 - accuracy: 0.6686 - val_loss: 0.6570 - val_accuracy: 0.6400 - 68ms/epoch - 11ms/step
## Epoch 8/20
## 6/6 - 0s - loss: 0.6506 - accuracy: 0.6800 - val_loss: 0.6513 - val_accuracy: 0.6667 - 68ms/epoch - 11ms/step
## Epoch 9/20
## 6/6 - 0s - loss: 0.6433 - accuracy: 0.6886 - val_loss: 0.6449 - val_accuracy: 0.6667 - 68ms/epoch - 11ms/step
## Epoch 10/20
## 6/6 - 0s - loss: 0.6343 - accuracy: 0.6914 - val_loss: 0.6388 - val_accuracy: 0.6933 - 81ms/epoch - 14ms/step
## Epoch 11/20
## 6/6 - 0s - loss: 0.6258 - accuracy: 0.7143 - val_loss: 0.6319 - val_accuracy: 0.6933 - 81ms/epoch - 13ms/step
## Epoch 12/20
## 6/6 - 0s - loss: 0.6159 - accuracy: 0.7143 - val_loss: 0.6241 - val_accuracy: 0.6933 - 80ms/epoch - 13ms/step
## Epoch 13/20
## 6/6 - 0s - loss: 0.6033 - accuracy: 0.7343 - val_loss: 0.6162 - val_accuracy: 0.6600 - 83ms/epoch - 14ms/step
## Epoch 14/20
## 6/6 - 0s - loss: 0.5942 - accuracy: 0.7400 - val_loss: 0.6081 - val_accuracy: 0.6600 - 84ms/epoch - 14ms/step
## Epoch 15/20
## 6/6 - 0s - loss: 0.5762 - accuracy: 0.7657 - val_loss: 0.5997 - val_accuracy: 0.7000 - 83ms/epoch - 14ms/step
## Epoch 16/20
## 6/6 - 0s - loss: 0.5638 - accuracy: 0.7543 - val_loss: 0.5893 - val_accuracy: 0.6933 - 83ms/epoch - 14ms/step
## Epoch 17/20
## 6/6 - 0s - loss: 0.5469 - accuracy: 0.7943 - val_loss: 0.5829 - val_accuracy: 0.6933 - 85ms/epoch - 14ms/step
## Epoch 18/20
## 6/6 - 0s - loss: 0.5295 - accuracy: 0.8114 - val_loss: 0.5722 - val_accuracy: 0.6933 - 81ms/epoch - 13ms/step
## Epoch 19/20
## 6/6 - 0s - loss: 0.5118 - accuracy: 0.8200 - val_loss: 0.5650 - val_accuracy: 0.7133 - 88ms/epoch - 15ms/step
## Epoch 20/20
## 6/6 - 0s - loss: 0.4948 - accuracy: 0.8314 - val_loss: 0.5575 - val_accuracy: 0.6867 - 79ms/epoch - 13ms/step
Using the trained model, we can predict whether pairs of SMILES and amino acid sequences have interaction or not. A very convenient way to evaluate the accuracy of a model is the use of a table that summarizes the performance of our algorithm against the data provided. The Receiver Operator Characteristic (ROC) is a quantitative analysis technique used in binary classification. The ROC curve is a helpful diagnostic for a model. The Area Under the Curve (AUC) can be calculated and provide a single score to summarize the plot that can be used to compare models. An alternative to the ROC curve is the precision-recall curve that can be useful for imbalanced data.
if (keras::is_keras_available() & reticulate::py_available()) {
pred <- predict_cpi(gcn_cnn_cpi,
smiles = example_cpi[!train_idx, 1],
AAseq = example_cpi[!train_idx, 2],
batch_size = 32)
pred_calss <- ifelse(pred$values > 0.5, 1, 0)
table(pred_calss, example_cpi[!train_idx, 3])
roc <- PRROC::roc.curve(scores.class0 = pred$values[example_cpi[!train_idx, 3] == 1],
scores.class1 = pred$values[example_cpi[!train_idx,3] == 0],
curve = TRUE)
plot(roc)
pr <- PRROC::pr.curve(scores.class0 = pred$values[example_cpi[!train_idx, 3] == 1],
scores.class1 = pred$values[example_cpi[!train_idx,3] == 0],
curve = TRUE)
plot(pr)
}
## checking sequences...
## preprocessing for compounds...
## preprocessing for proteins...
## predicting model...
## 5/5 - 0s - 179ms/epoch - 36ms/step
The chemical-chemical interactions such as drug-drug interactions (DDI) have become one of the emerging topics of the clinical drug development. Predictions of DDI are fueled by recent growth of knowledge in molecular biology, computation based simulation or predictions, and a better understanding of the inhibition and induction mechanisms. Here, the molecular fingerprint is used from SMILES strings.
if (keras::is_keras_available() & reticulate::py_available()) {
library(DeepPINCS)
validation_split <- 0.3
idx <- sample(seq_len(length(example_cci[,1])))
train_idx <- seq_len(length(example_cci[,1])) %in%
idx[seq_len(round(length(example_cci[,1]) * (1 - validation_split)))]
mlp_mlp_cci <- fit_cpi(
smiles = example_cci[train_idx, 1:2],
outcome = example_cci[train_idx, 3],
compound_type = "fingerprint",
smiles_val = example_cci[!train_idx, 1:2],
outcome_val = example_cci[!train_idx, 3],
net_args = list(
compound = "mlp_in_out",
compound_args = list(
fc_units = c(10, 5),
fc_activation = c("relu", "relu")),
fc_units = c(1),
fc_activation = c("sigmoid"),
loss = "binary_crossentropy",
optimizer = keras::optimizer_adam(),
metrics = "accuracy"),
epochs = 20, batch_size = 64,
callbacks = keras::callback_early_stopping(
monitor = "val_accuracy",
patience = 10,
restore_best_weights = TRUE))
ttgsea::plot_model(mlp_mlp_cci$model)
pred <- predict_cpi(mlp_mlp_cci,
smiles = example_cci[!train_idx, 1:2],
batch_size = 32)
pred_calss <- ifelse(pred$values > 0.5, 1, 0)
table(pred_calss, example_cci[!train_idx, 3])
}
## checking sequences...
## preprocessing for compounds...
## fitting model...
## Epoch 1/20
## 11/11 - 1s - loss: 0.6893 - accuracy: 0.5286 - val_loss: 0.6805 - val_accuracy: 0.5800 - 1s/epoch - 101ms/step
## Epoch 2/20
## 11/11 - 0s - loss: 0.6556 - accuracy: 0.6829 - val_loss: 0.6525 - val_accuracy: 0.6600 - 63ms/epoch - 6ms/step
## Epoch 3/20
## 11/11 - 0s - loss: 0.6123 - accuracy: 0.7271 - val_loss: 0.6283 - val_accuracy: 0.6600 - 64ms/epoch - 6ms/step
## Epoch 4/20
## 11/11 - 0s - loss: 0.5572 - accuracy: 0.7914 - val_loss: 0.6022 - val_accuracy: 0.7100 - 64ms/epoch - 6ms/step
## Epoch 5/20
## 11/11 - 0s - loss: 0.5022 - accuracy: 0.8186 - val_loss: 0.5836 - val_accuracy: 0.7267 - 66ms/epoch - 6ms/step
## Epoch 6/20
## 11/11 - 0s - loss: 0.4481 - accuracy: 0.8514 - val_loss: 0.5615 - val_accuracy: 0.7367 - 63ms/epoch - 6ms/step
## Epoch 7/20
## 11/11 - 0s - loss: 0.4045 - accuracy: 0.8629 - val_loss: 0.5484 - val_accuracy: 0.7433 - 63ms/epoch - 6ms/step
## Epoch 8/20
## 11/11 - 0s - loss: 0.3613 - accuracy: 0.8714 - val_loss: 0.5391 - val_accuracy: 0.7633 - 63ms/epoch - 6ms/step
## Epoch 9/20
## 11/11 - 0s - loss: 0.3260 - accuracy: 0.8900 - val_loss: 0.5324 - val_accuracy: 0.7533 - 62ms/epoch - 6ms/step
## Epoch 10/20
## 11/11 - 0s - loss: 0.2947 - accuracy: 0.9057 - val_loss: 0.5208 - val_accuracy: 0.7700 - 67ms/epoch - 6ms/step
## Epoch 11/20
## 11/11 - 0s - loss: 0.2663 - accuracy: 0.9086 - val_loss: 0.5141 - val_accuracy: 0.7733 - 67ms/epoch - 6ms/step
## Epoch 12/20
## 11/11 - 0s - loss: 0.2436 - accuracy: 0.9243 - val_loss: 0.5195 - val_accuracy: 0.7800 - 70ms/epoch - 6ms/step
## Epoch 13/20
## 11/11 - 0s - loss: 0.2158 - accuracy: 0.9429 - val_loss: 0.5064 - val_accuracy: 0.7700 - 66ms/epoch - 6ms/step
## Epoch 14/20
## 11/11 - 0s - loss: 0.1950 - accuracy: 0.9486 - val_loss: 0.5117 - val_accuracy: 0.7767 - 65ms/epoch - 6ms/step
## Epoch 15/20
## 11/11 - 0s - loss: 0.1771 - accuracy: 0.9557 - val_loss: 0.5084 - val_accuracy: 0.7833 - 61ms/epoch - 6ms/step
## Epoch 16/20
## 11/11 - 0s - loss: 0.1586 - accuracy: 0.9657 - val_loss: 0.5150 - val_accuracy: 0.7833 - 59ms/epoch - 5ms/step
## Epoch 17/20
## 11/11 - 0s - loss: 0.1462 - accuracy: 0.9686 - val_loss: 0.5171 - val_accuracy: 0.7933 - 57ms/epoch - 5ms/step
## Epoch 18/20
## 11/11 - 0s - loss: 0.1322 - accuracy: 0.9729 - val_loss: 0.5325 - val_accuracy: 0.7867 - 58ms/epoch - 5ms/step
## Epoch 19/20
## 11/11 - 0s - loss: 0.1207 - accuracy: 0.9743 - val_loss: 0.5308 - val_accuracy: 0.7833 - 58ms/epoch - 5ms/step
## Epoch 20/20
## 11/11 - 0s - loss: 0.1144 - accuracy: 0.9771 - val_loss: 0.5478 - val_accuracy: 0.7700 - 60ms/epoch - 5ms/step
## checking sequences...
## preprocessing for compounds...
## predicting model...
## 10/10 - 0s - 83ms/epoch - 8ms/step
##
## pred_calss 0 1
## 0 122 33
## 1 36 109
The protein-protein interactions (PPIs) are biochemical events that play an important role in the functioning of the cell. The prediction of protein-protein interactions has important implications for understanding the behavioral processes of life, preventing diseases, and developing new drugs. Here, the n-gram for proteins is available. However, the q-gram would be better than the n-gram, since the q-gram is a string of q characters. In literature on text classification, the term n-gram is often used instead of the q-gram.
if (keras::is_keras_available() & reticulate::py_available()) {
validation_split <- 0.3
idx <- sample(seq_len(length(example_ppi[,1])))
train_idx <- seq_len(length(example_ppi[,1])) %in%
idx[seq_len(round(length(example_ppi[,1]) * (1 - validation_split)))]
protein_embedding_dim <- 16
protein_length_seq <- 100
mlp_mlp_ppi <- fit_cpi(
AAseq = example_ppi[train_idx, 1:2],
outcome = example_ppi[train_idx, 3],
protein_length_seq = protein_length_seq,
protein_embedding_dim = protein_embedding_dim,
AAseq_val = example_ppi[!train_idx, 1:2],
outcome_val = example_ppi[!train_idx, 3],
net_args = list(
protein = "mlp_in_out",
protein_args = list(
fc_units = c(10, 5),
fc_activation = c("relu", "relu")),
fc_units = c(1),
fc_activation = c("sigmoid"),
loss = "binary_crossentropy",
optimizer = keras::optimizer_adam(),
metrics = "accuracy"),
epochs = 20, batch_size = 64,
callbacks = keras::callback_early_stopping(
monitor = "val_accuracy",
patience = 10,
restore_best_weights = TRUE))
ttgsea::plot_model(mlp_mlp_ppi$model)
pred <- predict_cpi(mlp_mlp_ppi,
AAseq = example_ppi[!train_idx, 1:2],
batch_size = 32)
pred_calss <- ifelse(pred$values > 0.5, 1, 0)
table(pred_calss, example_ppi[!train_idx,3])
}
## checking sequences...
## preprocessing for proteins...
## fitting model...
## Epoch 1/20
## 55/55 - 2s - loss: 0.6929 - accuracy: 0.5131 - val_loss: 0.6913 - val_accuracy: 0.5693 - 2s/epoch - 30ms/step
## Epoch 2/20
## 55/55 - 0s - loss: 0.6809 - accuracy: 0.6549 - val_loss: 0.6839 - val_accuracy: 0.5813 - 213ms/epoch - 4ms/step
## Epoch 3/20
## 55/55 - 0s - loss: 0.6388 - accuracy: 0.7086 - val_loss: 0.6638 - val_accuracy: 0.6180 - 221ms/epoch - 4ms/step
## Epoch 4/20
## 55/55 - 0s - loss: 0.5462 - accuracy: 0.7609 - val_loss: 0.6633 - val_accuracy: 0.6133 - 200ms/epoch - 4ms/step
## Epoch 5/20
## 55/55 - 0s - loss: 0.4471 - accuracy: 0.8169 - val_loss: 0.6864 - val_accuracy: 0.6273 - 486ms/epoch - 9ms/step
## Epoch 6/20
## 55/55 - 0s - loss: 0.3687 - accuracy: 0.8583 - val_loss: 0.7244 - val_accuracy: 0.6353 - 203ms/epoch - 4ms/step
## Epoch 7/20
## 55/55 - 0s - loss: 0.3115 - accuracy: 0.8880 - val_loss: 0.7641 - val_accuracy: 0.6420 - 262ms/epoch - 5ms/step
## Epoch 8/20
## 55/55 - 0s - loss: 0.2630 - accuracy: 0.9126 - val_loss: 0.8247 - val_accuracy: 0.6427 - 318ms/epoch - 6ms/step
## Epoch 9/20
## 55/55 - 0s - loss: 0.2282 - accuracy: 0.9274 - val_loss: 0.9069 - val_accuracy: 0.6400 - 271ms/epoch - 5ms/step
## Epoch 10/20
## 55/55 - 0s - loss: 0.1958 - accuracy: 0.9423 - val_loss: 0.9493 - val_accuracy: 0.6467 - 237ms/epoch - 4ms/step
## Epoch 11/20
## 55/55 - 0s - loss: 0.1767 - accuracy: 0.9454 - val_loss: 0.9826 - val_accuracy: 0.6493 - 254ms/epoch - 5ms/step
## Epoch 12/20
## 55/55 - 0s - loss: 0.1567 - accuracy: 0.9506 - val_loss: 1.0455 - val_accuracy: 0.6493 - 225ms/epoch - 4ms/step
## Epoch 13/20
## 55/55 - 0s - loss: 0.1387 - accuracy: 0.9597 - val_loss: 1.1058 - val_accuracy: 0.6527 - 251ms/epoch - 5ms/step
## Epoch 14/20
## 55/55 - 0s - loss: 0.1284 - accuracy: 0.9589 - val_loss: 1.1688 - val_accuracy: 0.6493 - 228ms/epoch - 4ms/step
## Epoch 15/20
## 55/55 - 0s - loss: 0.1188 - accuracy: 0.9660 - val_loss: 1.2054 - val_accuracy: 0.6467 - 264ms/epoch - 5ms/step
## Epoch 16/20
## 55/55 - 0s - loss: 0.1093 - accuracy: 0.9643 - val_loss: 1.2618 - val_accuracy: 0.6487 - 259ms/epoch - 5ms/step
## Epoch 17/20
## 55/55 - 0s - loss: 0.1029 - accuracy: 0.9683 - val_loss: 1.3162 - val_accuracy: 0.6467 - 246ms/epoch - 4ms/step
## Epoch 18/20
## 55/55 - 0s - loss: 0.0925 - accuracy: 0.9711 - val_loss: 1.3898 - val_accuracy: 0.6447 - 266ms/epoch - 5ms/step
## Epoch 19/20
## 55/55 - 0s - loss: 0.0867 - accuracy: 0.9729 - val_loss: 1.4344 - val_accuracy: 0.6380 - 274ms/epoch - 5ms/step
## Epoch 20/20
## 55/55 - 0s - loss: 0.0839 - accuracy: 0.9754 - val_loss: 1.4797 - val_accuracy: 0.6393 - 272ms/epoch - 5ms/step
## checking sequences...
## preprocessing for proteins...
## predicting model...
## 47/47 - 0s - 141ms/epoch - 3ms/step
##
## pred_calss 0 1
## 0 471 232
## 1 309 488
Although the function “fit_cpi” is designed for amino acid sequences, we may instead use nucleic acid sequences, if they are composed of capital letters of an alphabet.
if (keras::is_keras_available() & reticulate::py_available()) {
validation_split <- 0.1
idx <- sample(seq_len(length(example_pd[,1])))
train_idx <- seq_len(length(example_pd[,1])) %in%
idx[seq_len(round(length(example_pd[,1]) * (1 - validation_split)))]
protein_embedding_dim <- 16
protein_length_seq <- 30
mlp_mlp_pd <- fit_cpi(
AAseq = example_pd[train_idx, 1:2],
outcome = example_pd[train_idx, 3],
protein_length_seq = protein_length_seq,
protein_embedding_dim = protein_embedding_dim,
AAseq_val = example_pd[!train_idx, 1:2],
outcome_val = example_pd[!train_idx, 3],
net_args = list(
protein = "mlp_in_out",
protein_args = list(
fc_units = c(10, 5),
fc_activation = c("relu", "relu")),
fc_units = c(1),
fc_activation = c("sigmoid"),
loss = "binary_crossentropy",
optimizer = keras::optimizer_adam(),
metrics = "accuracy"),
epochs = 30, batch_size = 16,
callbacks = keras::callback_early_stopping(
monitor = "val_accuracy",
patience = 10,
restore_best_weights = TRUE))
pred <- predict_cpi(mlp_mlp_pd,
AAseq = example_pd[!train_idx, 1:2],
batch_size = 16)
pred_calss <- ifelse(pred$values > 0.5, 1, 0)
table(pred_calss, example_pd[!train_idx, 3])
}
## checking sequences...
## preprocessing for proteins...
## fitting model...
## Epoch 1/30
## 18/18 - 1s - loss: 0.6181 - accuracy: 0.8223 - val_loss: 0.5053 - val_accuracy: 0.8750 - 1s/epoch - 75ms/step
## Epoch 2/30
## 18/18 - 0s - loss: 0.4665 - accuracy: 0.8328 - val_loss: 0.3648 - val_accuracy: 0.8750 - 72ms/epoch - 4ms/step
## Epoch 3/30
## 18/18 - 0s - loss: 0.4231 - accuracy: 0.8328 - val_loss: 0.3427 - val_accuracy: 0.8750 - 66ms/epoch - 4ms/step
## Epoch 4/30
## 18/18 - 0s - loss: 0.4070 - accuracy: 0.8328 - val_loss: 0.3324 - val_accuracy: 0.8750 - 68ms/epoch - 4ms/step
## Epoch 5/30
## 18/18 - 0s - loss: 0.3931 - accuracy: 0.8328 - val_loss: 0.3227 - val_accuracy: 0.8750 - 72ms/epoch - 4ms/step
## Epoch 6/30
## 18/18 - 0s - loss: 0.3772 - accuracy: 0.8328 - val_loss: 0.3134 - val_accuracy: 0.8750 - 66ms/epoch - 4ms/step
## Epoch 7/30
## 18/18 - 0s - loss: 0.3638 - accuracy: 0.8328 - val_loss: 0.3056 - val_accuracy: 0.8750 - 65ms/epoch - 4ms/step
## Epoch 8/30
## 18/18 - 0s - loss: 0.3487 - accuracy: 0.8362 - val_loss: 0.3025 - val_accuracy: 0.8750 - 67ms/epoch - 4ms/step
## Epoch 9/30
## 18/18 - 0s - loss: 0.3350 - accuracy: 0.8397 - val_loss: 0.3011 - val_accuracy: 0.8750 - 64ms/epoch - 4ms/step
## Epoch 10/30
## 18/18 - 0s - loss: 0.3161 - accuracy: 0.8502 - val_loss: 0.2998 - val_accuracy: 0.8438 - 66ms/epoch - 4ms/step
## Epoch 11/30
## 18/18 - 0s - loss: 0.2968 - accuracy: 0.8606 - val_loss: 0.3086 - val_accuracy: 0.8438 - 77ms/epoch - 4ms/step
## checking sequences...
## preprocessing for proteins...
## predicting model...
## 1/1 - 0s - 88ms/epoch - 88ms/step
##
## pred_calss 0 1
## 0 28 4
Even though the function “fit_cpi” is designed for pairs of compounds, proteins, or both, we may instead use single compounds alone.
if (keras::is_keras_available() & reticulate::py_available()) {
validation_split <- 0.3
idx <- sample(seq_len(length(example_chem[,1])))
train_idx <- seq_len(length(example_chem[,1])) %in%
idx[seq_len(round(length(example_chem[,1]) * (1 - validation_split)))]
compound_length_seq <- 50
compound_embedding_dim <- 16
gcn_chem <- fit_cpi(
smiles = example_chem[train_idx, 1],
outcome = example_chem[train_idx, 2],
compound_type = "sequence",
compound_length_seq = compound_length_seq,
compound_embedding_dim = compound_embedding_dim,
smiles_val = example_chem[!train_idx, 1],
outcome_val = example_chem[!train_idx, 2],
net_args = list(
compound = "mlp_in_out",
compound_args = list(
fc_units = c(5),
fc_activation = c("relu")),
fc_units = c(1),
fc_activation = c("sigmoid"),
loss='binary_crossentropy',
optimizer = keras::optimizer_adam(),
metrics = "accuracy"),
epochs = 20, batch_size = 16,
callbacks = keras::callback_early_stopping(
monitor = "val_accuracy",
patience = 10,
restore_best_weights = TRUE))
ttgsea::plot_model(gcn_chem$model)
pred <- predict_cpi(gcn_chem, smiles = example_chem[!train_idx, 1])
pred_calss <- ifelse(pred$values > 0.5, 1, 0)
table(pred_calss, smiles = example_chem[!train_idx,2])
}
## checking sequences...
## preprocessing for compounds...
## fitting model...
## Epoch 1/20
## 9/9 - 1s - loss: 0.6934 - accuracy: 0.4786 - val_loss: 0.6891 - val_accuracy: 0.8167 - 808ms/epoch - 90ms/step
## Epoch 2/20
## 9/9 - 0s - loss: 0.6897 - accuracy: 0.7143 - val_loss: 0.6867 - val_accuracy: 0.8000 - 54ms/epoch - 6ms/step
## Epoch 3/20
## 9/9 - 0s - loss: 0.6860 - accuracy: 0.6786 - val_loss: 0.6866 - val_accuracy: 0.7000 - 51ms/epoch - 6ms/step
## Epoch 4/20
## 9/9 - 0s - loss: 0.6796 - accuracy: 0.7071 - val_loss: 0.6836 - val_accuracy: 0.7333 - 51ms/epoch - 6ms/step
## Epoch 5/20
## 9/9 - 0s - loss: 0.6739 - accuracy: 0.7286 - val_loss: 0.6810 - val_accuracy: 0.7500 - 50ms/epoch - 6ms/step
## Epoch 6/20
## 9/9 - 0s - loss: 0.6667 - accuracy: 0.7214 - val_loss: 0.6793 - val_accuracy: 0.7500 - 51ms/epoch - 6ms/step
## Epoch 7/20
## 9/9 - 0s - loss: 0.6591 - accuracy: 0.7214 - val_loss: 0.6781 - val_accuracy: 0.7333 - 51ms/epoch - 6ms/step
## Epoch 8/20
## 9/9 - 0s - loss: 0.6517 - accuracy: 0.7429 - val_loss: 0.6787 - val_accuracy: 0.7000 - 50ms/epoch - 6ms/step
## Epoch 9/20
## 9/9 - 0s - loss: 0.6462 - accuracy: 0.7286 - val_loss: 0.6742 - val_accuracy: 0.7500 - 49ms/epoch - 5ms/step
## Epoch 10/20
## 9/9 - 0s - loss: 0.6411 - accuracy: 0.7500 - val_loss: 0.6637 - val_accuracy: 0.7833 - 52ms/epoch - 6ms/step
## Epoch 11/20
## 9/9 - 0s - loss: 0.6312 - accuracy: 0.7643 - val_loss: 0.6763 - val_accuracy: 0.7333 - 56ms/epoch - 6ms/step
## checking sequences...
## preprocessing for compounds...
## predicting model...
## 2/2 - 0s - 58ms/epoch - 29ms/step
## smiles
## pred_calss 0 1
## 0 6 3
## 1 8 43
In a similar way, we can use single proteins, too. Our model can be extended to multiclass problems.
if (keras::is_keras_available() & reticulate::py_available()) {
example_prot <- example_prot[1:500,]
example_prot[,2] <- as.numeric(factor(example_prot[,2])) - 1
validation_split <- 0.3
idx <- sample(seq_len(length(example_prot[,1])))
train_idx <- seq_len(length(example_prot[,1])) %in%
idx[seq_len(round(length(example_prot[,1]) * (1 - validation_split)))]
protein_embedding_dim <- 16
protein_length_seq <- 100
rnn_prot <- fit_cpi(
AAseq = example_prot[train_idx, 1],
outcome = to_categorical(example_prot[train_idx, 2]),
protein_length_seq = protein_length_seq,
protein_embedding_dim = protein_embedding_dim,
AAseq_val = example_prot[!train_idx, 1],
outcome_val = to_categorical(example_prot[!train_idx, 2]),
net_args = list(
protein = "rnn_in_out",
protein_args = list(
rnn_type = c("gru"),
rnn_bidirectional = c(TRUE),
rnn_units = c(50),
rnn_activation = c("relu"),
fc_units = c(10),
fc_activation = c("relu")),
fc_units = c(3),
fc_activation = c("softmax"),
loss = 'categorical_crossentropy',
optimizer = keras::optimizer_adam(clipvalue = 0.5),
metrics = "accuracy"),
epochs = 20, batch_size = 64,
callbacks = keras::callback_early_stopping(
monitor = "val_accuracy",
patience = 10,
restore_best_weights = TRUE))
ttgsea::plot_model(rnn_prot$model)
val_index <- seq_len(length(example_prot[,2]))[!train_idx]
if (!is.null(rnn_prot$preprocessing$removed_AAseq_val)) {
pred <- predict_cpi(rnn_prot,
AAseq = example_prot[val_index[-rnn_prot$preprocessing$removed_AAseq_val[[1]]], 1])
pred_calss <- apply(pred$values, 1, which.max) - 1
table(pred_calss, example_prot[val_index[-rnn_prot$preprocessing$removed_AAseq_val[[1]]], 2])
} else {
pred <- predict_cpi(rnn_prot, AAseq = example_prot[!train_idx, 1])
pred_calss <- apply(pred$values, 1, which.max) - 1
table(pred_calss, example_prot[!train_idx, 2])
}
}
## checking sequences...
## at least one of protein sequences may not be valid
## preprocessing for proteins...
## fitting model...
## Epoch 1/20
## 6/6 - 5s - loss: 1.0957 - accuracy: 0.3324 - val_loss: 1.0908 - val_accuracy: 0.4267 - 5s/epoch - 769ms/step
## Epoch 2/20
## 6/6 - 0s - loss: 1.0862 - accuracy: 0.4900 - val_loss: 1.0843 - val_accuracy: 0.4267 - 497ms/epoch - 83ms/step
## Epoch 3/20
## 6/6 - 1s - loss: 1.0770 - accuracy: 0.4900 - val_loss: 1.0766 - val_accuracy: 0.4267 - 560ms/epoch - 93ms/step
## Epoch 4/20
## 6/6 - 1s - loss: 1.0668 - accuracy: 0.4900 - val_loss: 1.0701 - val_accuracy: 0.4267 - 671ms/epoch - 112ms/step
## Epoch 5/20
## 6/6 - 1s - loss: 1.0556 - accuracy: 0.4900 - val_loss: 1.0684 - val_accuracy: 0.4267 - 539ms/epoch - 90ms/step
## Epoch 6/20
## 6/6 - 1s - loss: 1.0489 - accuracy: 0.4900 - val_loss: 1.0706 - val_accuracy: 0.4267 - 596ms/epoch - 99ms/step
## Epoch 7/20
## 6/6 - 1s - loss: 1.0439 - accuracy: 0.4900 - val_loss: 1.0717 - val_accuracy: 0.4267 - 629ms/epoch - 105ms/step
## Epoch 8/20
## 6/6 - 1s - loss: 1.0390 - accuracy: 0.4900 - val_loss: 1.0718 - val_accuracy: 0.4267 - 510ms/epoch - 85ms/step
## Epoch 9/20
## 6/6 - 1s - loss: 1.0370 - accuracy: 0.4900 - val_loss: 1.0727 - val_accuracy: 0.4267 - 573ms/epoch - 95ms/step
## Epoch 10/20
## 6/6 - 1s - loss: 1.0323 - accuracy: 0.4900 - val_loss: 1.0734 - val_accuracy: 0.4267 - 557ms/epoch - 93ms/step
## Epoch 11/20
## 6/6 - 1s - loss: 1.0284 - accuracy: 0.4900 - val_loss: 1.0712 - val_accuracy: 0.4267 - 605ms/epoch - 101ms/step
## checking sequences...
## preprocessing for proteins...
## predicting model...
## 5/5 - 0s - 439ms/epoch - 88ms/step
##
## pred_calss 0 1 2
## 0 64 51 35
The process of developing drugs is extensive, laborious, expensive, and time consuming. Drug repurposing, also referred to as repositioning, significantly reduces the cost, risk, and time compared to traditional drug development strategies, by recycling already established drugs. In the drug discovery process, it is required to determine the cause of a disease and, thus, a potential biological target. A target can be any biological entity from RNA to a protein to a gene that is ‘druggable’ or accessible to binding with a drug-like compound. Drug interactions with a biological target change the shape or confirmation of some facet of the target when bound to a small molecule and alter the target’s ability to function. This conformational change ideally triggers a desired biological response involved in the particular disease process. Here, deep learning models can be used to identify the candidate drugs for selected targets and disease.
Suppose that we want to identify which existing antiviral drugs can be repurposed to target the SARS coronavirus 3C-like Protease. For training the deep learning model, we use the data from past bioassay data such as high throughput screening (HTS) assay on SARS-CoV 3CL Protease, which conserves large portion of the gene with SARS-CoV-2. For repurposing for COVID-19, the deep learning model is trained using this data to rank drug candidates from the antiviral library.
if (keras::is_keras_available() & reticulate::py_available()) {
compound_length_seq <- 50
protein_length_seq <- 500
compound_embedding_dim <- 16
protein_embedding_dim <- 16
mlp_mlp <- fit_cpi(
smiles = example_bioassay[,1],
AAseq = example_bioassay[,2],
outcome = example_bioassay[,3],
compound_type = "sequence",
compound_length_seq = compound_length_seq,
protein_length_seq = protein_length_seq,
compound_embedding_dim = compound_embedding_dim,
protein_embedding_dim = protein_embedding_dim,
net_args = list(
compound = "mlp_in_out",
compound_args = list(
fc_units = c(10, 5),
fc_activation = c("relu", "relu")),
protein = "mlp_in_out",
protein_args = list(
fc_units = c(10, 5),
fc_activation = c("relu", "relu")),
fc_units = c(1),
fc_activation = c("sigmoid"),
loss = 'binary_crossentropy',
optimizer = keras::optimizer_adam(),
metrics = "accuracy"),
epochs = 20, batch_size = 64,
validation_split = 0.3,
verbose = 0,
callbacks = keras::callback_early_stopping(
monitor = "val_accuracy",
patience = 5,
restore_best_weights = TRUE))
ttgsea::plot_model(mlp_mlp$model)
pred <- predict_cpi(mlp_mlp,
antiviral_drug[,2],
rep(SARS_CoV2_3CL_Protease, nrow(antiviral_drug)))
Result <- data.frame(antiviral_drug[,1], pred$values)
colnames(Result) <- c("drug", "probability")
Result[order(Result[,2], decreasing = TRUE),]
}
## checking sequences...
## preprocessing for compounds...
## preprocessing for proteins...
## fitting model...
## checking sequences...
## preprocessing for compounds...
## preprocessing for proteins...
## predicting model...
## 3/3 - 0s - 100ms/epoch - 33ms/step
## drug probability
## 9 Bictegravir 0.99740696
## 71 Tipranavir 0.99556541
## 41 Lopinavir 0.98893315
## 8 Baloxavir 0.98691952
## 40 Letermovir 0.98452216
## 14 Cobicistat 0.95245445
## 29 Etravirine 0.93615067
## 68 Telaprevir 0.92924941
## 59 Remdesivir 0.91388273
## 27 Enfuvirtide 0.87986767
## 65 Sofosbuvir 0.83773410
## 56 Grazoprevir 0.83091688
## 23 Doravirine 0.81694269
## 76 Vicriviroc 0.81141692
## 42 Loviride 0.78692013
## 55 Glecaprevir 0.76650900
## 37 Imunovir 0.73273367
## 38 Indinavir 0.70506120
## 64 Simeprevir 0.64076406
## 26 Elvitegravir 0.63277739
## 58 Raltegravir 0.63156086
## 22 Dolutegravir 0.62680399
## 1 Abacavir 0.55891716
## 39 Inosine 0.55544651
## 78 Taribavirin 0.51780856
## 70 Tenofovir_disoproxil 0.46521276
## 63 Saquinavir 0.42654678
## 36 Imiquimod 0.40710220
## 49 Ritonavir 0.35859206
## 46 Nelfinavir 0.35261244
## 6 Arbidol 0.31911048
## 25 Efavirenz 0.31060722
## 73 Tromantadine 0.30401316
## 15 Lamivudine 0.27564335
## 32 Foscarnet 0.23629767
## 47 Nevirapine 0.23236150
## 24 Edoxudine 0.19921969
## 21 Docosanol 0.15960892
## 28 Entecavir 0.15601046
## 69 Telbivudine 0.15166253
## 3 Adefovir 0.14760290
## 10 Emtricitabine 0.14319965
## 53 Pleconaril 0.14177909
## 35 Idoxuridine 0.14067255
## 2 Aciclovir 0.13553269
## 67 Chloroquine 0.13002716
## 12 Boceprevir 0.12720260
## 77 Vidarabine 0.12502936
## 11 Tenofovir 0.11260313
## 34 Ibacitabine 0.11205114
## 5 Amprenavir 0.11114811
## 16 Zidovudine 0.11081584
## 20 Didanosine 0.10645770
## 31 Fosamprenavir 0.10351844
## 72 Trifluridine 0.10156579
## 57 Pyrimidine 0.09420659
## 51 Penciclovir 0.09352725
## 52 Peramivir 0.09237073
## 60 Ribavirin 0.08954648
## 13 Cidofovir 0.08114246
## 81 Hydroxychloroquine 0.06994630
## 17 Daclatasvir 0.06820381
## 4 Amantadine 0.06501735
## 7 Atazanavir 0.06419398
## 30 Famciclovir 0.06295136
## 33 Ganciclovir 0.05861115
## 19 Delavirdine 0.05683278
## 43 Maraviroc 0.05491970
## 61 Rilpivirine 0.05489670
## 50 Oseltamivir 0.05376651
## 44 Methisazone 0.05249092
## 79 Zalcitabine 0.05032786
## 18 Darunavir 0.04741320
## 66 Stavudine 0.04508394
## 74 Valacyclovir 0.03619768
## 62 Rimantadine 0.02600469
## 45 Moroxydine 0.02426583
## 48 Nitazoxanide 0.02362758
## 80 Zanamivir 0.02255993
## 75 Valganciclovir 0.02114677
## 54 Podophyllotoxin 0.01906686
## R version 4.3.1 (2023-06-16)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.3 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.18-bioc/R/lib/libRblas.so
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_GB LC_COLLATE=C
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8
## [9] LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8
##
## time zone: America/New_York
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] DeepPINCS_1.10.0 keras_2.13.0
##
## loaded via a namespace (and not attached):
## [1] stringdist_0.9.10 xfun_0.40 bslib_0.5.1
## [4] visNetwork_2.1.2 htmlwidgets_1.6.2 rJava_1.0-6
## [7] lattice_0.22-5 vctrs_0.6.4 tools_4.3.1
## [10] tfruns_1.5.1 generics_0.1.3 parallel_4.3.1
## [13] tibble_3.2.1 fansi_1.0.5 sylly.en_0.1-3
## [16] pkgconfig_2.0.3 tokenizers_0.3.0 Matrix_1.6-1.1
## [19] data.table_1.14.8 RColorBrewer_1.1-3 lifecycle_1.0.3
## [22] compiler_4.3.1 stringr_1.5.0 CatEncoders_0.1.1
## [25] RhpcBLASctl_0.23-42 data.tree_1.0.0 PRROC_1.3.1
## [28] SnowballC_0.7.1 htmltools_0.5.6.1 sass_0.4.7
## [31] fingerprint_3.5.7 yaml_2.3.7 pillar_1.9.0
## [34] crayon_1.5.2 jquerylib_0.1.4 whisker_0.4.1
## [37] ellipsis_0.3.2 cachem_1.0.8 koRpus.lang.en_0.1-4
## [40] iterators_1.0.14 koRpus_0.13-8 text2vec_0.6.3
## [43] rsparse_0.5.1 textstem_0.1.4 stopwords_2.3
## [46] tidyselect_1.2.0 rvest_1.0.3 digest_0.6.33
## [49] stringi_1.7.12 slam_0.1-50 dplyr_1.1.3
## [52] purrr_1.0.2 fastmap_1.1.1 grid_4.3.1
## [55] cli_3.6.1 DiagrammeR_1.0.10 magrittr_2.0.3
## [58] base64enc_0.1-3 utf8_1.2.4 matlab_1.0.4
## [61] float_0.3-1 sylly_0.1-6 rmarkdown_2.25
## [64] httr_1.4.7 reticulate_1.34.0 mlapi_0.1.1
## [67] rcdklibs_2.8 png_0.1-8 NLP_0.2-1
## [70] ttgsea_1.10.0 evaluate_0.22 knitr_1.44
## [73] tm_0.7-11 itertools_0.1-3 rlang_1.1.1
## [76] Rcpp_1.0.11 zeallot_0.1.0 glue_1.6.2
## [79] xml2_1.3.5 rcdk_3.8.1 rstudioapi_0.15.0
## [82] webchem_1.3.0 jsonlite_1.8.7 lgr_0.4.4
## [85] R6_2.5.1 tensorflow_2.14.0
Balakin, K. V. (2009). Pharmaceutical data mining: approaches and applications for drug discovery. John Wiley & Sons.
Huang, K., Fu, T., Glass, L. M., Zitnik, M., Xiao, C., & Sun, J. (2020). DeepPurpose: A Deep Learning Library for Drug-Target Interaction Prediction. Bioinformatics.
Kipf, T. N., & Welling, M. (2016). Semi-supervised classification with graph convolutional networks. ICLR.
Nguyen, T., Le, H., & Venkatesh, S. (2020). GraphDTA: prediction of drug-target binding affinity using graph convolutional networks. Bioinformatics.
O’Donnell, J. J., Somberg, J., Idemyor, V., & O’Donnell, J. T. (Eds.). (2019). Drug Discovery and Development. CRC Press.
Pedrycz, W., & Chen, S. M. (Eds.). (2020). Deep Learning: Concepts and Architectures. Springer.
Srinivasa, K. G., Siddesh, G. M., & Manisekhar, S. R. (Eds.). (2020). Statistical Modelling and Machine Learning Principles for Bioinformatics Techniques, Tools, and Applications. Springer.
Trabocchi, A. & Lenci, E. (2020). Small molecule drug discovery: methods, molecules and applications. Elsevier.
Tsubaki, M., Tomii, K., & Sese, J. (2019). Compound-protein interaction prediction with end-to-end learning of neural networks for graphs and sequences. Bioinformatics.
Van der Loo, M., & De Jonge, E. (2018). Statistical data cleaning with applications in R. John Wiley & Sons.
Vogel, H. G., Maas, J., & Gebauer, A. (Eds.). (2010). Drug discovery and evaluation: methods in clinical pharmacology. Springer.
Wang, L., Wang, H. F., Liu, S. R., Yan, X., & Song, K. J. (2019). Predicting protein-protein interactions from matrix-based protein sequence using convolution neural network and feature-selective rotation forest. Scientific reports.