Builds the flat per-region drill-down data.frame from one region's evidence packet: one row per post-Component-3-filter raw variant, with unit-level fields repeated across the variants composing the same post-collapse test unit and NA in the unit-level + weight columns for LD-removed variants.

glow_drilldown_df(e)

Arguments

e

One region's evidence-packet entry, i.e. the value of evidence_chr{N}.rds[[label]] as produced by the per-chr/-chunk GLOW runner. Required sub-objects:

e$post_filter

data.frame, one row per post-Component-3 raw variant. Required columns: variant_id (integer), chr, pos (integer), ref, alt (character), MAF, MAC (numeric), ld_kept (logical), collapse_group (integer index into e$test_units, NA when ld_kept = FALSE). Optional: rsid (character; NA-filled if absent).

e$test_units

list of length n_after_collapse with parallel per-unit fields. Required: component_post_filter_idx (list of integer vectors, one per unit), is_collapsed (logical), MAF, B, PI, Z_standard, pvalue_standard (numeric), weights (n_schemes x n_after_collapse matrix; rownames are the scheme labels and become the suffixes of the output weight_<scheme> columns). Optional: MAC (NA-filled if absent), Z_SPA, pvalue_SPA (if NULL, the output Z_SPA / pvalue_SPA columns are all NA – these are binary-trait-only fields).

Value

A data.frame with nrow == n_after_filter rows. Column count is ~31 (exact width depends on the scheme count via rownames(e$test_units$weights)). Row order matches the order of e$post_filter (genomic order within the region).

Details

Per-variant identity/metadata (rsid, chr, pos, ref, alt, MAF, MAC, ld_kept) is reported at the per-variant level; the post-collapse aggregate, where one exists, is explicitly prefixed unit_* (only MAF/MAC have one, hence unit_MAF / unit_MAC; unit_idx / unit_n_components / unit_is_collapsed describe the unit-membership mapping itself). Test results and unit parameters (Z_standard, pvalue_standard, Z_SPA, pvalue_SPA, B, PI, weight_<scheme>) are unit-level – one value per post-collapse test unit, repeated across that unit's components, NA for LD-removed rows. The number of weight_<scheme> columns follows rownames(e$test_units$weights).