Skip to content

Conversation

@kal26
Copy link
Contributor

@kal26 kal26 commented Jan 15, 2026

Summary

Adds graceful handling when all GWAS studies are skipped during QC in the colocboost analysis pipeline.

Problem

When all GWAS studies are skipped during QC (e.g., due to "No variants in region"), the pipeline would crash with a "subscript out of bounds" error when trying to access dict_sumstatLD[i_gwas, ] with an invalid index.

Solution

  • Added check for empty sumstats before running joint_gwas analysis
  • Added check for NULL or empty dict_sumstatLD before running separate_gwas analysis
  • Returns NULL results with informative message instead of crashing

Changes

  • Modified colocboost_analysis_pipeline() to check if GWAS data exists before attempting analysis

- Check for missing phenotype, covariate, genotype, sumstat, column mapping, and LD metadata files
- Error (not warn) when files are missing to catch path issues early
- Fix genotype file check to look for .bed/.bim/.fam or .pgen/.pvar/.psam files instead of base filename
- Improve error messages to show which files are missing with condition names
- Filter phenotypes without data for specific region before loading
- Centralize normalize_variant_id function in misc.R and remove duplicates
- Normalize variant IDs consistently across sumstats, LD matrices, and genotype data
- Fix LD matrix usage: use processed LD matrices after normalization in summary_stats_qc
- Normalize ref_panel variant IDs before imputation to match processed sumstats
- Add try-catch error handling in summary_stats_qc_multitask loop
- Add try-catch error handling in separate_gwas focal analysis loop
- Fix pip_cutoff_to_skip_sumstat handling for single values, named vectors, and unnamed vectors
- Remove debug statements
…alyses

- Use normalize_variant_id() consistently for sumstats and LD matrices to handle variant ID format mismatches
- Remove double 'chr' prefix issue and build suffix (e.g., :b38) mismatches
- Add tryCatch error handling for joint_gwas and separate_gwas analyses
- Add concise warning messages for colocboost validation failures
- Fix sumstat_studies handling when sumstats list is empty
- Check if sumstats is empty before running joint_gwas analysis
- Check if dict_sumstatLD is NULL or has 0 rows before running separate_gwas analysis
- Prevents 'subscript out of bounds' error when all GWAS studies are skipped during QC
- Returns NULL results with informative message instead of crashing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant