Repository navigation
wavelet screen + multi-region pipeline - #18
Merged
Merged
Conversation
Fix 1 (min_bins_per_ebnm_group): merge consecutive ebnm groups below a minimum bin count threshold in mf_prior_scale_mixture; prevents single-bin overfitting on coarse wavelet scales (lev 1 = 1 bin, lev 2 = 2 bins). Fix 2 (ebnm_null_prior_weight): pass optional prior_weights to ebnm_point_* to enforce a non-zero null component weight, analogous to mixture_null_weight on the mixsqp path. Fix 3 (cs_min_lead_pip): post-process the fit$sets$cs list to remove any credible set whose lead-SNP PIP falls below a threshold; targets diffuse extra CS formed by null effects in the per_scale_normal path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ebnm_point_normal has no prior_weights argument; the null weight constraint must be applied post-hoc by flooring fitted_g$pi[1] to ebnm_null_prior_weight and renormalizing slab weights. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mf_low_count_indices was called after mf_quantile_normalize, so formerly-zero wavelet columns got median(|col|) ≈ 0.67 after qnorm and the threshold check (median ≤ 0) never fired. Near-zero-count modalities (e.g. Pois(0.001)) were unmasked → spurious log-BF → FDR inflation. Fix: compute lowc_idx on raw DWT output, then apply qnorm, then zero the flagged columns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When a subset of n samples from N3finemapping$X contains constant columns (xtx_diag_list[[m]] == 0), dividing XtR by zero produced NaN in bhat_m. This propagated through mf_em_likelihood_per_scale into colSums(abs(L)) == 0, which returned NA instead of TRUE/FALSE, causing 'missing value where TRUE/FALSE needed' in mf_em_m_step_per_scale. Fix: guard both mf_per_outcome_bhat_shat and refresh_iter_cache with a zero-pw mask that sets bhat=0 / shat=1 for constant predictors, matching the treatment already applied to low-count wavelet columns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…esult Implements OpenSpec add-wavelet-pipeline-and-multiregion (meeting 2026-10-06). mfsusie_screen(): wavelet-level marginal association screen for a single region. Runs mf_dwt() + optional mf_quantile_normalize() per outcome, computes Pearson-correlation t-statistics over all (wavelet col x outcome x SNP) triples, returns min_pval and passed flag at configurable p_cutoff (default 1e-5). Scalar outcomes (T_m=1) are skipped. mfsusie_pipeline(): multi-region entry point. Accepts a list of regions (each with X, Y, pos, region_id), optionally screens with mfsusie_screen(), fits mfsusie() on passing regions, returns results + analysis funnel. Supports parallel execution via parallel::mclapply. Parameters: use_wavelet_filter, wavelet_qnorm, p_cutoff, n_cores, verbose. mfsusie_empty_result(): structured empty mfsusie object (class mfsusie/susie) returned for screen-rejected or fit-failed regions. Carries region_id, status, and min_pval in $screen_result. mfsusie_is_empty(): predicate used by predict/coef/fitted/print guards. Guards added to predict.mfsusie, coef.mfsusie, fitted.mfsusie, print.mfsusie so empty results do not error downstream. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- summary.mfsusie: add mfsusie_is_empty() guard (CONFIRMED: crashed on empty result) - mfsusie_screen: switch cor() to pairwise.complete.obs (PLAUSIBLE: listwise deletion shrank effective n across all pairs when any wavelet column had NAs) - mfsusie_pipeline: convert mclapply try-error returns to fit_failed empty results (PLAUSIBLE: OOM-killed workers returned try-error, not NULL, crashing the funnel-build loop) - tests: add summary() empty-result test; add mixed-pass/reject two-region pipeline test to cover funnel assembly and results list consistency (CONFIRMED: make_regions() was defined but never wired into a test block) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: per_scale_normal FDR fixes, lowc_wc ordering, and zero-xtx guard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.