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:
- Concatenate generated signal peptides with your target protein sequences.
- Format as FASTA and save to file.
- 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
- Devlin et al., BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. arXiv:1810.04805
- Nielsen, H., et al. SignalP: Signal peptide prediction using neural networks. Protein Engineering (1997).
- Teufel et al., SignalP 6.0 predicts all five types of signal peptides using protein language models. Nature Biotechnology (2022).
- For a video of SPgo in action, see https://drive.google.com/file/d/1iWw7QOF2OZsCTW5z7DuvZxUGYm-hJgp7/view?usp=sharing
- This tool is now published in the paper https://pubs.acs.org/doi/10.1021/jacsau.5c00757