NanoSSL: Attention-based Self-Supervised Learning for Protein Variant Identification with Solid-State Nanopores
NanoSSL is a self-supervised learning framework for nanopore-based protein signal analysis. It is designed to learn robust representations from noisy single-molecule current traces and improve downstream protein identification when labeled data are limited.
This repository accompanies the following paper:
NanoSSL: attention mechanism-based self-supervised learning method for protein variant identification using solid-state nanopores
Bioinformatics, Volume 42, Issue 1, January 2026
- Paper: https://academic.oup.com/bioinformatics/article/42/1/btaf657/8371887
- DOI: https://doi.org/10.1093/bioinformatics/btaf657
- Code: https://github.com/YongXie66/NanoSSL
Protein signals measured by nanopores are often noisy, variable, and expensive to annotate. NanoSSL addresses this challenge with a two-stage learning pipeline that combines self-supervised pretraining and supervised fine-tuning.
- Self-supervised pretraining for low-label settings
- Attention-based sequence modeling with a Transformer encoder
- Designed for nanopore protein current traces, including solid-state nanopore measurements
- Evaluated on public ONT data and amyloid-beta variant identification tasks
According to the paper, NanoSSL achieved strong performance on public nanopore benchmarks:
0.951 +- 0.001accuracy for barcode recognition0.982 +- 0.001accuracy for binary protein identification
The paper also reports that NanoSSL achieves state-of-the-art performance for amyloid-beta variant identification on solid-state nanopore data, especially on challenging mutant discrimination tasks such as E22G and G37R.
NanoSSL follows a two-stage training strategy:
Each nanopore signal is divided into non-overlapping local fragments. A subset of fragments is masked, and the model learns to predict masked representations from visible context.
After pretraining, the encoder is fine-tuned for downstream classification, enabling better performance with limited labeled data.
- Fragment-based tokenization via
wave_length - Transformer encoder for contextual representation learning
- Masked self-supervised objective controlled by
mask_ratio - Momentum-style target encoder for stable representation learning
- Classification head for downstream prediction
NanoSSL/
├── dataset/
│ └── ont/ # Example ONT dataset (.pt files)
├── model/
│ ├── NANOSSL.py # Main NanoSSL model
│ └── layers.py # Transformer and related layers
├── utils/
│ ├── args.py # Argument parsing and dataset dispatch
│ ├── dataset.py # Dataset wrapper
│ ├── datautils.py # Data loading utilities
│ └── util.py # Training and evaluation helpers
├── train.py # Main training entry
├── trainer.py # Pretraining and fine-tuning pipeline
├── train.sh # Example training script
├── requirements.txt
└── README.md
Clone the repository:
git clone https://github.com/YongXie66/NanoSSL.git
cd NanoSSLCreate a Python environment and install dependencies:
conda create -n nanossl python=3.10
conda activate nanossl
pip install -r requirements.txtpython train.py \
--dataset ont \
--data_path dataset/ont/ \
--save_path exp/ONT/test \
--device cuda:0Or use the provided shell script:
bash train.shpython train.py \
--dataset amyloid \
--data_path data/amyloid/ \
--mutation E22G \
--save_path exp/amyloid/E22G \
--device cuda:0The repository includes an example ONT dataset under:
dataset/ont/train.pt
dataset/ont/val.pt
dataset/ont/test.pt
For amyloid-beta experiments, the code expects MATLAB files named in the following style:
data/amyloid/
├── Native_BetaAmyloid.mat
├── E22G_BetaAmyloid.mat
├── G37R_BetaAmyloid.mat
└── ...
train.pyruns the full pipeline: pretraining first, then fine-tuning.- The actual data loader is selected by
--data_path. - Main outputs are saved to
--save_path, including configuration, checkpoints, and result summaries. - The default settings are oriented toward GPU training.
If you find this repository useful, please cite:
@article{xie2026nanossl,
author = {Xie, Yong and Li, Jindong and Zhang, Ziyan and Meng, Bin and Dai, Shuaijian and Zhou, Yuchen and Kennedy, Eamonn and Jiao, Niandong and Chen, Haobin and Dong, Zhuxin},
title = {NanoSSL: attention mechanism-based self-supervised learning method for protein variant identification using solid-state nanopores},
journal = {Bioinformatics},
volume = {42},
number = {1},
pages = {btaf657},
year = {2026},
doi = {10.1093/bioinformatics/btaf657}
}If NanoSSL is helpful for your work, please consider starring the repository and citing the paper.