Builds and validates the object that tells glow_scan_chunk() which per-window artifacts to persist. The always-on flat results table is mandatory (it is the one load-bearing output); every other artifact is opt-in and defaults off, because at fine window scale the per-window sidecars would dominate storage.

glow_output_policy(
  write_flat_table = TRUE,
  write_evidence = FALSE,
  write_staar_detail = FALSE,
  write_result_objects = FALSE
)

# S3 method for class 'glow_output_policy'
print(x, ...)

Arguments

write_flat_table

Logical (default TRUE). The compact one-row- per-window results table. Must be TRUE; FALSE is rejected.

write_evidence

Logical (default FALSE). Per-window evidence packets (post-filter variant table + per-unit B/PI/Z/weights). ~1.6 KB per window, so tens of GB at fine WGS scale — keep off there.

write_staar_detail

Logical (default FALSE). The full per-window STAAR::STAAR output grid. Requires a staar_context at the engine (validated in glow_scan_chunk()).

write_result_objects

Logical (default FALSE). The per-window glow_test_result S3 objects (RDS). Redundant with the flat table for most uses.

x

A glow_output_policy object.

...

Ignored.

Value

An S3 object of class "glow_output_policy": a named list of the four logical flags.

Details

This object records persistence intent only. It deliberately does not carry a STAAR switch: whether STAAR runs is decided by passing a staar_context to glow_scan_chunk() (a non-NULL context turns STAAR on for both glow_scan_chunk() and the single-region GLOW test). Consequently write_staar_detail = TRUE is only meaningful alongside a STAAR context, and that cross-check is enforced by glow_scan_chunk() — not here — so there is a single source of truth for "STAAR on". Constructing a policy with write_staar_detail = TRUE and no context is therefore allowed and does not error at construction time.

The size safety at fine window scale comes from the sidecar flags defaulting off plus glow_scan_chunk() gating in-memory accumulation on them (with the default policy glow_scan_chunk() never builds the per-window sidecar lists) — not from any size or window-count check here. This constructor only validates each flag is a scalar non-NA logical and enforces write_flat_table = TRUE.

Examples

# Lean default: only the flat table.
glow_output_policy()
#> <glow_output_policy>
#>   flat_table     : on (always; the load-bearing output)
#>   evidence       : off 
#>   staar_detail   : off (needs a staar_context at the engine)
#>   result_objects : off 

# Detailed policy: flat table + evidence packets (window count modest).
glow_output_policy(write_evidence = TRUE)
#> <glow_output_policy>
#>   flat_table     : on (always; the load-bearing output)
#>   evidence       : on 
#>   staar_detail   : off (needs a staar_context at the engine)
#>   result_objects : off