screen_forward_max_region: Forward Scan of the RAS Profile

View source: R/scan.R

screen_forward_max_regionR Documentation

Forward Scan of the RAS Profile

Description

The Stage-1 forward scan on the hold-out half of the sample. At every grid position (every skip1 SNPs) windows of min_window_size, min_window_size + skip2, ... up to max_window_size SNPs are formed, each window's weighted dosage score is tested against the phenotype, and the smallest p-value is recorded as the profile value. SNP columns are streamed from the .rasbin file and the weighted scores are accumulated on the fly, so neither the genotype matrix nor a score matrix is held in memory. The pure-R, in-memory implementation is screen_forward_max_region_original together with compute_pgs_matrix.

Usage

screen_forward_max_region(
  rasbin_path,
  weights,
  this.leftout,
  this.df,
  is_continuous,
  covariate_formula,
  skip1 = 10,
  skip2 = 20,
  min_window_size = 5,
  max_window_size = 100,
  chunk_snps = 5000
)

Arguments

rasbin_path

Character. Path to the .rasbin genotype file.

weights

Numeric vector of length N (one weight per variant), typically the Estimate column of compute_gwas_weights or aligned external weights from ras_harmonize_sumstats.

this.leftout

Integer vector. 1-based row indices of the samples to scan (the hold-out half, or all samples for external weights).

this.df

Data frame with one row per element of this.leftout, holding the phenotype in a column named phenotype2 and the covariates named in covariate_formula.

is_continuous

Logical. TRUE: exact Frisch-Waugh-Lovell regression of the window score on the phenotype after the covariates. FALSE: Rao score test of the window score in a logistic model with the covariates.

covariate_formula

Character. Right-hand side listing the covariates, for example "age + sex".

skip1

Integer. Grid stride in SNPs. Default 10.

skip2

Integer. Window growth step in SNPs. Default 20.

min_window_size, max_window_size

Integer. Smallest and largest window in SNPs. Default 5 and 100.

chunk_snps

Integer. SNP columns read per disk chunk. Default 5000.

Value

Numeric vector with one -\log_{10}(p) value per grid position, ceiling(N / skip1) values in total.

See Also

ras_scan, which averages this scan over repetitions; ras_scan_external; screen_forward_max_region_original.


RAS documentation built on Nov. 3, 2026, 1:07 a.m.