Last updated: 2025-08-25

Checks: 6 1

Knit directory: ChIPSeq_project/

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(20250815) 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 9c77a6c. 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:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  analysis/Peak_details_TOP2B_P53.Rmd
    Untracked:  data/P53_peaks_after_dedup.csv
    Untracked:  data/P53_peaks_before_dedup.csv
    Untracked:  data/TOP2B_broad_peaks_before_dedup.csv
    Untracked:  data/TOP2B_peaks_after_dedup.csv

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.


📌 TOP2B peaks (before deduplication)

library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.3.2
Warning: package 'tidyr' was built under R version 4.3.3
Warning: package 'readr' was built under R version 4.3.3
Warning: package 'purrr' was built under R version 4.3.3
Warning: package 'dplyr' was built under R version 4.3.2
Warning: package 'stringr' was built under R version 4.3.2
Warning: package 'lubridate' was built under R version 4.3.3
library(readr)
library(scales)
Warning: package 'scales' was built under R version 4.3.2
library(grid)  # for unit()

# CSV already contains: Sample_Det, Tx, Broad_Peaks, Narrow_Peaks
df <- read_csv("data/TOP2B_broad_peaks_before_dedup.csv", show_col_types = FALSE)

# If headers vary slightly, normalize (safe no-ops if not present)
if ("Sample Det" %in% names(df)) df <- df |> rename(Sample_Det = `Sample Det`)
if (!"Tx" %in% names(df) && "Treatment" %in% names(df)) {
  df <- df |> mutate(Tx = if_else(str_detect(Treatment, "DOX", TRUE), "DOX",
                                  if_else(str_detect(Treatment, "VEH", TRUE), "VEH", NA_character_)))
}

plot_df <- df |>
  pivot_longer(c(Broad_Peaks, Narrow_Peaks),
               names_to = "PeakType", values_to = "npeaks") |>
  mutate(
    PeakType   = factor(PeakType, levels = c("Broad_Peaks","Narrow_Peaks")),
    Tx         = factor(Tx, levels = c("VEH","DOX")),
    Sample_Det = factor(Sample_Det, levels = unique(Sample_Det))
  )

# same Y-axis scale for both facets
y_max <- max(plot_df$npeaks, na.rm = TRUE)

p <- ggplot(plot_df, aes(x = Sample_Det, y = npeaks, fill = Tx)) +
  geom_col(width = 0.72) +
  facet_wrap(~ PeakType, ncol = 2, scales = "fixed") +
  scale_x_discrete(limits = levels(plot_df$Sample_Det)) +
  scale_fill_manual(values = c("VEH" = "#3386DD", "DOX" = "#d95f02"), na.value = "grey70") +
  scale_y_continuous(limits = c(0, y_max),
                     expand = expansion(mult = c(0, 0.05)),
                     labels = label_number(big.mark = ",")) +
  labs(
    title = "TOP2B peaks across samples (before deduplication)",
    x = "Sample details",
    y = "Number of peaks",
    fill = "Treatment"
  ) +
  theme_bw(base_size = 14) +
  theme(
    legend.position       = "right",
    legend.title          = element_text(face = "bold"),
    legend.box.background = element_rect(color = "black", size = 0.6),
    legend.background     = element_rect(fill = "white"),
    legend.margin         = margin(6, 6, 6, 6),

    panel.border          = element_rect(color = "black", fill = NA, size = 0.6),
    strip.background      = element_rect(fill = "grey90", color = "black", size = 0.6),
    strip.text            = element_text(face = "bold"),

    panel.grid.minor      = element_blank(),
    panel.spacing         = unit(6, "pt"),
    axis.text.x           = element_text(angle = 45, hjust = 1),

    # optional: center & embolden the title
    plot.title            = element_text(hjust = 0.5, face = "bold", size = 16)
  )
Warning: The `size` argument of `element_rect()` is deprecated as of ggplot2 3.4.0.
ℹ Please use the `linewidth` argument instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
generated.
p

📌 P53 peaks (before deduplication)

library(tidyverse)
library(readr)
library(scales)
library(grid)  # for unit()

# CSV should contain: Sample_Det (or "Sample Det"), Tx (or "Treatment"), Peaks
df <- read_csv("data/P53_peaks_before_dedup.csv", show_col_types = FALSE)

