| ras_weights_from_sumstats | R Documentation |
Turns an external GWAS's effect estimates into a weight vector aligned to a
local genotype matrix, one weight per genotype column, in order. This is the
matcher underneath ras_harmonize_sumstats; call that instead
unless you have already settled the naming and build questions yourself.
ras_weights_from_sumstats(
sumstats,
map,
cols = list(),
drop_ambiguous = TRUE,
on_or = TRUE,
match_by = c("id", "pos"),
match_min_prop = 0.2,
build_check = TRUE,
target_af = NULL,
af_tol = 0.2,
block_size = 500L,
pos_fallback = NULL
)
sumstats |
Path to a whitespace/tab-delimited file, or a data frame.
Column names are auto-detected across PLINK 1/2 and GWAS-SSF conventions;
GWAS Catalog |
map |
Data frame with columns |
cols |
Optional named list overriding auto-detected columns, e.g.
|
drop_ambiguous |
Logical. Drop strand-ambiguous A/T and C/G variants
(default |
on_or |
Logical. If the file carries |
match_by |
The two keys are not interchangeable and neither is redundant. An rsID
survives a change of genome build but is NOT unique – multi-allelic sites
share one, and a real WGS file has about 1.25\
|
match_min_prop |
Numeric. Stop if fewer than this proportion of the
smaller dataset ends up with a usable weight (default 0.2, the guard
|
build_check |
Logical. Verify that ID-matched variants agree on
position (default |
target_af |
Optional numeric vector, length |
af_tol |
Numeric. Absolute frequency difference above which a variant is counted as discordant in that report (default 0.20). |
block_size |
Integer. Window, in variants along the local map, for the
match-rate profile returned in |
pos_fallback |
Deprecated, kept so old calls still run. |
The alignment rule is deliberately conservative:
w_j = +\beta_j when the summary statistics' effect allele is the
allele the local dosage counts (map$A1);
w_j = -\beta_j when it is the other allele (map$A2);
w_j = 0 when the variant is absent, the alleles cannot be
reconciled, or (with drop_ambiguous = TRUE) the variant is
strand-ambiguous.
Strand-ambiguous (A/T, C/G) variants are removed rather than rescued. Rescuing them requires a frequency rule, which is a modelling decision this layer does not make.
A list with
weights |
Numeric vector of length |
qc |
The reproducible harmonisation QC table (see
|
report |
Per-status variant counts. |
detail |
One row per map variant: status, matching route, sign, weight. |
matched_by |
Counts matched by ID, by ID+alleles, and by position. |
build |
The build gate's verdict. |
blocks |
Match rate along the chromosome, in |
af |
The allele-frequency comparison, when |
ras_harmonize_sumstats for the driver that chooses the
naming/build route first; ras_scan_external to scan with
the resulting weights.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.