For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to run the LDSC unmodifiable pipeline

Introduction

The LDSC pipeline is used for calculating heritabilities and genetic correlations for disease endpoints using ldsc. The complete documentation for the pipeline can be found in github.

You can find the pipeline as UnmodifiableGeneticCorrelationLDSCDF[RELEASE]" in the unmod pipeline page in sandbox.

How it works

Summary:

  • Start with metadata tables describing your GWAS summary statistics.

  • The pipeline splits these into chunks for parallel processing.

  • Each chunk runs a premunging step (preprocessing/mapping), then munge_ldsc (munging + heritability calculation).

  • Results are gathered with gather_h2 (heritabilities).

  • If only_het is false, pairwise combinations are built with return_couples and correlations are computed in parallel using multi_rg, with summary outputs collected at the end.

Inputs

The pipeline works in two modes conceptually, either by calculating cross correlations within a single list or between two lists. The pipeline requires to always provide two input lists via meta_fg and meta_other.

  • If the same list is passed twice the pipeline will calculate N*(N-1)/2 correlations with the list

  • If two different lists are passed then N*M correlations will be calculated across the two list

The advantage of this setup is that now cache calling is improved as the internal munging required by LDSC is done only once, speeding up operations. Here are all the required inputs for the pipeline

Parameter
Description

ldsc_rg.only_het

If true, computes only heritabilities (default: false, will also compute genetic correlations).

ldsc_rg.meta_fg

Path to the primary metadata table (TSV) with summary statistics info.

ldsc_rg.meta_other

Path to the comparison/secondary metadata table (for cross-trait analyses). If one wants to calculate all correlation across one list this file should match input_ss

ldsc_rg.name

Prefix for output files.

ldsc_rg.population

LD reference population key. "fin" or "eur"

ldsc_rg.couples_chunk_size

Number of correlations calculated within each shard. Can be kept low (~10) for small runs but if the number of comparison is huge (e.g. all FG endpoints) then the number can be in the hundreds

The pipeline now supports premunging so that (almost) any input sumstats can be provided and the pipeline will take care to output the right input for LDSC, as long as the basic information is provided in the json. These are the columns involved.

Parameter
Description

ldsc_rg.premunge_fg.p_col

Column name for p-values in sumstats input.

ldsc_rg.premunge_fg.a1_effect_col

Column name for effect (alt) allele.

ldsc_rg.premunge_fg.a2_ne_col

Column name for non-effect (ref) allele.

ldsc_rg.premunge_fg.beta_col

Column name for effect size (beta).

ldsc_rg.premunge_fg.rsid_col

Column name for rsID (variant IDs). Leave blank if missing!

ldsc_rg.premunge_fgs.chrom_col

Column name for chromosome (if needed for variant parsing).

ldsc_rg.premunge_fg.pos_col

Column name for variant position (if needed for variant parsing).

N.B. the pipeline will also map CHROM_POS --> rsid if necessary, but using a build 38 mapping. If rsid_col is passed, the content of chrom_col and pos_col is ignored whatever it is. It can also be left blank. If one wants to use chrompos notation instead as input rsid_col should be left blank.

E.g. In this case #chrom and pos are used to build rsids

If meta_other != meta_fg then once has to update all the columns accordingly

Input sumstats

The input files and sumstats need to be formatted as tab separated format (TSV) with 3 columns (phenocode,path_to_sumstats, N_total). For example:

Outputs:

The pipeline produces the following outputs:

  • "ldsc_rg.herit_tsv" --> TSV file with heritabilites for all sumstats

  • "ldsc_rg.herit_log" --> log file for heritabilites

  • "ldsc_rg.corr_summary" --> TSV with genetic correlations

  • "ldsc_rg.corr_log" --> log file for correlations

  • "dsc_rg.munged_ss" --> the munged summarystats in LDSC format

If the pipeline is run to have only heritabilites, the corr_summary and corr_log file will still be output, but they will be duplicated of the heritabilites file

Last updated

Was this helpful?