# Normalize common header variants (safe no-ops if not present)
if ("Sample Det" %in% names(df)) df <- df |> rename(Sample_Det = `Sample Det`)
if (!"Tx" %in% names(df) && "Treatment" %in% names(df)) {
  df <- df |> mutate(Tx = case_when(
    str_detect(Treatment, regex("VEH", TRUE)) ~ "VEH",
    str_detect(Treatment, regex("DOX", TRUE)) ~ "DOX",
    TRUE ~ NA_character_
  ))
}
# If Tx still missing, try to infer from Sample_Det
if (!"Tx" %in% names(df)) {
  df <- df |> mutate(Tx = case_when(
    str_detect(Sample_Det, regex("\\bVEH\\b", TRUE)) ~ "VEH",
    str_detect(Sample_Det, regex("\\bDOX\\b", TRUE)) ~ "DOX",
    TRUE ~ NA_character_
  ))
}

# Lock X order to the file order
plot_df <- df |>
  mutate(
    Sample_Det = factor(Sample_Det, levels = unique(Sample_Det)),
    Tx         = factor(Tx, levels = c("VEH","DOX"))
  )

p_p53 <- ggplot(plot_df, aes(x = Sample_Det, y = Peaks, fill = Tx)) +
  geom_col(width = 0.72) +
  scale_x_discrete(limits = levels(plot_df$Sample_Det)) +
  scale_fill_manual(values = c("VEH" = "#3386DD", "DOX" = "#d95f02"), na.value = "grey70") +
  scale_y_continuous(labels = scales::label_number(big.mark = ","), 
                     expand = expansion(mult = c(0, 0.05))) +
  labs(
    title = "P53 peaks across samples (before deduplication)",
    x = "Sample details",
    y = "Number of peaks",
    fill = "Treatment"
  ) +
  theme_bw(base_size = 14) +
  theme(
    legend.position       = "right",
    legend.title          = element_text(face = "bold"),
    legend.box.background = element_rect(color = "black", size = 0.6),
    legend.background     = element_rect(fill = "white"),
    panel.border          = element_rect(color = "black", fill = NA, size = 0.6),
    panel.grid.minor      = element_blank(),
    panel.spacing         = unit(6, "pt"),
    axis.text.x           = element_text(angle = 45, hjust = 1),
    plot.title            = element_text(hjust = 0.5, face = "bold", size = 16)  # centered title
  )

p_p53

📌 TOP2B peaks (After deduplication)

library(tidyverse)
library(readr)
library(scales)
library(grid)  # for unit()

# CSV already contains: Sample_Det, Tx, Broad_Peaks, Narrow_Peaks
df <- read_csv("data/TOP2B_peaks_after_dedup.csv", show_col_types = FALSE)

# If headers vary slightly, normalize (safe no-ops if not present)
if ("Sample Det" %in% names(df)) df <- df |> rename(Sample_Det = `Sample Det`)
if (!"Tx" %in% names(df) && "Treatment" %in% names(df)) {
  df <- df |> mutate(Tx = if_else(str_detect(Treatment, "DOX", TRUE), "DOX",
                                  if_else(str_detect(Treatment, "VEH", TRUE), "VEH", NA_character_)))
}

plot_df <- df |>
  pivot_longer(c(Broad_Peaks, Narrow_Peaks),
               names_to = "PeakType", values_to = "npeaks") |>
  mutate(
    PeakType   = factor(PeakType, levels = c("Broad_Peaks","Narrow_Peaks")),
    Tx         = factor(Tx, levels = c("VEH","DOX")),
    Sample_Det = factor(Sample_Det, levels = unique(Sample_Det))
  )

# same Y-axis scale for both facets
y_max <- max(plot_df$npeaks, na.rm = TRUE)

p <- ggplot(plot_df, aes(x = Sample_Det, y = npeaks, fill = Tx)) +
  geom_col(width = 0.72) +
  facet_wrap(~ PeakType, ncol = 2, scales = "fixed") +
  scale_x_discrete(limits = levels(plot_df$Sample_Det)) +
  scale_fill_manual(values = c("VEH" = "#3386DD", "DOX" = "#d95f02"), na.value = "grey70") +
  scale_y_continuous(limits = c(0, y_max),
                     expand = expansion(mult = c(0, 0.05)),
                     labels = label_number(big.mark = ",")) +
  labs(
    title = "TOP2B peaks across samples (after deduplication)",
    x = "Sample details",
    y = "Number of peaks",
    fill = "Treatment"
  ) +
  theme_bw(base_size = 14) +
  theme(
    legend.position       = "right",
    legend.title          = element_text(face = "bold"),
    legend.box.background = element_rect(color = "black", size = 0.6),
    legend.background     = element_rect(fill = "white"),
    legend.margin         = margin(6, 6, 6, 6),

    panel.border          = element_rect(color = "black", fill = NA, size = 0.6),
    strip.background      = element_rect(fill = "grey90", color = "black", size = 0.6),
    strip.text            = element_text(face = "bold"),

    panel.grid.minor      = element_blank(),
    panel.spacing         = unit(6, "pt"),
    axis.text.x           = element_text(angle = 45, hjust = 1),

    # optional: center & embolden the title
    plot.title            = element_text(hjust = 0.5, face = "bold", size = 16)
  )

