SPgo

September 20, 2025 ยท View on GitHub

De novo design of Sec-type signal peptides

SPgo: Signal Peptide Generator with Rule-based and BERT-LSTM Design

SPgo is a hybrid signal peptide generation model that combines biological prior knowledge with deep learning. Specifically, it generates the N-region and C-region using rule-based templates, while the hydrophobic H-region is generated using a BERT-embedded bi-directional LSTM decoder. This design ensures both biological interpretability and modeling flexibility.

๐Ÿ”ง Features

  • Specialized for signal peptide synthesis
  • Rule-based generation for N-region and C-region to enforce biological constraints
  • Context-aware H-region generation using BERT + BiLSTM
  • Mixed-precision training support
  • Top-k and Top-p sampling strategies for controlled decoding
  • Input/output compatible with standard FASTA format
  • Supports downstream evaluation with SignalP6

๐Ÿš€ Quick Start

1. Install requirements

pip install -r requirements.txt

2. Train the model

Place your signal peptide FASTA-formatted data under data/, then run:

python model/training.py

3. Generate new signal peptides

After training or using pretrained checkpoints:

python model/Sequence_generation.py

4. Predict signal peptide functionality (optional)

SPgo supports functional validation using SignalP6. To do this:

  1. Concatenate generated signal peptides with your target protein sequences.
  2. Format as FASTA and save to file.
  3. Submit the file to a local or web-based instance of SignalP6 (must be installed or accessed separately).

Note: SignalP6 is not included in this repository. Users must download or access it independently.

โš™๏ธ How It Works

SPgo divides a signal peptide into three biologically defined regions:

  • N-region: Generated by handcrafted rules (typically positively charged)
  • H-region: Learned using a BERT-embedded BiLSTM model (typically hydrophobic core)
  • C-region: Generated by handcrafted rules (contains cleavage site motifs)

This hybrid strategy allows SPgo to retain known biological patterns while learning complex internal features from data. After sequence generation, the complete signal peptide is prepended to a user-defined protein sequence, forming the full construct for SignalP6-based validation.

๐Ÿ“ Input Format

Provide training sequences in standard FASTA format:

>seq1
MKTAYIAKQRQISFVKSHFSRQ...
>seq2
GPHMIVNIEKPQLLLKTLQVL...

๐Ÿ“‚ Project Structure

SPgo/
โ”œโ”€โ”€ model/
โ”‚   โ”œโ”€โ”€ training.py               # Model definition and training script
โ”‚   โ””โ”€โ”€ Sequence_generation.py    # Sequence generation script
โ”œโ”€โ”€ data/                         # Input FASTA files
โ”œโ”€โ”€ checkpoints/                  # Trained model weights (The checkpoint file can be downloaded at https://drive.google.com/file/d/1ElvvCBtIcbXLl4MakJ6_VIGdzHD1nV6W)
โ”œโ”€โ”€ requirements.txt              # Required Python packages
โ””โ”€โ”€ README.md

๐Ÿงฌ Example Output

The generated sequences will follow signal peptide structure and be saved in FASTA format:

>generated_signal_peptide_1
MRRLLALALALALAAQAFA...

๐Ÿ“š References