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', experiment_name='test', comparison_label='test')
    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', experiment_name = 'test', comparison_label = 'test')
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

De_quack supports intuitive field modifiers (__lt, __gt, __le, __ge, __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.2.tar.gz (13.7 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.2-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: de_quack-0.1.2.tar.gz
  • Upload date:
  • Size: 13.7 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.2.tar.gz
Algorithm Hash digest
SHA256 8877c77f3482b8f191e27a16234045198cae8373676f281b633bf020726fbd00
MD5 825accb62a64bcba9f6fafbe9efa98e0
BLAKE2b-256 5d91eb7cd4d8cd8d3e5bb99ab660d7d0c2f132a840f4679a49964104328ec629

See more details on using hashes here.

File details

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

File metadata

  • Download URL: de_quack-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 46fe34bd2e1f6c6e48d80bb994163c35a178b24424355c39c7e6399bd7ad9376
MD5 87480cdafb33e4522b1d8263da9616d3
BLAKE2b-256 3aa81ed7bb3865764f3982c03212ebf8bfe28fda25dca5162d13fd3b26ab20fa

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