Last updated: 2025-03-27

Checks: 6 1

Knit directory: hruban_wflow/

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


The R Markdown is untracked by Git. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish to commit the R Markdown file and build the HTML.

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(20250319) 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 6dc79eb. 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

Untracked files:
    Untracked:  README.Rmd
    Untracked:  analysis/ext-fig1.Rmd
    Untracked:  analysis/ext-fig10.Rmd
    Untracked:  analysis/ext-fig11.Rmd
    Untracked:  analysis/ext-fig12.Rmd
    Untracked:  analysis/ext-fig13.Rmd
    Untracked:  analysis/ext-fig14.Rmd
    Untracked:  analysis/ext-fig15.Rmd
    Untracked:  analysis/ext-fig16a.Rmd
    Untracked:  analysis/ext-fig16b.Rmd
    Untracked:  analysis/ext-fig17.Rmd
    Untracked:  analysis/ext-fig18.Rmd
    Untracked:  analysis/ext-fig19.Rmd
    Untracked:  analysis/ext-fig20.Rmd
    Untracked:  analysis/ext-fig21a.Rmd
    Untracked:  analysis/ext-fig21b.Rmd
    Untracked:  analysis/ext-fig22a.Rmd
    Untracked:  analysis/ext-fig22b.Rmd
    Untracked:  analysis/ext-fig23a.Rmd
    Untracked:  analysis/ext-fig23b.Rmd
    Untracked:  analysis/ext-fig24.Rmd
    Untracked:  analysis/ext-fig2a.Rmd
    Untracked:  analysis/ext-fig2b.Rmd
    Untracked:  analysis/ext-fig3.Rmd
    Untracked:  analysis/ext-fig4.Rmd
    Untracked:  analysis/ext-fig5.Rmd
    Untracked:  analysis/ext-fig6.Rmd
    Untracked:  analysis/ext-fig7.Rmd
    Untracked:  analysis/ext-fig8.Rmd
    Untracked:  analysis/ext-fig9.Rmd
    Untracked:  analysis/fig1a.Rmd
    Untracked:  analysis/fig1b.Rmd
    Untracked:  analysis/fig2a.Rmd
    Untracked:  analysis/fig2b.Rmd
    Untracked:  analysis/fig2c.Rmd
    Untracked:  analysis/fig3a.Rmd
    Untracked:  analysis/fig3b.Rmd
    Untracked:  analysis/fig4.Rmd
    Untracked:  analysis/fig5.Rmd
    Untracked:  analysis/fig6a.Rmd
    Untracked:  analysis/fig6b.Rmd
    Untracked:  analysis/fig6c.Rmd
    Untracked:  analysis/fig7a.Rmd
    Untracked:  analysis/fig7b.Rmd
    Untracked:  analysis/fig8.Rmd
    Untracked:  analysis/fig9a.Rmd
    Untracked:  analysis/fig9b.Rmd
    Untracked:  code/functions.R
    Untracked:  code/hr_plot_funcs.R
    Untracked:  code/liver.tools/
    Untracked:  code/pivot_wider_pacto.R
    Untracked:  code/process_ab.Rmd
    Untracked:  code/process_tcga_beta.Rmd
    Untracked:  code/rlucas/
    Untracked:  code/useful.stuff.aa/
    Untracked:  code/utility_funcs.R
    Untracked:  data/120122_mutations.csv
    Untracked:  data/CA199.csv
    Untracked:  data/CP_PAC_artemis.xlsx
    Untracked:  data/CheckPAC_clinical_annotated011622.xlsx
    Untracked:  data/Checkpac_Test.csv
    Untracked:  data/Expected.csv
    Untracked:  data/ID_comparison.xlsx
    Untracked:  data/Locked_Models/
    Untracked:  data/PACTO Masterfile.xlsx
    Untracked:  data/PACTO_BL_EOT_EOS_PFS_TA_jh.xlsx
    Untracked:  data/Test_set_pacto.csv
    Untracked:  data/allfeatures_pacto.5mb.hg19.csv
    Untracked:  data/artemis.csv
    Untracked:  data/barv1.csv
    Untracked:  data/cellularity.csv
    Untracked:  data/checkpac_5mb_bins/
    Untracked:  data/checkpac_baseline_p2_dates.csv
    Untracked:  data/checkpac_bins.csv
    Untracked:  data/checkpac_ca199.csv
    Untracked:  data/checkpac_ca199_baseline_p4_dates.csv
    Untracked:  data/checkpac_features.csv
    Untracked:  data/checkpac_plasma_manifest.xlsx
    Untracked:  data/clinical_073123.xlsx
    Untracked:  data/combined_bins_102324.rds
    Untracked:  data/df_results_CAIRO5_2_6_ checkpac_ pacto.tsv
    Untracked:  data/estimates/
    Untracked:  data/fig2c_p2_data.rds
    Untracked:  data/for_leal_plot_042324.xlsx
    Untracked:  data/fp2_lucas_healthy.csv
    Untracked:  data/i07_input.xlsx
    Untracked:  data/loadings.rds
    Untracked:  data/long_bins.csv
    Untracked:  data/pacto_5mb_bins/
    Untracked:  data/pacto_bins.csv
    Untracked:  data/pacto_features.csv
    Untracked:  data/sel_chr.txt
    Untracked:  data/supplementary_tables.xlsx
    Untracked:  data/tumor_tmb.txt
    Untracked:  extdata/
    Untracked:  output/process_tcga_beta.Rmd/

Unstaged changes:
    Modified:   .gitignore
    Modified:   README.md
    Modified:   analysis/about.Rmd
    Modified:   analysis/index.Rmd
    Modified:   analysis/license.Rmd

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.


There are no past versions. Publish this analysis with wflow_publish() to start tracking its development.


For each level of WGMAF, the fraction of samples detected by ARTEMIS-DELFI is indicated from .8-1 on the y axis.

library(cowplot)
library(here)
library(readxl)
library(tidyverse)
suppl <- read_excel(here("data/supplementary_tables.xlsx"),
                    sheet = "Table S2", skip = 1)
# Removing samples without WGMAF values
suppl <- suppl %>%
          select(patient_id = Patient, sample_id = Sample, wgmaf = WGMAF, artemis_delfi_score = `ARTEMIS-DELFI Score`) %>%
          filter(wgmaf != "-") %>%
          mutate(wgmaf = as.numeric(wgmaf))

# Creating a column to indicate the post-tx samples from the exceptional responder to use as the ctDNA-free samples.
suppl <- suppl %>%
           mutate(ctdna_free = case_when(patient_id == "CGPLPA223" & !(sample_id == "CGPLPA223P") ~ TRUE,
                                         TRUE ~ FALSE))

# Counting the number of samples considered ctDNA-free
suppl %>%
  filter(ctdna_free == TRUE) %>%
  nrow
[1] 14
# Getting the maximum WGMAF of cfDNA-free samples. Samples with WGMAF above this level can be considered ctDNA+.
wgmaf_max_cancer_free <- suppl %>%
                           filter(ctdna_free == TRUE) %>%
                           .$wgmaf %>%
                           max
print(wgmaf_max_cancer_free) # Returns: 0.000283849. Anything above 0.001 would then easily test positive, using this threshold for the cumulative fraction detected figure.
[1] 0.000283849
# Getting the range of WGMAF of cfDNA-free samples. Samples with WGMAF above this level can be considered ctDNA+.
suppl %>%
  filter(ctdna_free == TRUE) %>%
  arrange(wgmaf)
# A tibble: 14 × 5
   patient_id sample_id        wgmaf artemis_delfi_score ctdna_free
   <chr>      <chr>            <dbl>               <dbl> <lgl>     
 1 CGPLPA223  CGPLPA223P6  0                      0.131  TRUE      
 2 CGPLPA223  CGPLPA223P10 0                      0.0378 TRUE      
 3 CGPLPA223  CGPLPA223P12 0                      0.0447 TRUE      
 4 CGPLPA223  CGPLPA223P16 0                      0.0336 TRUE      
 5 CGPLPA223  CGPLPA223P14 0.0000526              0.0527 TRUE      
 6 CGPLPA223  CGPLPA223P7  0.0000632              0.0727 TRUE      
 7 CGPLPA223  CGPLPA223P8  0.0000679              0.0880 TRUE      
 8 CGPLPA223  CGPLPA223P15 0.0000712              0.0381 TRUE      
 9 CGPLPA223  CGPLPA223P11 0.0000829              0.0346 TRUE      
