Skip to content

Latest commit

 

History

History
88 lines (73 loc) · 2.1 KB

polyfun_command_reference.md

File metadata and controls

88 lines (73 loc) · 2.1 KB

PolyFun + Borzoi Fine-Mapping — Commands

Functionally-informed fine-mapping with PolyFun-Sniff

Placeholders: <ld_dir>, <pheno>, <neff>, <annot>, <chr>, <start>, <end>.

Step 0 - Munge summary statistics

python munge_polyfun_sumstats.py \
	--sumstats bolt_337K_unrelStringentBrit_MAF0.001_v3.<pheno>.bgen.stats.gz \
	--n 337000 \
	--out munged_stats/<pheno>.sumstats_munged.parquet \
	--min-info 0.6 \
	--min-maf 0.001

Step 1 — compute LD-scores (per chromosome, trait-independent)

python compute_ldscores_from_ld.py \
    --annot <annot>.<chr>.annot.parquet \
    --ukb \
    --ld-dir <ld_dir>/ \
    --out <annot>.<chr>.l2.ldscore.parquet

Step 2 — Estimate per-SNP h² (Borzoi annotations enter here)

python polyfun.py \
    --compute-h2-L2 \
    --output-prefix <pheno> \
    --sumstats munged_stats/<pheno>.sumstats_munged.parquet \
    --ref-ld-chr <baseline_annot.>[,<borzoi_annot.>] \
    --w-ld-chr weights.UKB. \
    --allow-missing

Step 3 — LD-scores for bins (per chromosome, 1–22)

python polyfun.py \
    --compute-ldscores \
    --output-prefix <pheno> \
    --ld-ukb \
    --ld-dir <ld_dir>/ \
    --chr <chr> \
    --allow-missing

Step 4 — Re-estimate per-SNP h² (produces snpvar_constrained.gz priors)

python polyfun.py \
    --compute-h2-bins \
    --output-prefix <pheno> \
    --sumstats munged_stats/<pheno>.sumstats_munged.parquet \
    --w-ld-chr weights.UKB. \
    --allow-missing

Fine-map — SuSiE (per LD region: chr_start_end.npz)

python finemapper.py \
    --ld <ld_dir>/chr<chr>_<start>_<end>.npz \
    --sumstats <pheno>.<chr>.snpvar_constrained.gz \
    --n <neff> \
    --chr <chr> \
    --start <start> \
    --end <end> \
    --method susie \
    --max-num-causal 10 \
    --allow-missing \
    --out susie/<pheno>.<chr>.<start>.<end>.gz

Aggregate (per chromosome)

python aggregate_finemapper_results.py \
    --sumstats munged_stats/<pheno>.sumstats_munged.parquet \
    --out-prefix susie/<pheno> \
    --chr <chr> \
    --out susie-agg/<pheno>.<chr>.txt