Skip to content

Repository files navigation

Binding Affinity Prediction

Architecture

I follow a variant of the architecure in MHCAttnNet.

The best model follows the following architecture:(mhcAttentionAdd)

  1. MHC and peptide sequences are each embedded into 256 dimensional vectors.
  2. Each embedded sequences are fed into 2 bidirectional LSTM layers with 128 units each.
  3. Now the following 3 sequences are passed into attention layers:
    1. The MHC LSTM output
    2. The peptide LSTM output
    3. The sum of MHC and peptide LSTM outputs
  4. The attention outputs are each passed through fully connected layers with 64 units.
  5. The outputs of the fully connected layers are concatenated and passed through a sequence of fully connected layers to get the final output.

Here is a diagram of the model:

mhcAttentionAdd

Other models I tried are:

  1. (mhcAttentionConcat) Concatenating the LSTM outputs instead of adding them.
  2. (mhcAttentionCombined) Only the concatenated LSTM outputs are passed through the attention layer.
  3. (mhcAttentionSimple) Only the LSTM outputs are passed through the attention layer.
  4. (mhcNoAttention) No attention layer is used. The LSTM outputs are passed through global average pooling and then through fully connected layers.

Results

The best model is mhcAttentionAdd. The results are as follows:(On test set with 15% ratio)

Model Loss Accuracy Precision Recall F1 Score AUC
mhcAttentionAdd 0.1392 94.91 88.87 85.48 87.15 97.85
mhcNoAttention 0.1531 94.25 86.74 84.39 85.54 97.47
mhcAttentionSimple 0.1442 94.65 87.75 85.36 86.54 97.73
mhcAttentionConcat 0.1422 94.78 90.25 83.09 86.52 97.81

Preprocess

python Preprocess.py -f [CSV path] -v [validation ratio] -t [test ratio] -tp [train path] -vp [validation path] -tep [test path]

This splits the data into train, validation and test sets. The default validation and test ration is 15%.

Train

python main.py --train [train path] --val [validation path] -e [epochs] -b [batch size] -lr [learning rate] -l [loss function] -ed [embedding dimension] -ru [RNN units] -s [sequence length] -v [vocab size] -fci [inner FC units] -fco [outer FC units] -cd [context dim] -m [model name]

First run preprocesing to generate train, val, test splits.

Test

python main.py --test [test path] -b [batch size] -m [model name] -e [epochs] -b [batch size] -lr [learning rate] -l [loss function] -ed [embedding dimension] -ru [RNN units] -s [sequence length] -v [vocab size] -fci [inner FC units] -fco [outer FC units] -cd [context dim] -m [model name]

Training Plots

Loss Accuracy
Loss Accuracy
Precision Recall
Precision Recall
AUC
AUC

About

This repository contains code for predicting binding affinity between MHC and peptide sequences. The code uses a variant of the architecture in MHCAttnNet and includes several models to compare performance. The best model is mhcAttentionAdd, which uses attention layers to process the MHC and peptide sequences.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages