Spaces:
Paused
Paused
Download app.py from softwareDevelopment/GWAS: direct link, hf CLI and curl.
- Browser
- Download file 2.6 kB
-
https://huggingface.co/spaces/softwareDevelopment/GWAS/resolve/5bb9f6b474a90ed0dfd8663571d1bc199fa45a2d/app.py
- Command line
-
hf download hf://spaces/softwareDevelopment/GWAS@5bb9f6b474a90ed0dfd8663571d1bc199fa45a2d/app.py
-
curl -L -o app.py https://huggingface.co/spaces/softwareDevelopment/GWAS/resolve/5bb9f6b474a90ed0dfd8663571d1bc199fa45a2d/app.py
2.6 kB
| """) | |
| with gr.Column(scale=1): | |
| miss_sample = gr.Slider(5, 50, value=30, step=5, label="Max sample missing (%)") | |
| miss_marker = gr.Slider(5, 50, value=30, step=5, label="Max marker missing (%)") | |
| maf_thr = gr.Slider(0, 25, value=3, step=1, label="Min MAF (%)") | |
| with gr.Column(scale=1): | |
| lod_thresh = gr.Slider(0.5, 10.0, value=3.0, step=0.1, label="LOD threshold") | |
| n_pc = gr.Slider(2, 20, value=5, step=1, label="Number of PCs") | |
| gr.Markdown("### Models") | |
| with gr.Row(): | |
| chk_glm = gr.Checkbox(value=True, label="GLM") | |
| chk_mlm = gr.Checkbox(value=True, label="MLM") | |
| chk_cmlm = gr.Checkbox(value=True, label="CMLM") | |
| chk_bslmm = gr.Checkbox(value=False, label="BSLMM") | |
| chk_farmcpu = gr.Checkbox(value=True, label="FarmCPU") | |
| run_btn = gr.Button("π Run GWAS Analysis", variant="primary", size="lg") | |
| gr.Markdown("---") | |
| summary_out = gr.Markdown() | |
| with gr.Row(): | |
| man_model_sel = gr.Dropdown(label="πΊοΈ Manhattan β select model", choices=[], value=None, interactive=True) | |
| qq_model_sel = gr.Dropdown(label="π QQ Plot β select model", choices=[], value=None, interactive=True) | |
| with gr.Row(): | |
| man_out = gr.Image(label="πΊοΈ Manhattan Plot (βlogββP top | LOD bottom)") | |
| qq_out = gr.Image(label="π QQ Plot (genomic inflation Ξ»)") | |
| with gr.Row(): | |
| pca_out = gr.Image(label="π¬ PCA Analysis (Scree + PC1v2 + PC2v3)") | |
| ld_out = gr.Image(label="𧬠LD Decay (Hill-Weir model)") | |
| with gr.Row(): | |
| circos_out = gr.Image(label="π Circos β Multi-Model MTA") | |
| cmp_out = gr.Image(label="βοΈ Model P-value Concordance") | |
| with gr.Row(): | |
| ph_out = gr.Image(label="π Phenotype Distribution") | |
| kin_out = gr.Image(label="π₯ Kinship Matrix Heatmap") | |
| dl_out = gr.File(label="π¦ Download All Results (ZIP)") | |
| man_paths_state = gr.State({}) | |
| qq_paths_state = gr.State({}) | |
| run_btn.click( | |
| fn=run_analysis, | |
| inputs=[input_file, miss_sample, miss_marker, maf_thr, | |
| lod_thresh, n_pc, | |
| chk_glm, chk_mlm, chk_cmlm, chk_bslmm, chk_farmcpu], | |
| outputs=[summary_out, man_out, qq_out, pca_out, | |
| ld_out, circos_out, cmp_out, ph_out, | |
| dl_out, kin_out, | |
| man_model_sel, qq_model_sel, | |
| man_paths_state, qq_paths_state], | |
| show_progress="full" | |
| ) | |
| def switch_manhattan(model, paths): | |
| return paths.get(model) if paths else None | |
| def switch_qq(model, paths): | |
| return paths.get(model) if paths else None | |
| man_model_sel.change(switch_manhattan, [man_model_sel, man_paths_state], [man_out]) | |
| qq_model_sel.change(switch_qq, [qq_model_sel, qq_paths_state], [qq_out]) | |
| if __name__ == "__main__": | |
| app.launch(share=False, show_error=True, max_threads=4, allowed_paths=[str(OUTPUT_DIR)]) |