Skip to contents

Optional step 4 of the cTWAS pipeline (default-off region merging). A gene whose cis window straddles an LD-block boundary (a boundary_genes member) is split across two regions in the first-pass fine-mapping. This step selects the high-PIP boundary genes, merges each one's adjacent regions into a single region, re-runs fine-mapping on the merged regions, and splices the updated results back into the finemapCtwasRegions output. Thin wrapper over ctwas::postprocess_region_merging() (or ctwas::postprocess_region_merging_noLD() when the inputs carry no LD loaders).

Usage

mergeCtwasBoundaryRegions(
  finemapResult,
  pipThresh = 0.5,
  filterCs = FALSE,
  maxSNP = Inf,
  L = 5L,
  ncore = 1L,
  ...
)

Arguments

finemapResult

A list returned by finemapCtwasRegions. Must carry finemap_res, susie_alpha_res, region_data, region_info, z_snp, z_gene, weights, snp_map, param, and — on the LD path — LD_map plus the LD_loader_fun / snpinfo_loader_fun closures (all retained by finemapCtwasRegions).

pipThresh

Numeric (length 1). PIP threshold for selecting which boundary genes to merge (select_boundary_genes pip_thresh). Default 0.5.

filterCs

Logical (length 1). Require the gene to be in a credible set to be selected (select_boundary_genes filter_cs). Default FALSE.

maxSNP

Numeric (length 1). Per-merged-region SNP cap. Default Inf.

L

Integer. Max number of single effects for the merged-region re-fine-mapping (LD path only). Default 5.

ncore

Number of cores. Default 1.

...

Forwarded to the underlying ctwas postprocess function.

Value

The finemapResult list with finemap_res, susie_alpha_res, region_data, region_info, LD_map, and snp_map replaced by the post-merge ("updated") values, plus a merge_res element carrying the full ctwas postprocess output. When no boundary gene clears pipThresh, ctwas returns the inputs as the "updated" values, so the result is effectively unchanged.