Skip to content

mecfs_bio.analysis.all_ldsc_diagnostics

Materialize the LD-score-regression diagnostic plot for every GWAS on which we run an LDSC heritability analysis.

Each plot bins a GWAS's variants by LD score and shows each bin's mean chi-square against the fitted regression line, giving the visual diagnostic that LD-score regression normally lacks (see ldsc_diagnostic_plot_task). LDSC_DIAGNOSTICS gathers one such task per GWAS from two sources:

  • GWAS run through the standard analysis generator with a PhenotypeInfo, which now builds the diagnostic as a terminal task of its StandardAnalysisTaskGroup (reached here via ldsc_diagnostic_plot_task_unwrap, or .tasks for the add-rsids variant).
  • GWAS with a standalone SNPHeritabilityByLDSCTask but no standard analysis, whose diagnostic is defined alongside that heritability task.

Functions:

  • run_all_ldsc_diagnostics –

    Build every LDSC diagnostic plot, saving each as it completes so a failure on one GWAS does

Attributes:

LDSC_DIAGNOSTICS module-attribute

LDSC_DIAGNOSTICS: list[Task] = (
    [
        group.ldsc_diagnostic_plot_task_unwrap
        for group in _STANDARD_ANALYSIS_GROUPS
    ]
    + [
        group.tasks.ldsc_diagnostic_plot_task_unwrap
        for group in _STANDARD_ANALYSIS_GROUPS_WITH_RSID_ASSIGNMENT
    ]
    + _STANDALONE_DIAGNOSTICS
)

run_all_ldsc_diagnostics

run_all_ldsc_diagnostics() -> None

Build every LDSC diagnostic plot, saving each as it completes so a failure on one GWAS does not discard the plots already produced.

Source code in mecfs_bio/analysis/all_ldsc_diagnostics.py
def run_all_ldsc_diagnostics() -> None:
    """Build every LDSC diagnostic plot, saving each as it completes so a failure on one GWAS does
    not discard the plots already produced."""
    DEFAULT_RUNNER.run(LDSC_DIAGNOSTICS, incremental_save=True)