Skip to main content

Python library for differential expression data storage and visualization using DuckDB.

Project description

de_quack

Python/R library for differential expression (DE) data management and visualization using DuckDB.

Stores DE analysis results with automatic gene annotation, enabling reproducible and efficient querying of experimental data.

Features

  • Efficient Storage: DuckDB-backed persistence for gene expression results
  • Automatic Annotation: Maps gene symbols and Ensembl IDs with canonical references
  • Flexible Querying: Filter results using simple keyword arguments (e.g., padj__lt=0.05)
  • Multi-language Support: Native Python and R interfaces
  • Visualization: Built-in volcano plot generation with publication-ready styling
  • Data Normalization: Handles variable column names and formats automatically

Installation

pip install de_quack

For Excel export support (optional):

pip install de_quack[excel]

Quick Start

Python

from de_quack import de_duckling, volcano_plot

with de_duckling('results.duckdb') as db:
    db.initialize_gene_table('human')
    db.insert_to_database('data.txt')
    results = db.query('gene_results', padj__lt=0.05)
    print(results)
    
# Generate volcano plot
volcano_plot(results, padj=0.05, log2fc=1, plot_file='volcano.png')

R

# Find and source the wrapper directly from the pip installation directory
py_pkg_path <- dirname(reticulate::import("de_quack")$`__file__`)
source(file.path(py_pkg_path, "wrapper.R"))

# Initialize
duck <- de_quack(db_path = "results.duckdb")
duck$connect()
duck$initialize_gene_table('human')
duck$insert_to_database('data.txt')
results <- duck$query('gene_results', padj__lt=0.05)
duck$volcano_plot(results, padj=0.05, log2fc=1, plot_file='volcano.png')
duck$close()

Database Schema

Tables

  • experimental_data: Metadata about DE analysis experiments
  • gene_results: Individual gene-level results with statistics
  • genes: Reference gene annotations (human, etc.)

Advanced Querying & JSON Fallback

DeDuck supports intuitive field modifiers (__lt, __gt, __lte, __gte, __ne). If a metric isn't a native column in the database, DeDuck automatically queries it out of custom nested JSON metadata dynamically:

# Regular column filtering + automatic nested JSON key metadata extraction
with de_duckling as db:
    results = db.query('gene_results', padj__lt=0.05, custom_biotype__ne='pseudogene')

License

MIT

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

de_quack-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

de_quack-0.1.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file de_quack-0.1.0.tar.gz.

File metadata

  • Download URL: de_quack-0.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for de_quack-0.1.0.tar.gz
Algorithm Hash digest
SHA256 362aedeb97404c5caa0bcb1c84d5e99a6cbb16c6aae7f44afd2a2b00bceb0deb
MD5 309e669b8bd4c21f4742782200c23bf8
BLAKE2b-256 5ad92e1786eb86ed9b55f1e011b5baf145f975017d01b39e3a955f46b14dc635

See more details on using hashes here.

File details

Details for the file de_quack-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: de_quack-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for de_quack-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0af7bda1069756d1af05114aef90b2e2d70034ff2920f20bed347eae10effe3c
MD5 059e708bb0bffd36544009087bfd3be3
BLAKE2b-256 ffee8ed0ff6129c8739d376f743005a1048ecc8479094760cd5d70bf04169a44

See more details on using hashes here.

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