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_quackling, volcano_plot

with de_quackling('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_quackling 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.1.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.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: de_quack-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 85461f7853a08b8df5bcafed91d7138f136c95ab7bb6aedf6724f8195b54c850
MD5 783471eae0f0d5baaa11802c3ab60e8e
BLAKE2b-256 47019c68150de57bed7c97470f56902579c29b08e111556739236a791c5bcf62

See more details on using hashes here.

File details

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

File metadata

  • Download URL: de_quack-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10e29dec245ae18d2f69ef40520ae26ffd2a834ccab0bc52869f69833e3bbb40
MD5 c4af878d08232aea0792e48c14441698
BLAKE2b-256 dedd34014f8fc557ed6c61514dcd6f6f5ee7f67ad8a2f44dff20a044368a9427

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