Skip to main content

A batch correction and signal deconvolution toolkit for bulk transcriptomic data using adversarial autoencoder

Project description

DeepAdvancer

DeepAdvancer is a deep learning toolkit for batch correction and expression reconstruction, specifically designed for biologically complex class structures.


🚀 Features

  • ⚙️ Autoencoder-based transcriptome reconstruction
  • 🧩 Learns interpretable decoding matrix (sigmatrix) using prior fold-change information
  • 🧠 Multi-task learning including batch classification, class prediction, and feature disentanglement
  • 🔁 Preserves biological structure while removing batch effects from high-dimensional data
  • 📊 Supports various downstream biological tasks such as differential expression analysis, feature alignment, and expression synthesis

🧱 Installation

It is recommended to use conda or virtualenv to create an isolated environment:

pip install deepadvancer

🛠️ Quick Usage

1. Load Expression Matrix and Phenotype Metadata

import deepadvancer

expr_matrix, pheno_data = deepadvancer.load_and_process_expression_data(
    data_dir=data_path,
    output_dir=data_path ,
    gene_threshold_ratio=0.8,
    dataset_gene_coverage_threshold=0.8
)

2. Run Fold Change Analysis and Build Sigmatrix

💡 Note: Before running this step, make sure your saved phenotype metadata includes a 'disease' column indicating class labels (e.g., psoriasis, lupus, etc.). If you've already saved the expression and metadata files with correct formatting, you can skip Step 1 and directly load them using pd.read_csv() or similar.

train_x, class_all, batch_labels, proportions_per_feature, expected_sigmatrix = deepadvancer.run_logfc_analysis_and_generate_fc_array(
    sample_metadata=sample_metadata,
    expr_matrix=expr_matrix,
    output_path=data_path
)

3. Train the Autoencoder Model

x_recon_expression_matrix, model = deepadvancer.recon_training(
    expr_matrix=expr_matrix,
    train_x=train_x,
    class_all=class_all,
    batch_labels=batch_labels,
    proportions_per_feature=proportions_per_feature,
    expected_sigmatrix=expected_sigmatrix,
    output_path=data_path
    batch_size=128,
    epochs=300
)

4. Compute logFC for Target Class

logfc_df = deepadvancer.compute_logfc_vs_others(
    expression_matrix=x_recon_expression_matrix,
    phenotype_metadata=sample_metadat_cleaned,
    class_column="disease",
    target_class="psoriasis"
)

5. Compute logFC Between Two Classes

logfc_df = deepadvancer.compute_logfc_between_classes(
    expression_matrix=x_recon_expression_matrix,
    phenotype_metadata=sample_metadat_cleaned,
    class_column='disease',
    class1='healthy',
    class2='psoriasis'
)

6. Projection of Matrix

deepadvancer.plot_pca_by_class(
    expression_df=x_recon_expression_matrix,,
    class_series=sample_metadat_cleaned['disease'],
    jitter_scale=0.8,
    point_size=15,
    max_legend_classes=50,
    title="Expression Matrix",
    figsize=(12, 10),
    alpha=0.8,
    save_path=None 
)

📦 Module Overview

Module Description
load_and_process_expression_data Integrates raw expression matrix and phenotype metadata into a unified format
run_logfc_analysis_and_generate_fc_array Prepares fold-change tensor and interpretable sigmatrix via shared logFC analysis
recon_training Trains the adversarial autoencoder with batch correction and structure alignment
compute_logfc_between_classes Calculates log2 fold change between any two specified classes
compute_logfc_vs_others Computes log2 fold change of one class against all other classes

📄 License

MIT License


✉️ Author

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

deepadvancer-0.1.0.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

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

deepadvancer-0.1.0-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deepadvancer-0.1.0.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for deepadvancer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 445044a81dd655a1ec9bcd4371c406d2172cf9998c0c0242af6b4aa5e4bcf1a6
MD5 6bed811e28deb20d834805848483d8de
BLAKE2b-256 6cbafcb0bdaf217948cfd58d9b2c35a537ad3efe590165480e915b14ba8a31b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: deepadvancer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for deepadvancer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c8c5a03239ab8e80cabe8e7682485944222fb0c48d37f38e24a39269122f632
MD5 24af165dba0876ca5d4714175c9201c7
BLAKE2b-256 76f7b66bf481ee680abee6630ba3a5c412df082e22e350a8a588fa794956883f

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