Skip to main content

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 Logo

CNNAMON

Convolutional Neural Network Analysis & Motif Discovery

A modular, interpretability-first framework for deep learning in genomics.

PyPI version Python 3.10 License: MIT Documentation


🧠 Overview

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 learn.

It provides an end-to-end ecosystem for:

  1. Dataset Preparation – Converting genomic intervals (BED3 + labels) to one-hot tensors
  2. Modeling – Building complex Keras models via simple JSON configuration files
  3. Explainability – Extracting learned motifs, clustering filters by activation profiles, assessing filter importance, and associating filters with prediction classes

⚡ Key Features

Module Functionality
🧬 PrepareData Extract sequences from FASTA/BED files. Supports random, chromosome, or custom splits, and reverse-complement augmentation.
🏗 KerasBuilder Define model architectures, optimizers, and callbacks using JSON for reproducible 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 using circular dendrograms.
🧪 Enrichment Identify filters statistically enriched for prediction classes (e.g., Enhancer vs. Silencer).

📦 Installation

We recommend installing CNNAMON in a fresh environment to manage dependencies (TensorFlow, BedTools).

# 1. Create environment
conda create -n cnnamon_env python=3.10
conda activate cnnamon_env

# 2. Install CNNAMON
pip install cnnamon

# 3. Install BedTools (required for sequence extraction)
conda install -c bioconda bedtools

🚀 Quick Start

Train a model and visualize motifs in four 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 significant 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:
👉 https://georgakilaslab.github.io/CNNAMON/


📚 Citation

If you use CNNAMON in your research, please cite:

(Add paper reference / DOI here when available)


Built by the Georgakilas Lab.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cnnamon-0.2.1.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cnnamon-0.2.1-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file cnnamon-0.2.1.tar.gz.

File metadata

  • Download URL: cnnamon-0.2.1.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cnnamon-0.2.1.tar.gz
Algorithm Hash digest
SHA256 926a3154692f2273f08f225c316ad89e5454315cc51bd924a0628128b01194c2
MD5 a71b3d7d5dc966e86be985f5889dafb9
BLAKE2b-256 6c7439a297666aa29aa496b8433865fd8a8807c04b238cabb04dcd05cf7e20d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for cnnamon-0.2.1.tar.gz:

Publisher: release.yml on GeorgakilasLab/CNNAMON

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cnnamon-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: cnnamon-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 28.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cnnamon-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7540afb6569039e56aaf61c5275a20f4c970d79ba1262f1b63ff411704945e10
MD5 e5779eb8d45c1b82a9957ba6b44085dc
BLAKE2b-256 6939d7a86950d0479278c876ae9225089a6effe1e6c0e0ff6165ee78163fa0d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for cnnamon-0.2.1-py3-none-any.whl:

Publisher: release.yml on GeorgakilasLab/CNNAMON

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page