Skip to content

Step 1.2: make maf optional (derived from af) in univariate and multivariate pipelines#515

Merged
gaow merged 3 commits into
StatFunGen:mainfrom
Yining97:rss-top-loci-af-2
Jun 11, 2026
Merged

Step 1.2: make maf optional (derived from af) in univariate and multivariate pipelines#515
gaow merged 3 commits into
StatFunGen:mainfrom
Yining97:rss-top-loci-af-2

Conversation

@Yining97

@Yining97 Yining97 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

maf is now optional in both univariate_analysis_pipeline and multivariate_analysis_pipeline, with af as the directional input. When af is given, the MAF used by maf_cutoff is computed from it (min(af, 1-af)); a passed-in maf is a fallback only and is never written to top_loci. Existing calls that pass maf behave the same.

This also closes a CI break from #513, which renamed postprocess_finemapping_fits's maf argument to af but missed the multivariate caller (it still passed maf and failed test_multivariate_pipeline.R).

Yining97 and others added 2 commits June 11, 2026 11:26
…erived from af)

Step 1.2 follow-up to rss-top-loci-af. In univariate_analysis_pipeline():
- maf becomes optional (still 3rd positional arg; existing callers unaffected).
- af is the single source of truth: when af is supplied, the maf_cutoff filtering
  MAF is derived from it (min(af, 1-af)); a supplied maf is a fallback only and,
  if it disagrees with the af-derived value, af wins (with a warning).
- neither af nor maf supplied + maf_cutoff set -> clear error; maf is never exported.
- roxygen regenerated; man page updated.

Tests (test_univariate_pipeline.R): af-only -> derived; maf-only -> af NA;
both-disagree -> warning; neither+maf_cutoff -> error; neither+no-cutoff -> OK;
plus a behavioral test that af-derived MAF filters identically to the equivalent
maf (sub-cutoff variant removed; af>0.5 ensures the minor-allele derivation).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…finemapping_fits

The maf->af rename in StatFunGen#513 missed multivariate_analysis_pipeline, which broke
test_multivariate_pipeline.R. The multivariate maf is directionless and only
used for filtering, so leave af unset (top_loci$af = NA) instead of relabeling
it. Added a test.

Pending follow-up: give multivariate_analysis_pipeline its own optional
directional af input so it can export a real af, like univariate does.
Comment thread R/univariate_pipeline.R
#' only for \code{maf_cutoff} filtering; never exported.
#' @param maf Optional vector of minor allele frequencies for each variant in X,
#' used ONLY for \code{maf_cutoff} filtering and never exported. \code{af} is
#' the single source of truth: when \code{af} is supplied the filtering MAF is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yining97 please fix this as we discussed.

Same af handling as univariate_analysis_pipeline: maf optional, optional
directional af exported as top_loci$af, filtering MAF derived from af when
supplied (maf is a fallback, never exported), error when neither is given with
maf_cutoff. Updates the old maf-required validation tests and adds an af-supplied
test. test_multivariate_pipeline.R: 0 fail / 53 pass.
@Yining97 Yining97 changed the title Step 1.2: make af the single source of truth in univariate_analysis_pipeline Step 1.2: make maf optional (derived from af) in univariate and multivariate pipelines Jun 11, 2026
@gaow gaow merged commit 189396d into StatFunGen:main Jun 11, 2026
4 of 5 checks passed
@Yining97 Yining97 deleted the rss-top-loci-af-2 branch June 11, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants