Last updated: 2026-11-04

Checks: 7 0

Knit directory: coderepo-local/

This reproducible R Markdown analysis was created with workflowr (version 1.7.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20251109) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version fe649c2. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    Rplots.pdf
    Ignored:    analysis/.DS_Store
    Ignored:    analysis/.Rhistory
    Ignored:    code/.DS_Store
    Ignored:    code/.Rhistory
    Ignored:    code/revision_simulations/.DS_Store
    Ignored:    data/appendixB/
    Ignored:    data/dynamic_eQTL_real/
    Ignored:    data/revision_simulations/
    Ignored:    data/toy_example/
    Ignored:    output/dynamic_eQTL_real/
    Ignored:    output/pdf/
    Ignored:    output/playwright/
    Ignored:    output/revision_simulations/
    Ignored:    scripts/

Untracked files:
    Untracked:  code/revision_simulations/internal/per_unit_enhancer_enrichment/
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/compare_corshrink_versions.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/diagnose_discordant_calls.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/diagnose_smooth_mismatch.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/extract_perunit_lfdr.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/plot_call_venns.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/plot_class_variograms.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/plot_corshrink_result.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/plot_corshrink_versions.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/plot_cs_vs_diagonal.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/plot_day0_day1_distribution.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/plot_mechanism_summary.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/plot_perunit_variogram.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/plot_strober_concordance.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/plot_three_models.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/prepare_reference_sets.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/prototype_corshrink.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/recover_design_factor.R
    Untracked:  code/revision_simulations/internal/per_unit_expression_correlation/test_corshrink_reimplementation.R
    Untracked:  code/revision_simulations/internal/posterior_interval_coverage/
    Untracked:  code/revision_simulations/internal/r3_stage1_method_comparison/plot_pi0_before_after.py

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/matched_fash_linear_real_data.rmd) and HTML (docs/matched_fash_linear_real_data.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd fe649c2 Ziang Zhang 2026-11-04 Clean up unlinked internal pages, rename analysis pages, and polish website prose
html fe649c2 Ziang Zhang 2026-11-04 Clean up unlinked internal pages, rename analysis pages, and polish website prose

Analysis definition

Both FASH fits use the same 1,009,173 time-specific-PC effect estimates, standard errors, exact constant null, 52-point one-day predictive-SD grid, betaprec=0, pred_step=1, penalty=10, corrected BF adjustment, and cumulative-lfdr FDR 0.05.

For FASH-linear,

\[ \beta_j(t)=a_j+b_j(t-t_{j,\min}),\qquad b_j\sim\sum_{k=1}^{51}\pi_k N\!\left(0,\left\{s_k/\mathrm{pred\_step}\right\}^2\right), \]

where \(s_k=\operatorname{SD}(b_j\,\mathrm{pred\_step})\) is sd_linear_step. The exact-null component is \(s_0=0\). Its 51 positive values are numerically identical to the IWP1 psd grid.

The fitting code is shown below.

# Match the predictive-SD grid and fitting options to the IWP1 reference fit.
matched_grid <- as.numeric(current_raw$psd_grid)
matched_pred_step <- as.numeric(current_raw$settings$pred_step)
matched_penalty <- as.integer(current_raw$settings$penalty)
matched_betaprec <- as.numeric(current_raw$settings$betaprec)
matched_likelihood <- as.character(current_raw$settings$likelihood)

# Fit the exact-null plus 51-component linear-slope mixture.
linear_raw <- fit_linear_mixture_fash_from_stats(
  statistics = statistics,
  grid = matched_grid,
  pred_step = matched_pred_step,
  penalty = matched_penalty,
  statistic_time_span = 15,
  n_time = 16
)

# Record the matched likelihood settings in the fitted object.
linear_raw$settings$betaprec <- matched_betaprec
linear_raw$settings$likelihood <- matched_likelihood

# Apply the same corrected Bayes-factor adjustment used for FASH-IWP1.
linear_bf <- BF_update_linear_mixture_fash(linear_raw)
settings_to_report <- matched_settings_table[, c(
  "setting", "fash_iwp1", "fash_linear", "alignment"
)]
names(settings_to_report) <- c(
  "Setting", "FASH-IWP1", "FASH-linear", "Alignment"
)
render_scrollable_table_matched(
  settings_to_report,
  caption = "Table 1. Matched data, prior-scale, fitting, and discovery settings.",
  minimum_width = "1040px"
)
Table 1. Matched data, prior-scale, fitting, and discovery settings.
Setting FASH-IWP1 FASH-linear Alignment
Tested units 1,009,173 1,009,173 Identical
Time grid 0:15 0:15 Identical
Likelihood Gaussian Gaussian Identical
Null trajectory Unrestricted constant Unrestricted constant Identical
Alternative family IWP1 Gaussian process mixture Zero-centered Gaussian slope mixture Matched scale; different covariance geometry
Scale parameter psd SD(beta * pred_step) Equivalent one-step SD
Grid components 52 52 Identical
Positive grid range 0.006738 to 1.0 0.006738 to 1.0 Identical
pred_step 1 1 Identical
betaprec 0 0 Identical
penalty 10 10 Identical
IWP basis functions 20 Not used: exact rank-one linear kernel Not applicable
FDR rule Cumulative lfdr at 0.05 Cumulative lfdr at 0.05 Identical

The scientific selection rules used below are:

alpha <- 0.05

iwp1_bf_indices <- select_cumulative_lfdr_calls(
  fash_iwp1_bf$lfdr,
  alpha
)
linear_bf_indices <- select_cumulative_lfdr_calls(
  fash_linear_bf$lfdr,
  alpha
)
strober_quadratic_discoveries <- subset(strober_quadratic, eFDR <= alpha)
strober_linear_discoveries <- subset(strober_linear, eFDR <= alpha)

Discovery counts

After BF adjustment, FASH-IWP1 identifies 9,214 pairs, 1,176 genes, and 9,148 unique variants. FASH-linear identifies 14,902 pairs, 1,663 genes, and 14,761 unique variants.

render_scrollable_table_matched(
  discovery_counts_display,
  caption = "Table 2. Raw and BF-adjusted cumulative-lfdr FDR-0.05 discovery counts.",
  digits = 6L,
  minimum_width = "820px"
)
Table 2. Raw and BF-adjusted cumulative-lfdr FDR-0.05 discovery counts.
Method Adjustment Pairs Genes Unique variants Estimated pi0
FASH-IWP1 Raw 43,860 3,258 42,893 0.42899
FASH-IWP1 BF-adjusted 9,214 1,176 9,148 0.938159
FASH-linear Raw 60,188 3,863 58,570 0.457235
FASH-linear BF-adjusted 14,902 1,663 14,761 0.919253

The directional coverage is the fraction of each IWP discovery set also found by FASH-linear.

render_scrollable_table_matched(
  iwp1_linear_proportion_display,
  caption = "Table 3. BF-adjusted FASH-IWP1 discoveries covered by BF-adjusted FASH-linear at the three reporting levels.",
  minimum_width = "860px"
)
Table 3. BF-adjusted FASH-IWP1 discoveries covered by BF-adjusted FASH-linear at the three reporting levels.
Level FASH-linear FASH-IWP1 Intersection FASH-IWP1 covered by linear
Pairs 14,902 9,214 8,530 92.6%
Genes 1,663 1,176 1,112 94.6%
Variants 14,761 9,148 8,468 92.6%
render_scrollable_table_matched(
  iwp2_linear_proportion_display,
  caption = "Table 4. BF-adjusted FASH-IWP2 discoveries covered by BF-adjusted FASH-linear at the three reporting levels.",
  minimum_width = "860px"
)
Table 4. BF-adjusted FASH-IWP2 discoveries covered by BF-adjusted FASH-linear at the three reporting levels.
Level FASH-linear FASH-IWP2 Intersection FASH-IWP2 covered by linear
Pairs 14,902 44 21 47.7%
Genes 1,663 9 6 66.7%
Variants 14,761 44 21 47.7%

FASH-linear covers 92.6% of the FASH-IWP1 pair discoveries and 47.7% of the FASH-IWP2 pair discoveries.

Four-method overlap

The following Venn diagrams extend the real-data comparison by adding BF-adjusted FASH-linear to Strober quadratic, Strober linear, and BF-adjusted FASH-IWP1. Strober discoveries use eFDR at most 0.05.

pair_sets <- list(
  `Strober quad.` =
    venn_sets$`Gene-variant pairs`$`Strober quadratic`,
  `Strober linear` =
    venn_sets$`Gene-variant pairs`$`Strober linear`,
  `FASH-linear` =
    venn_sets$`Gene-variant pairs`$`FASH-linear BF`,
  `FASH-IWP1` =
    venn_sets$`Gene-variant pairs`$`FASH-IWP1 BF`
)

ggVennDiagram::ggVennDiagram(
  pair_sets,
  label = "count",
  label_alpha = 0,
  label_size = 3.7,
  set_size = 3.8,
  edge_size = 0.8
) +
  ggplot2::scale_fill_gradient(low = "#f7fbff", high = "#2171b5") +
  ggplot2::theme(
    legend.position = "right",
    plot.margin = ggplot2::margin(20, 40, 20, 40)
  )
Figure 1. Gene-variant-pair overlap among Strober quadratic, Strober linear, BF-adjusted FASH-IWP1, and BF-adjusted FASH-linear. FASH sets use cumulative-lfdr FDR 0.05; Strober sets use eFDR 0.05.

Figure 1. Gene-variant-pair overlap among Strober quadratic, Strober linear, BF-adjusted FASH-IWP1, and BF-adjusted FASH-linear. FASH sets use cumulative-lfdr FDR 0.05; Strober sets use eFDR 0.05.

Version Author Date
fe649c2 Ziang Zhang 2026-11-04
gene_sets <- list(
  `Strober quad.` = venn_sets$Genes$`Strober quadratic`,
  `Strober linear` = venn_sets$Genes$`Strober linear`,
  `FASH-linear` = venn_sets$Genes$`FASH-linear BF`,
  `FASH-IWP1` = venn_sets$Genes$`FASH-IWP1 BF`
)

ggVennDiagram::ggVennDiagram(
  gene_sets,
  label = "count",
  label_alpha = 0,
  label_size = 3.7,
  set_size = 3.8,
  edge_size = 0.8
) +
  ggplot2::scale_fill_gradient(low = "#f7fbff", high = "#2171b5") +
  ggplot2::theme(
    legend.position = "right",
    plot.margin = ggplot2::margin(20, 40, 20, 40)
  )
Figure 2. Gene-level overlap among Strober quadratic, Strober linear, BF-adjusted FASH-IWP1, and BF-adjusted FASH-linear. A gene enters a set when at least one of its tested variants is discovered by that method.

Figure 2. Gene-level overlap among Strober quadratic, Strober linear, BF-adjusted FASH-IWP1, and BF-adjusted FASH-linear. A gene enters a set when at least one of its tested variants is discovered by that method.

Version Author Date
fe649c2 Ziang Zhang 2026-11-04
variant_sets <- list(
  `Strober quad.` = venn_sets$Variants$`Strober quadratic`,
  `Strober linear` = venn_sets$Variants$`Strober linear`,
  `FASH-linear` = venn_sets$Variants$`FASH-linear BF`,
  `FASH-IWP1` = venn_sets$Variants$`FASH-IWP1 BF`
)

ggVennDiagram::ggVennDiagram(
  variant_sets,
  label = "count",
  label_alpha = 0,
  label_size = 3.7,
  set_size = 3.8,
  edge_size = 0.8
) +
  ggplot2::scale_fill_gradient(low = "#f7fbff", high = "#2171b5") +
  ggplot2::theme(
    legend.position = "right",
    plot.margin = ggplot2::margin(20, 40, 20, 40)
  )
Figure 3. Unique-variant overlap among Strober quadratic, Strober linear, BF-adjusted FASH-IWP1, and BF-adjusted FASH-linear. Each rsID is counted once per method, regardless of the number of associated genes.

Figure 3. Unique-variant overlap among Strober quadratic, Strober linear, BF-adjusted FASH-IWP1, and BF-adjusted FASH-linear. Each rsID is counted once per method, regardless of the number of associated genes.

Version Author Date
fe649c2 Ziang Zhang 2026-11-04

The BF-adjusted IWP1–linear intersections are 8,530 pairs, 1,112 genes, and 8,468 unique variants.

Reproducibility

To reproduce the matched FASH-linear fit and overlap summaries:

OMP_NUM_THREADS=1 \
OPENBLAS_NUM_THREADS=1 \
MKL_NUM_THREADS=1 \
VECLIB_MAXIMUM_THREADS=1 \
BLIS_NUM_THREADS=1 \
Rscript --vanilla \
  code/revision_simulations/internal/matched_fash_linear_real_data/\
run_matched_fash_linear_real_data.R

Rscript --vanilla \
  code/revision_simulations/internal/matched_fash_linear_real_data/\
build_iwp_overlap_proportion_cache.R

Rscript --vanilla -e \
  'workflowr::wflow_build("analysis/matched_fash_linear_real_data.rmd", local = TRUE)'

sessionInfo()
R version 4.5.1 (2025-06-13)
Platform: aarch64-apple-darwin20
Running under: macOS Sequoia 15.6.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.1

locale:
[1] en_CA/en_CA/en_CA/C/en_CA/en_CA

time zone: America/Chicago
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] workflowr_1.7.2

