$ show hakyimlab/MetaXcan
MetaXcan is a command-line and library framework for transcriptome-wide association studies (TWAS). It integrates GWAS summary statistics or individual-level genotype data with gene expression prediction models to compute gene-level association statistics. The core methods implemented are S-PrediXcan (summary-based), PrediXcan (individual-level), MultiXcan, and S-MultiXcan (multi-tissue meta-analysis). The architecture consists of Python scripts that orchestrate data processing steps (e.g., parsing GWAS, aligning alleles, computing z-scores) using a core library (`metax`) with modules for genotype reading, GWAS loading, prediction model management, and covariance matrix handling. The system is designed for bioinformatics researchers and requires external reference data (e.g., GTEx models, 1000 Genomes LD). While functional, the codebase exhibits significant technical debt: Python 2 compatibility remnants, deprecated modules, hardcoded URLs, and limited test coverage. The GUI component (Tkinter) is unmaintained. The repository is hybrid, containing both application scripts and data processing pipelines, but the dominant character is a software tool for running TWAS analyses.
The LLM identified 4 files worth highlighting for reuse:
A flexible GWAS summary statistics parser that supports multiple column naming conventions (SNP, effect allele, p-value, beta, OR, SE, Z-score). It validates required columns, handles missing values, and provides a standardized DataFrame output. This component is reusable for any project that needs to ingest GWAS data from diverse sources, as it abstracts away format differences.
A genotype reader for GTEx-like data that implements a common interface (yielding tuples of rsid, chr, pos, ref, alt, freq, dosages). It demonstrates an adapter pattern for different genotype formats (VCF, BGEN, dosage). This component can be extracted and reused in any project requiring genotype data ingestion, with minimal modification.
Provides a pseudo-inverse function with an eigenvalue cutoff for numerical stability, used in S-MultiXcan. This is a self-contained mathematical utility that can be reused in any project requiring robust matrix inversion, especially in statistical genetics or machine learning contexts.
Loads and manages prediction model databases stored in SQLite format, with tables for weights and extra information (e.g., gene info, prediction performance). It provides a clean interface for querying models by gene and tissue. This pattern is reusable for any project that stores model parameters in a relational database and needs efficient access.