Last updated: 2025-03-28

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 file has unstaged changes. 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 03bf6cf. 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:    code/process_tcga_beta.html
    Ignored:    code/rlucas/.DS_Store
    Ignored:    data/estimates/.Rapp.history

Untracked files:
    Untracked:  code/pivot_wider_pacto.R
    Untracked:  code/process_ab_v0.Rmd
    Untracked:  data/allfeatures_pacto.5mb.hg19.csv
    Untracked:  data/paad_bins_100kb_sel_chr.rds
    Untracked:  extdata/

Unstaged changes:
    Modified:   README.Rmd
    Modified:   analysis/ext-fig9.Rmd
    Modified:   analysis/fig4.Rmd
    Modified:   code/process_tcga_beta.Rmd
    Modified:   output/process_tcga_beta.Rmd/paad_bins_100kb_sel_chr.rds

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/fig4.Rmd) and HTML (docs/fig4.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 03bf6cf Shashikant Koul 2025-03-28 Update fig4 and add a note about extdata in README
html 03bf6cf Shashikant Koul 2025-03-28 Update fig4 and add a note about extdata in README
Rmd 9bbcb47 Shashikant Koul 2025-03-27 Initial commit
html 9bbcb47 Shashikant Koul 2025-03-27 Initial commit

Comparison of plasma fragmentation features to reference A/B compartments across chromosome 14. The first panel shows chromatin A/B compartments derived from pancreatic cancer tissue methylation(36). The second panel shows a median deconvoluted pancreatic cancer component based on the six samples with the highest ctDNA levels. The third panel shows the median fragmentation profile in the plasma for those samples, and the fourth panel shows the median fragmentation profile for a set of healthy plasma controls. The final panel shows chromatin A/B compartments for lymphoblast cells. Dark shading indicates regions of the genome where the two reference tracks are discordant in domain (open/closed) or magnitude. The extracted pancreatic cancer component has the greatest similarity to the pancreatic cancer reference track, and the healthy plasma has the greatest similarity to the lymphoblast reference track.

library(cowplot)
library(data.table)
library(tidyverse)
library(here)
source(here("code/functions.R"))
sel_chr <- readLines(here("data/sel_chr.txt"))
chr_label <- paste("Chromosome", c(c(1:22), "X"))
names(chr_label) <- paste0("chr", c(c(1:22), "X"))

# Load all tracks
data <- readRDS(here("output/process_ab.Rmd/combined_bins.rds")) %>%
  group_by(source2) %>%
  mutate(newbin = row_number()) %>%
  ungroup() %>%
  setDT(.)
# Select ratios / coverage
ratio_notcov <- TRUE

if (ratio_notcov) {
  sources <- c("AB Compartments PAAD",
               "Extracted Pancreatic component Ratios",
               "Median Pancreatic Plasma Ratios",
               "Median Healthy Plasma Ratios",
               "EBV transformed lymphoblast HiC")
} else {
  sources <- c("AB Compartments PAAD",
               "Extracted Pancreatic component Coverage",
               "Median Pancreatic Plasma Coverage",
               "Median Healthy Plasma Coverage",
               "EBV transformed lymphoblast HiC")
}

labels <- c("Pancreatic cancer tissue reference A/B compartments",
            "Extracted pancreatic cancer patient cfDNA component",
            "Pancreatic cancer patient cfDNA",
            "Individuals without cancer cfDNA",
            "Lymphoblastiod cell Hi-C reference A/B compartments")

# Get bins with different domains or sig difference between TCGA and Lymphoblast
clist <- chr_wrangling(data, sel_chr = sel_chr, sources, labels)

tib <- clist[["tib"]]
track_data <- clist[["track.data"]]
slevels <- levels(track_data$source2)

# Plot the tracks
b <- ggplot(track_data,
            aes(x = newbin, y = eigen, fill = color, alpha = transp)) +
  geom_bar(stat = "Identity", width = 1) +
  facet_wrap(~ source2, ncol = 1) +
  scale_x_continuous(expand  =  c(0, 0)) +
  theme_classic(base_size = 24) +
  theme(legend.position = "none",
        strip.background = element_blank(),
        axis.text.x = element_blank(),
        axis.ticks.x = element_blank()) +
  coord_cartesian(xlim = c(0, 500)) +
  scale_fill_identity() +
  scale_alpha_identity() +
  xlab(chr_label[sel_chr]) +
  ylab("Fragmentation Profile")

# Plot the plasma tracks to highlight the difference
p <- tib %>%
  filter(source2 == "Non-cancer Plasma") %>%
  ggplot(aes(x = newbin, y = eigen, fill = color, alpha = transp)) +
  geom_bar(stat = "Identity",
           width = 1, color = "black") +
  geom_bar(stat = "Identity", width = 1,
           data = tib %>%
             filter(source2 == "Pancreatic Cancer Plasma"), color = "white") +
  scale_x_continuous(expand  =  c(0, 0)) +
  theme_classic(base_size = 24) +
  theme(legend.position = "none",
        axis.title.x = element_text(size = 25),
        strip.background = element_blank()) +
  scale_fill_manual(values = c("red4", "gray50")) +
  scale_alpha_identity() +
  xlab(chr_label[sel_chr]) +
  ylab("Fragmentation Profile")
print(b)

Version Author Date
03bf6cf Shashikant Koul 2025-03-28
9bbcb47 Shashikant Koul 2025-03-27
cowplot::plot_grid(b, p, nrow = 2, rel_heights = c(2, 0.5),
                   align = "v", axis = "l")

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] here_1.0.1        lubridate_1.9.4   forcats_1.0.0     stringr_1.5.1    
 [5] dplyr_1.1.4       purrr_1.0.4       readr_2.1.5       tidyr_1.3.1      
 [9] tibble_3.2.1      ggplot2_3.5.1     tidyverse_2.0.0   data.table_1.17.0
[13] cowplot_1.1.3     workflowr_1.7.1  

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