Deep learning toolkit for m6A site prediction (CNN + lightweight Transformer).
Project description
M6AFormer
Deep learning toolkit for transcriptome-wide N6-methyladenosine (m6A) site prediction, built on a hybrid CNN + lightweight Transformer architecture.
Highlights
- One model, multiple variants. Four pretrained checkpoints covering both 201 bp and 801 bp windows, with random and DRACH-filtered negative sampling strategies.
- Three ways to use it. A clean Python API, a
m6aformerCLI, and an optional local web UI, all driven by the same coreM6AFormerclass. - Frozen, audited thresholds. Each checkpoint ships with a decision threshold selected on inner-validation F1 (overridable at predict time).
- Reproducible. MIT licensed, fully open-source; bundled weights are shipped inside the wheel.
Pretrained models
| Name | Architecture | Window | Negatives | Default |
|---|---|---|---|---|
all_801 |
CNN + Transformer | 801 bp | random | yes |
all_201 |
CNN + Transformer | 201 bp | random | |
drach_801 |
CNN + Transformer | 801 bp | DRACH | |
drach_201 |
CNN + Transformer | 201 bp | DRACH |
Each model ships with a frozen decision threshold selected on inner-validation
F1, recorded in its threshold.json. Users can override the threshold at
prediction time.
Installation
# Basic (CPU/GPU inference + CLI)
pip install m6aformer
# With local web UI
pip install "m6aformer[web]"
# Development install (from a clone)
git clone https://github.com/zhixinniu/M6AFormer.git
cd M6AFormer
pip install -e ".[dev,web]"
PyTorch is intentionally pinned only as
torch>=2.0. Install the CUDA-matching wheel from https://pytorch.org/get-started/locally/ first if you want GPU support.
Quickstart
Python
from m6aformer import M6AFormer
model = M6AFormer.from_pretrained("all_801") # default checkpoint
df = model.predict_fasta("genome.fa", motif="DRACH") # scan all DRACH As
# df columns: chrom, position, strand, motif_5mer, prob, label, ...
CLI
# List all bundled pretrained checkpoints
m6aformer list-models
# Score a FASTA file (auto-finds candidate adenosines)
m6aformer predict --input genome.fa --output sites.tsv --model all_801
# Score one or more inline sequences (no file needed)
m6aformer predict --seq ACGT...A...ACGT --strand + --model all_801
Local web UI
The [web] extra installs FastAPI + uvicorn and registers the serve
subcommand. The bundled single-page UI exposes the same prediction
pipeline as the CLI.
pip install "m6aformer[web]"
m6aformer serve # http://127.0.0.1:8000
For remote use over SSH (recommended over --host 0.0.0.0):
# On your laptop, forward the port and keep the server bound to localhost:
ssh -L 8000:localhost:8000 user@server
# Then open http://localhost:8000 in your browser.
Repository layout
M6AFormer/
├── src/m6aformer/ # the pip package (only this ships in the wheel)
├── training/ # training scripts (GitHub only, import m6aformer)
├── data_prep/ # dataset preparation scripts (GitHub only)
├── examples/ # runnable usage examples
├── tests/ # unit + integration tests
├── docs/ # documentation source
See training/README.md for how to retrain from
scratch, and data_prep/README.md for the dataset
construction pipeline.
Citation
If you use M6AFormer in your research, please cite the project. A
machine-readable citation is provided in CITATION.cff.
License
MIT © 2026 Zhixin Niu.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file m6aformer-0.1.2.tar.gz.
File metadata
- Download URL: m6aformer-0.1.2.tar.gz
- Upload date:
- Size: 10.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d886315e75edfed5beeaff9c87916accdf63fc2a348c9bed34664609391cf82
|
|
| MD5 |
718e0d2103205dcecff1ce753d49a1de
|
|
| BLAKE2b-256 |
08dc3c5746fee0c5e931636a79df71cb03843cb2e8780a8bbdc5a65535cfaf3b
|
File details
Details for the file m6aformer-0.1.2-py3-none-any.whl.
File metadata
- Download URL: m6aformer-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b1fe8ad8dd5aa8796459595b044b725163b84a2dae86f118fa9bcb09eeba297
|
|
| MD5 |
3e10e74d31f9c159acc47aa7d80ac162
|
|
| BLAKE2b-256 |
379b64ec276735fd88af149732e6f64bb14f9574cfa40202243debe9efa4ea13
|