CNNAMON is a modular Python framework for building, training, and interpreting 1D Convolutional Neural Networks (CNNs) for DNA sequence analysis. It integrates data preparation, model construction, and rich explainability tools in a unified and flexible system tailored for genomics research.
Project description
CNNAMON: Convolutional Neural Network Analysis & Motif Discovery
A modular, interpretability-first framework for deep learning in genomics.
CNNAMON is a Python framework designed to bridge the gap between training high-performance 1D Convolutional Neural Networks (CNNs) on DNA sequences and understanding what they actually learn.
It provides an end-to-end ecosystem for:
- Dataset Preparation: Converting genomic intervals (BED3+1-labels) to One-Hot Tensors.
- Modeling: Building complex Keras models via simple JSON config file.
- Explainability: Extracting learned motifs, clustering filters based on activation profile, assesing the filter importance and associating filters to prediction classes.
⚡️ Key Features
| Module | Functionality |
|---|---|
| 🧬 PrepareData | Extraction of sequences from FASTA/BED files. Supports Random, Chromosome, or Custom splits and reverse complement augmentation. |
| 🏗 KerasBuilder | Define model architecture, optimizers, and callbacks in JSON. Ensures reproducibility and sharing of experiments. |
| 🎨 FilterVisualize | Extract learned motifs using Top-Activating, Consensus, or Significant (permutation-based) strategies. Export to MEME for TOMTOM validation. |
| 📉 FilterImportance | Rank filters by their contribution to model loss using perturbation analysis. |
| 🌳 FilterClustering | Group redundant or co-activated filters with hierarchical clustering and visualize relationships with circular dendrograms. |
| 🧪 Enrichment | Identify filters that are statistically enriched for the prediction classes (e.g., Enhancer vs. Silencer). |
📦 Installation
We recommend installing CNNAMON in a fresh environment to manage dependencies (TensorFlow, BedTools).
(Recommended)
1. Create environment
conda create -n cnnamon_env python=3.10 conda activate cnnamon_env
2. Install library
pip install cnnamon
3. Install BedTools (Required for sequence extraction)
conda install -c bioconda bedtools
🚀 Quick Start
Train a model and visualize motifs in 4 steps.
import cnnamon as cn
# 1. Prepare Data
preparer = cn.utility.PrepareData(
intervalfile="peaks.bed",
genomefasta="hg38.fa",
outdir="data/",
split_segmentation="random"
)
train, test, val = preparer.run()
# 2. Train Model (from JSON config)
model = cn.utility.KerasModelBuilder.from_json("model_config.json")
model.train(train['x'], train['y'], val['x'], val['y'])
# 3. Extract & Visualize Motifs
# Extract the signifficant motifs
motifs = cn.CNN1D.FilterVisualize.significant_activating(model,
data=test,
n_perturbations=1000,
q_value_cutoff=0.05,
n_cores=10)
# 4. Plot Sequence Logos
motifs.to_motifs(savefig="learned_motifs.png")
📖 Documentation
Full documentation is available here:
CNNAMON Documentation
📚 Citation
If you use CNNAMON in your research, please cite:
Built by the Georgakilas Lab.
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 cnnamon-0.2.0.tar.gz.
File metadata
- Download URL: cnnamon-0.2.0.tar.gz
- Upload date:
- Size: 27.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4e0b4b8cbe3cca217f41b50c097db6ed1de80fe4adbd2dea727abab3395d028
|
|
| MD5 |
a9b08e649b9f194df7d2916240280e30
|
|
| BLAKE2b-256 |
465c306f42adf7861eaac364fe3a5e0be3a7e9f5f7c77ce8ec06bb0dcc4b45a7
|
Provenance
The following attestation bundles were made for cnnamon-0.2.0.tar.gz:
Publisher:
release.yml on GeorgakilasLab/CNNAMON
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cnnamon-0.2.0.tar.gz -
Subject digest:
c4e0b4b8cbe3cca217f41b50c097db6ed1de80fe4adbd2dea727abab3395d028 - Sigstore transparency entry: 937057495
- Sigstore integration time:
-
Permalink:
GeorgakilasLab/CNNAMON@cc74d7537948ca953e965018edea186e53e897d8 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/GeorgakilasLab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cc74d7537948ca953e965018edea186e53e897d8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cnnamon-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cnnamon-0.2.0-py3-none-any.whl
- Upload date:
- Size: 28.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a701d3a0716054ce56638b7f37ac5754ec322e56cf167c885f1c3f298e083e9c
|
|
| MD5 |
404821240f08785d0ea41e736d6c80c3
|
|
| BLAKE2b-256 |
19b938dcb0004b3682559300ab7eedf555ff761b5952d586c9e53d2b42b7c4ab
|
Provenance
The following attestation bundles were made for cnnamon-0.2.0-py3-none-any.whl:
Publisher:
release.yml on GeorgakilasLab/CNNAMON
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cnnamon-0.2.0-py3-none-any.whl -
Subject digest:
a701d3a0716054ce56638b7f37ac5754ec322e56cf167c885f1c3f298e083e9c - Sigstore transparency entry: 937057499
- Sigstore integration time:
-
Permalink:
GeorgakilasLab/CNNAMON@cc74d7537948ca953e965018edea186e53e897d8 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/GeorgakilasLab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cc74d7537948ca953e965018edea186e53e897d8 -
Trigger Event:
release
-
Statement type: