Multi-evidence deep learning pipeline for identifying biosynthetic pathway genes using transcriptome-metabolome integration.
This framework combines statistical correlation, deep learning feature importance (AutoEncoder + GNN), and homology search (BLAST/HMM) into a multi-evidence scoring system to rank candidate genes involved in target metabolite biosynthesis.
Three Evidence Lines:
- Correlation analysis β Pearson r between each gene and target metabolite abundance
- Deep learning importance β AutoEncoder reconstruction/gradient importance + GNN latent-to-gene mapping
- Homology search β BLAST/HMM hits against known gene families
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RAW DATA (N samples) β
β Transcriptome (gene expression) Metabolome (metabolite data) β
ββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ
β Step 1: Data Preparation β β 01_prepare_data.py β
β FPKM β log2 β z-score β β intensity β log2 β z-score β
ββββββββββββββββ¬ββββββββββββββββ ββββββββββββββββ¬ββββββββββββββββ
β β
βΌ βΌ
gene_expression_matrix.csv metabolite_matrix.csv
(genes Γ samples) (metabolites Γ samples)
β β
βΌ βΌ
ββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ
β Step 2: Model Training β β 02_train_models.py β
β Gene AE: genes β 64 latent β β Metab AE: metab β 64 latentβ
ββββββββββββββββ¬ββββββββββββββββ ββββββββββββββββ¬ββββββββββββββββ
β β
βΌ βΌ
gene_latent.csv metabolite_latent.csv
(N Γ 64) (N Γ 64)
β β
ββββββββββββββ¬ββββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββ
β GNN (Graph Attention Net) β
β 128-dim input (64+64 concat) β
β Multi-task classification: β
β Tissue / Geography / etc. β
ββββββββββββββββ¬ββββββββββββββββ
β
βββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ
β β β
β Step 3: Analysis β 03_analyze_results.py β
β - Latent space viz (t-SNE, UMAP, PCA) β
β - Gene-metabolite correlations β
β - Target metabolite correlation analysis β
βββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Step 4: Feature Importance 04_ae_feature_importance.py β
β β
β Evidence 2a: AE Importance β
β - Reconstruction importance (per-gene MSE contribution) β
β - Gradient importance (βloss/βinput) β
β - Combined β rank-normalized score β
β β
β Evidence 2b: GNN β Gene Mapping β
β - GNN perturbation importance on 128-dim latent β
β - Map back to gene space via: β
β gnn_gene_importance[j] = Ξ£_k(latent_imp[k] Γ β
β |corr(gene_j, latent_k)|) β
ββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Step 5: Multi-Evidence Ranking 05_multi_evidence_ranking.py β
β β
β Composite Score = 0.4 Γ Correlation (rank-normalized) β
β + 0.3 Γ AE importance (rank-normalized) β
β + 0.2 Γ GNN importance (rank-normalized) β
β + 0.1 Γ BLAST family bonus (binary) β
β β
β β All genes ranked by multi-evidence composite score β
ββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββ
β
ββββββββββββββββββββΌββββββββββββββββββββ
βΌ βΌ βΌ
ββββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββββ
β Family Integr. β β Novel Cands. β β Experiment Targets β
β FamilyA: N β β Top genes for β β Prioritized by β
β FamilyB: M β β annotation β β composite score β
ββββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββββ
# Activate environment
conda activate omics-ae
# Run complete pipeline (all 5 steps)
python scripts/run_pipeline.py
# Or run individual steps:
python scripts/run_pipeline.py --steps prep # Step 1 only
python scripts/run_pipeline.py --steps train # Step 2 only
python scripts/run_pipeline.py --steps analyze # Step 3 only
python scripts/run_pipeline.py --steps importance # Step 4 only
python scripts/run_pipeline.py --steps rank # Step 5 only
# Combine steps:
python scripts/run_pipeline.py --steps importance,rank
# Gene family integration (after BLAST/HMM results available):
python scripts/integrate_gene_family.py --family FamilyA --blast-file data/processed/blast_results/FamilyA_candidates.xlsx
python scripts/integrate_gene_family.py --batch # All families in configomics-ae-gnn/
βββ config/ # Configuration files
β βββ config.yaml # Samples, models, training params
β βββ paths.yaml # File paths (relative, portable)
β βββ hardware.yaml # Device settings (MPS/CUDA/CPU)
β βββ pipeline_params.yaml # Evidence weights, thresholds
β
βββ src/ # Source code modules
β βββ core/ # Core utilities
β β βββ config_loader.py # YAML config loader
β β βββ device_manager.py # Hardware abstraction (MPS/CUDA/CPU)
β β βββ logger.py # Logging setup
β β
β βββ preprocessing/ # Data preprocessing
β β βββ gene_processor.py # FPKM β log2 β z-score
β β βββ metabolite_processor.py # Intensity β log2 β z-score
β β βββ sample_metadata.py # Sample metadata generation
β β
β βββ models/ # Neural network architectures
β β βββ autoencoder.py # AutoEncoder (symmetric, 64-dim latent)
β β βββ gnn.py # GAT with attention export support
β β
β βββ training/ # Training utilities
β β βββ data_loader.py # PyTorch datasets + graph construction
β β βββ trainer.py # Training loop, checkpoints, early stopping
β β
β βββ analysis/ # Analysis and interpretation
β β βββ correlation_analysis.py # Gene-metabolite correlations
β β βββ explainability.py # AE/GNN feature importance
β β βββ multi_evidence_scorer.py # Multi-evidence composite scoring
β β βββ qc_validator.py # Quality control validation
β β βββ report_generator.py # Automated report generation
β β
β βββ visualization/ # Visualization utilities
β βββ heatmaps.py # Correlation heatmaps
β βββ plotters.py # PCA, distribution plots
β βββ latent_viz.py # t-SNE, UMAP, latent space viz
β
βββ scripts/ # Pipeline scripts
β βββ run_pipeline.py # Master pipeline runner (Steps 1-5)
β βββ 01_prepare_data.py # Step 1: Preprocessing + QC
β βββ 02_train_models.py # Step 2: AE + GNN training
β βββ 03_analyze_results.py # Step 3: Visualization + correlations
β βββ 04_ae_feature_importance.py # Step 4: DL feature importance
β βββ 05_multi_evidence_ranking.py # Step 5: Multi-evidence ranking
β βββ integrate_gene_family.py # Generic family integration
β βββ find_target_genes.py # Target metabolite correlation analysis
β
βββ data/
β βββ raw/ # Original data files
β β βββ transcriptome/ # RNA-seq gene expression data
β β βββ metabolome/ # Metabolomics profiling data
β β βββ integrated/ # Joint analysis data
β β
β βββ processed/
β βββ matrices/ # Normalized expression matrices
β βββ latent/ # Latent representations (N Γ 64)
β βββ blast_results/ # BLAST/HMM family results (.xlsx)
β βββ models/ # Intermediate model artifacts
β βββ results/ # Intermediate analysis results
β
βββ outputs/ # Final outputs
β βββ figures/ # QC + analysis plots (PNG, 300 DPI)
β βββ tables/ # Correlation tables (CSV)
β βββ logs/ # Training logs + history (JSON)
β βββ checkpoints/ # Model checkpoints (.pt)
β β βββ gene/ # Gene AE checkpoints
β β βββ metabolite/ # Metabolite AE checkpoints
β β βββ gnn/ # GNN checkpoints
β βββ ae_importance/ # Feature importance scores
β βββ target_analysis/ # Target metabolite correlations
β βββ multi_evidence/ # Multi-evidence ranked genes
β βββ family_integration/ # Per-family integration results
β
βββ examples/ # Example workflows and simulated data
βββ docs/ # Documentation
βββ tests/ # Unit tests
βββ README.md
- macOS with Apple Silicon (M1/M2/M3) for MPS acceleration, or Linux/Windows with NVIDIA GPU
- Python 3.8+, PyTorch 2.0+
# Clone the repository
git clone https://github.com/yourusername/omics-ae-gnn.git
cd omics-ae-gnn
# Create conda environment
conda env create -f environment.yaml
conda activate omics-ae
# Or install manually
pip install torch numpy pandas scipy scikit-learn matplotlib seaborn openpyxl pyyaml
# Optional
pip install umap-learn # UMAP visualization
pip install shap # SHAP explainability
# Verify
python -c "import torch; print(f'PyTorch: {torch.__version__}, MPS: {torch.backends.mps.is_available()}')"- Loads gene expression (FPKM) and metabolite intensity data
- Applies log2(x+1) transformation + z-score normalization
- Generates sample metadata, QC plots
| Output | Description |
|---|---|
data/processed/matrices/gene_expression_matrix.csv |
Normalized gene expression matrix |
data/processed/matrices/metabolite_matrix.csv |
Normalized metabolite matrix |
outputs/figures/qc_*.png |
QC plots |
- Trains gene AE and metabolite AE with configurable latent dimensions
- Extracts latent representations for all samples
- Trains GAT on concatenated latents with multi-task classification
| Output | Description |
|---|---|
data/processed/latent/gene_latent.csv |
Gene latent representations |
data/processed/latent/metabolite_latent.csv |
Metabolite latent representations |
outputs/checkpoints/{gene,metabolite,gnn}/ |
Model checkpoints (.pt) |
- Latent space visualization (t-SNE, UMAP, PCA)
- Gene-metabolite correlations
- Target metabolite correlation analysis
| Output | Description |
|---|---|
outputs/figures/analysis_*.png |
Visualization plots |
outputs/tables/top_gene_metabolite_correlations.csv |
Significant gene-metabolite pairs |
outputs/target_analysis/all_gene_correlations.csv |
All gene-target correlations |
This step closes the loop between deep learning and gene selection. It retrains models if checkpoints are missing.
- AE importance: Reconstruction importance + gradient importance per gene, combined via rank-normalization
- GNN-to-gene mapping: Perturbation-based latent importance mapped to gene space via correlation matrix:
gnn_gene_importance[j] = Ξ£_k(latent_imp[k] Γ |corr(gene_j, latent_k)|) - Latent-correlation importance: Supplementary metric not requiring checkpoints
| Output | Description |
|---|---|
outputs/ae_importance/gene_ae_importance.csv |
AE importance for all genes |
outputs/ae_importance/gene_gnn_importance.csv |
GNN-mapped importance for all genes |
outputs/ae_importance/gene_latent_corr_importance.csv |
Latent-correlation importance |
outputs/ae_importance/importance_analysis.png |
Importance distribution plots |
Combines all evidence into a single composite ranking using rank-based normalization:
Composite = 0.4 Γ Correlation + 0.3 Γ AE importance + 0.2 Γ GNN importance + 0.1 Γ BLAST bonus
Weights are configurable in config/pipeline_params.yaml.
| Output | Description |
|---|---|
outputs/multi_evidence/multi_evidence_ranked_genes.csv |
All genes ranked |
outputs/multi_evidence/multi_evidence_ranked_genes.xlsx |
Top genes + BLAST hits + details |
outputs/multi_evidence/multi_evidence_visualization.png |
6-panel summary figure |
outputs/multi_evidence/MULTI_EVIDENCE_SUMMARY.txt |
Text summary |
Standalone script for integrating BLAST/HMM results with pipeline outputs. Supports any gene family.
# Single family
python scripts/integrate_gene_family.py --family FamilyA \
--blast-file data/processed/blast_results/FamilyA_candidates.xlsx
# All families defined in config
python scripts/integrate_gene_family.py --batch
# With AE importance overlay
python scripts/integrate_gene_family.py --family FamilyA \
--blast-file data/processed/blast_results/FamilyA_candidates.xlsx \
--ae-importance outputs/ae_importance/gene_ae_importance.csvOutputs to outputs/family_integration/{family_name}/.
All parameters in config/:
| File | Contents |
|---|---|
config.yaml |
Sample definitions, model architecture, training params |
paths.yaml |
File paths (relative, portable) |
hardware.yaml |
Device preferences (MPS/CUDA/CPU) |
pipeline_params.yaml |
Evidence weights, gene families, thresholds |
Key configurable parameters in pipeline_params.yaml:
gene_ranking:
multi_evidence_weights:
correlation: 0.4 # Pearson r with target metabolite
ae_importance: 0.3 # AutoEncoder feature importance
gnn_importance: 0.2 # GNN latent-to-gene mapped importance
blast_bonus: 0.1 # Known family membership bonus
alkaloid_genes:
reference_genes: # Families for batch integration
- "FamilyA"
- "FamilyB"
- "FamilyC"Automatically detects and uses MPS (macOS), CUDA (Linux/Windows), or CPU. Configure in config/hardware.yaml.
The pipeline generates three independent lines of evidence, then combines them:
- Statistical correlation: Direct Pearson correlation between gene expression and target metabolite abundance across all samples
- Deep learning importance: AutoEncoder identifies genes that contribute most to learned latent representations; GNN validates that latent space captures biological structure (tissue/geography classification), then maps latent importance back to gene space
- Homology search: BLAST/HMM hits against known biosynthetic gene families provide a binary bonus
Rank-based normalization ensures each evidence type contributes proportionally regardless of scale differences.
- GNN's high classification accuracy validates that AE latent spaces capture real biological signal
- Therefore, AE-derived gene importance scores are biologically meaningful
- Cross-validation between statistical and deep learning evidence reduces false positives
- BLAST provides orthogonal sequence-based evidence
If you use this framework in your research, please cite:
@software{omics_ae_gnn,
author = {Arnold},
title = {Autoencoder and Graph Neural Networks for Multi-Omics Integration},
year = {2026},
url = {https://github.com/arnold117/omics-ae-gnn}
}This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
For questions or collaborations, please open an issue on GitHub.
Pipeline version: 3.0.0