loaded via a namespace (and not attached):
 [1] sass_0.4.10         generics_0.1.4      stringi_1.8.9      
 [4] digest_0.6.39       magrittr_2.0.5      evaluate_1.0.5     
 [7] grid_4.5.1          RColorBrewer_1.1-3  fastmap_1.2.0      
[10] rprojroot_2.1.1     jsonlite_2.0.0      processx_3.8.6     
[13] whisker_0.4.1       ps_1.9.1            promises_1.5.0     
[16] httr_1.4.7          scales_1.4.0        codetools_0.2-20   
[19] jquerylib_0.1.4     cli_3.6.6           rlang_1.2.0        
[22] withr_3.0.3         cachem_1.1.0        yaml_2.3.12        
[25] otel_0.2.0          tools_4.5.1         dplyr_1.1.4        
[28] ggplot2_4.0.3       httpuv_1.6.16       vctrs_0.7.3        
[31] R6_2.6.1            lifecycle_1.0.5     git2r_0.36.2       
[34] stringr_1.6.0       fs_1.6.6            pkgconfig_2.0.3    
[37] callr_3.7.6         pillar_1.11.1       bslib_0.9.0        
[40] later_1.4.4         gtable_0.3.6        glue_1.8.1         
[43] Rcpp_1.1.1-1.1      xfun_0.55           tibble_3.3.0       
[46] tidyselect_1.2.1    rstudioapi_0.17.1   knitr_1.50         
[49] dichromat_2.0-0.1   farver_2.1.2        htmltools_0.5.9    
[52] rmarkdown_2.30      labeling_0.4.3      ggVennDiagram_1.5.4
[55] compiler_4.5.1      getPass_0.2-4       S7_0.2.2