10 Statistical Models · Interactive Manhattan & QQ · Best-Model Circos · LD Decay · Excel & PNG Export
+10 Statistical Models · Circos · QQ per Model · LD Decay · PNG Export · Full Excel Results
- REML (intercept-projected) · VanRaden kinship · Mode imputation · - O(n) rotated GLS · Joint-model PVE · All plots interactive (hover/zoom/click) + Per-model results include: MTA · PVE · QTN Effects · Beta · SE · T-stat · FDR · Bonferroni · 95% CI
Hover SNPs for details · Zoom with scroll · Click legend to toggle chromosomes · X-axis starts from Chr1
') - plot1 = gr.Plot(label="Manhattan — Primary Model") - + img1 = gr.Image(type="pil", label="Manhattan Plot — Primary Model (🟡 = Sig. MTA)") with gr.Tab("📈 QQ (Primary)"): - gr.HTML('Hover points for p-values · λ shows genomic inflation
') - plot2 = gr.Plot(label="QQ Plot — Primary Model") - + img2 = gr.Image(type="pil", label="QQ Plot — Primary Model") + with gr.Tab("📈 QQ (All Models)"): + img3 = gr.Image(type="pil", label="QQ Plots — All Models (individual panels)") with gr.Tab("📊 QQ Overlay"): - gr.HTML('All models overlaid · Click legend to toggle · Compare λ values
') - plot3 = gr.Plot(label="QQ Overlay — All Models") - - with gr.Tab("🔵 Circos (Best Models)"): - gr.HTML('Shows top 4 best-controlled models (λ closest to 1) · ◆ = genome-wide significant · Chr labels outside with connector lines · No overlapping text
') - plot4 = gr.Plot(label="Circos — Best Models") - - with gr.Tab("🔗 LD Decay"): - gr.HTML('Colored scatter = pairwise r² per chromosome · Black curve = fitted exponential decay · Distance in Megabases (Mb) · Comprehensive interpretation box shows half-decay distance and LD structure
') - plot5 = gr.Plot(label="LD Decay") - + img4 = gr.Image(type="pil", label="QQ Overlay — All Models with λ") + with gr.Tab("🔵 Circos"): + img5 = gr.Image(type="pil", label="Circos — Multi-Model Comparison") + with gr.Tab("🔗 LD Decay (bp / Mb)"): + img6 = gr.Image(type="pil", label="Linkage Disequilibrium Decay") with gr.Tab("🔬 PCA"): - gr.HTML('Color = phenotype value · Hover for sample ID
') - plot6 = gr.Plot(label="PCA") - + img7 = gr.Image(type="pil", label="Principal Component Analysis") with gr.Tab("👨👩👧 Kinship"): - gr.HTML('Hover cells for kinship coefficient · Distribution shows population structure
') - plot7 = gr.Plot(label="Kinship Matrix") - + img8 = gr.Image(type="pil", label="Kinship Matrix & Clustering") with gr.Tab("⚖ Effect Sizes"): - gr.HTML('Hover for SNP details · Red = GW significant · Green = positive effect
') - plot8 = gr.Plot(label="Effect Sizes & Volcano") - - with gr.Tab("🔄 All Models (Stacked)"): - gr.HTML('All models stacked · Hover for SNP identity · λ shown per panel · X-axis starts from Chr1
') - plot9 = gr.Plot(label="Manhattan — All Models") - + img9 = gr.Image(type="pil", label="Effect Sizes & Volcano Plot") + with gr.Tab("🔄 All Models MH"): + img10 = gr.Image(type="pil", label="Manhattan — All Models Side-by-Side") with gr.Tab("📊 Dashboard"): - gr.HTML('Summary statistics · Model concordance · Inflation control
') - plot10 = gr.Plot(label="Summary Dashboard") - - def run_wrapper(file_obj, text_data, selected_models, maf): - if not selected_models: - selected_models = ALL_MODELS - out = run_gwas(file_obj, text_data, selected_models, maf) - while len(out) < 13: + img11 = gr.Image(type="pil", label="Summary Dashboard — All Models") + + def run_wrapper(f, t, m, maf): + out = run_gwas(f, t, m, maf) + # Pad if needed + while len(out) < 14: out.append(None) return out run_btn.click( - fn=run_wrapper, + run_wrapper, inputs=[file_in, text_in, model_sel, maf_thr], - outputs=[ - plot1, plot2, plot3, plot4, plot5, - plot6, plot7, plot8, plot9, plot10, - excel_out, zip_out, summary_out - ], + outputs=[img1, img2, img3, img4, img5, img6, img7, img8, img9, img10, img11, + excel_out, zip_out, summary_out] ) if __name__ == "__main__": - demo.launch(share=True, server_port=7860) \ No newline at end of file + demo.launch(share=False, server_port=7860) \ No newline at end of file