p

📌 P53 peaks (after deduplication)

library(tidyverse)
library(readr)
library(scales)
library(grid)  # for unit()

# CSV should contain: Sample_Det (or "Sample Det"), Tx (or "Treatment"), Peaks
df <- read_csv("data/P53_peaks_after_dedup.csv", show_col_types = FALSE)

# Normalize common header variants (safe no-ops if not present)
if ("Sample Det" %in% names(df)) df <- df |> rename(Sample_Det = `Sample Det`)
if (!"Tx" %in% names(df) && "Treatment" %in% names(df)) {
  df <- df |> mutate(Tx = case_when(
    str_detect(Treatment, regex("VEH", TRUE)) ~ "VEH",
    str_detect(Treatment, regex("DOX", TRUE)) ~ "DOX",
    TRUE ~ NA_character_
  ))
}
# If Tx still missing, try to infer from Sample_Det
if (!"Tx" %in% names(df)) {
  df <- df |> mutate(Tx = case_when(
    str_detect(Sample_Det, regex("\\bVEH\\b", TRUE)) ~ "VEH",
    str_detect(Sample_Det, regex("\\bDOX\\b", TRUE)) ~ "DOX",
    TRUE ~ NA_character_
  ))
}

# Lock X order to the file order
plot_df <- df |>
  mutate(
    Sample_Det = factor(Sample_Det, levels = unique(Sample_Det)),
    Tx         = factor(Tx, levels = c("VEH","DOX"))
  )

p_p53 <- ggplot(plot_df, aes(x = Sample_Det, y = Peaks, fill = Tx)) +
  geom_col(width = 0.72) +
  scale_x_discrete(limits = levels(plot_df$Sample_Det)) +
  scale_fill_manual(values = c("VEH" = "#3386DD", "DOX" = "#d95f02"), na.value = "grey70") +
  scale_y_continuous(labels = scales::label_number(big.mark = ","), 
                     expand = expansion(mult = c(0, 0.05))) +
  labs(
    title = "P53 peaks across samples (after deduplication)",
    x = "Sample details",
    y = "Number of peaks",
    fill = "Treatment"
  ) +
  theme_bw(base_size = 14) +
  theme(
    legend.position       = "right",
    legend.title          = element_text(face = "bold"),
    legend.box.background = element_rect(color = "black", size = 0.6),
    legend.background     = element_rect(fill = "white"),
    panel.border          = element_rect(color = "black", fill = NA, size = 0.6),
    panel.grid.minor      = element_blank(),
    panel.spacing         = unit(6, "pt"),
    axis.text.x           = element_text(angle = 45, hjust = 1),
    plot.title            = element_text(hjust = 0.5, face = "bold", size = 16)  # centered title
  )

p_p53


sessionInfo()
R version 4.3.0 (2023-04-21 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 26100)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/Chicago
tzcode source: internal

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

other attached packages:
 [1] scales_1.3.0    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.2   tidyverse_2.0.0

loaded via a namespace (and not attached):
 [1] sass_0.4.10       generics_0.1.3    stringi_1.8.3     hms_1.1.3        
 [5] digest_0.6.34     magrittr_2.0.3    evaluate_1.0.3    timechange_0.3.0 
 [9] fastmap_1.2.0     rprojroot_2.0.4   workflowr_1.7.1   jsonlite_2.0.0   
[13] promises_1.3.2    jquerylib_0.1.4   cli_3.6.1         crayon_1.5.3     
[17] rlang_1.1.3       bit64_4.6.0-1     munsell_0.5.1     withr_3.0.2      
[21] cachem_1.1.0      yaml_2.3.10       parallel_4.3.0    tools_4.3.0      
[25] tzdb_0.5.0        colorspace_2.1-0  httpuv_1.6.15     vctrs_0.6.5      
[29] R6_2.6.1          lifecycle_1.0.4   git2r_0.36.2      bit_4.6.0        
[33] fs_1.6.3          vroom_1.6.5       pkgconfig_2.0.3   pillar_1.10.2    
[37] bslib_0.9.0       later_1.3.2       gtable_0.3.6      glue_1.7.0       
[41] Rcpp_1.0.12       xfun_0.52         tidyselect_1.2.1  rstudioapi_0.17.1
[45] knitr_1.50        farver_2.1.2      htmltools_0.5.8.1 labeling_0.4.3   
[49] rmarkdown_2.29    compiler_4.3.0