Skip to main content
TSR Research Group

Deep Neural Network

Classifies structures from their TSR key frequencies using a feed-forward network, reporting accuracy, loss and a confusion matrix.

Overview

This tool treats TSR key frequencies as a feature vector and trains a feed-forward neural network to classify structures from them.

It runs in two steps: build the feature table from triplet files, then train on it.

BioTSR and this model

BioTSR can compute the keys and write a key-frequency table from Python: biotsr.analysis.feature_matrix(samples).to_header_csv() gives a sample_id column followed by one column per key, as in tutorial 08, §3. That table is not the one this model reads: key_frequency_drug.py writes different columns, including the residue_type class column the model trains on, and the two have not been tested together. To reproduce the published model, use the research scripts as described below.

Installation

bash
git clone https://github.com/KrishnaRauniyar/Nucleotide_Analysis.git
cd Nucleotide_Analysis/dnn

Create a virtual environment and install the dependencies:

bash
python3 -m venv tsrenv
source tsrenv/bin/activate   # macOS / Linux
tsrenv\Scripts\activate      # Windows

pip install -r requirements.txt

Step 1 — build the feature table

bash
python key_frequency_drug.py -p triplets_directory -H yes
OptionDescription
-pDirectory containing the triplet files.
-HWhether to write a header row. Use yes here.

The result is one row per structure, one column per key:

Proteinkey1key2key3
4NGF_H_15_U400
5VM9_D_3_A159

Each cell is how often that triplet key occurs in that structure.

Step 2 — train the model

bash
python drug_model.py -p input_csv_file

Architecture

Five hidden layers, each ReLU, narrowing 128 → 64 → 32 → 16 → 8, with L2 regularisation on all but the first. The output is a softmax layer.

LayerUnitsActivationNotes
Hidden 1128ReLUInput dimension is the number of key columns
Hidden 264ReLUL2 regularisation
Hidden 332ReLUL2 regularisation
Hidden 416ReLUL2 regularisation
Hidden 58ReLUL2 regularisation
Outputone per classsoftmaxSized from the data, not fixed

Categorical columns are label-encoded and features are standardised before training. The model uses the Adam optimiser with sparse categorical cross-entropy, trains for up to 50 epochs at batch size 32 against a held-out split, and stops early when validation stops improving.

Output

Three image files:

FileContents
accuracy_plot.pngTraining and validation accuracy per epoch
loss_plot.pngTraining and validation loss per epoch
confusion_matrix.pngConfusion matrix for the held-out data

Source code