10 CGPLPA223  CGPLPA223P3  0.0000872              0.0605 TRUE      
11 CGPLPA223  CGPLPA223P2  0.0000933              0.0497 TRUE      
12 CGPLPA223  CGPLPA223P18 0.000112               0.0278 TRUE      
13 CGPLPA223  CGPLPA223P9  0.000118               0.0287 TRUE      
14 CGPLPA223  CGPLPA223P17 0.000284               0.0307 TRUE      
# Getting the maximum ARTEMIS-DELFI score of cfDNA-free samples. Samples with ARTEMIS-DELFI score above this level can be considered ctDNA+.
artemis_delfi_max_cancer_free <- suppl %>%
  filter(ctdna_free == TRUE) %>%
  .$artemis_delfi_score %>%
  max

# Computing the cumulative fraction of samples that test positive with ARTEMIS-DELFI across WGSMAF values from ~1 --> 0.001
suppl <- suppl %>%
        mutate(wgmaf_positive = case_when(wgmaf > wgmaf_max_cancer_free ~ TRUE,
                                          TRUE ~ FALSE)) %>%
        mutate(artemis_delfi_positive = case_when(artemis_delfi_score > artemis_delfi_max_cancer_free ~ TRUE,
                                                  TRUE ~ FALSE)) %>%
        filter(wgmaf_positive == TRUE) %>%
        arrange(desc(wgmaf)) %>%
        mutate(cumulative_eval = 1:n(),
               cumulative_positive_artemis_delfi = cumsum(artemis_delfi_positive)) %>%
        mutate(cumulative_frac_positive_artemis_delfi = cumulative_positive_artemis_delfi / cumulative_eval)
# Plotting
ggplot(data = suppl, aes(x = wgmaf, y = cumulative_frac_positive_artemis_delfi)) +
          geom_line() +
          scale_x_continuous(trans = "log10",
                             breaks = c(0.1, 0.01, 0.001),
                             labels = c("0.1", "0.01", "0.001"),
                             guide = guide_axis_logticks()) +
          theme_cowplot() +
          xlab("WGMAF") +
          ylab("Cumulative fraction of samples detected\nby ARTEMIS-DELFI")

# At least 95% of samples are detected above X WGMAF?
suppl %>% filter(cumulative_frac_positive_artemis_delfi >= 0.95) %>% .$wgmaf %>% tail(1)
[1] 0.008297116
# Get the cumulative fraction of positive samples with ARTEMIS-DELFI at WGMAF ≥ 0.001 (0.1%)
suppl %>% filter(wgmaf <= 0.001) %>% .$cumulative_frac_positive_artemis_delfi %>% head(1)
[1] 0.8333333

sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin20
Running under: macOS 15.3.1

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

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

other attached packages:
 [1] lubridate_1.9.4 forcats_1.0.0   stringr_1.5.1   dplyr_1.1.4    
 [5] purrr_1.0.4     readr_2.1.5     tidyr_1.3.1     tibble_3.2.1   
 [9] ggplot2_3.5.1   tidyverse_2.0.0 readxl_1.4.5    here_1.0.1     
[13] cowplot_1.1.3   workflowr_1.7.1

loaded via a namespace (and not attached):
 [1] utf8_1.2.4        sass_0.4.9        generics_0.1.3    stringi_1.8.4    
 [5] hms_1.1.3         digest_0.6.37     magrittr_2.0.3    timechange_0.3.0 
 [9] evaluate_1.0.3    grid_4.4.1        fastmap_1.2.0     cellranger_1.1.0 
[13] rprojroot_2.0.4   jsonlite_1.9.1    processx_3.8.6    whisker_0.4.1    
[17] ps_1.9.0          promises_1.3.2    httr_1.4.7        scales_1.3.0     
[21] jquerylib_0.1.4   cli_3.6.4         rlang_1.1.5       munsell_0.5.1    
[25] withr_3.0.2       cachem_1.1.0      yaml_2.3.10       tools_4.4.1      
[29] tzdb_0.4.0        colorspace_2.1-1  httpuv_1.6.15     vctrs_0.6.5      
[33] R6_2.6.1          lifecycle_1.0.4   git2r_0.35.0      fs_1.6.5         
[37] pkgconfig_2.0.3   callr_3.7.6       pillar_1.10.1     bslib_0.9.0      
[41] later_1.4.1       gtable_0.3.6      glue_1.8.0        Rcpp_1.0.14      
[45] xfun_0.51         tidyselect_1.2.1  rstudioapi_0.17.1 knitr_1.49       
[49] farver_2.1.2      htmltools_0.5.8.1 labeling_0.4.3    rmarkdown_2.29   
[53] compiler_4.4.1    getPass_0.2-4