Last updated: 2025-08-31
Checks: 7 0
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.
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(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 bc515e6. 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/
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/Peak_Calling_cutoff_TOP2B_P53.Rmd) and HTML
(docs/Peak_Calling_cutoff_TOP2B_P53.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 | bc515e6 | sayanpaul01 | 2025-08-31 | Commit |
| html | bc515e6 | sayanpaul01 | 2025-08-31 | Commit |
| Rmd | 9c77a6c | sayanpaul01 | 2025-08-24 | Commit |
| html | 9c77a6c | sayanpaul01 | 2025-08-24 | Commit |
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
ββ Attaching core tidyverse packages ββββββββββββββββββββββββ tidyverse 2.0.0 ββ
β dplyr 1.1.4 β readr 2.1.5
β forcats 1.0.0 β stringr 1.5.1
β ggplot2 3.5.2 β tibble 3.2.1
β lubridate 1.9.4 β tidyr 1.3.1
β purrr 1.0.4
ββ Conflicts ββββββββββββββββββββββββββββββββββββββββββ tidyverse_conflicts() ββ
β dplyr::filter() masks stats::filter()
β dplyr::lag() masks stats::lag()
βΉ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readr)
library(scales) # <- needed for label_number()
Warning: package 'scales' was built under R version 4.3.2
Attaching package: 'scales'
The following object is masked from 'package:purrr':
discard
The following object is masked from 'package:readr':
col_factor
# --- metadata ---
metadata <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP27", "Ind1_VEH_TOP2B",
"MCW_SP_ChIP28", "Ind1_DOX_TOP2B",
"MCW_SP_ChIP31", "Ind2_VEH_TOP2B",
"MCW_SP_ChIP32", "Ind2_DOX_TOP2B",
"MCW_SP_ChIP39", "Ind3_VEH_TOP2B",
"MCW_SP_ChIP40", "Ind3_DOX_TOP2B",
"MCW_SP_ChIP43", "Ind4_VEH_TOP2B",
"MCW_SP_ChIP44", "Ind4_DOX_TOP2B",
"MCW_SP_ChIP51", "Ind5_VEH_TOP2B",
"MCW_SP_ChIP52", "Ind5_DOX_TOP2B",
"MCW_SP_ChIP55", "Ind6_VEH_TOP2B",
"MCW_SP_ChIP56", "Ind6_DOX_TOP2B"
) |> mutate(
Sample = factor(Sample, levels = Sample),
Sample_Det = factor(Sample_Det, levels = Sample_Det)
)
# --- load all cutoff analysis files ---
files <- list.files("data/macs3_broad_out_TOP2B",
pattern = "_cutoff_analysis\\.txt$", full.names = TRUE)
df <- files |>
set_names() |>
map_dfr(~ read_delim(.x, delim = "\t", show_col_types = FALSE), .id = "filepath") |>
mutate(Sample = basename(filepath) |> str_remove("_cutoff_analysis\\.txt")) |>
left_join(metadata, by = "Sample") |>
mutate(Sample_Det = factor(Sample_Det, levels = levels(metadata$Sample_Det))) |>
arrange(Sample_Det, qscore)
# Common x-scale (guarantees tick at 0)
x_fixed <- scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
)
# ---- Plot with linear y-axis ----
p_linear <- ggplot(df, aes(qscore, npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
x_fixed +
scale_y_continuous(labels = scales::label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Peak Counts (linear)") +
theme_minimal(base_size = 12) +
theme(strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank())
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
βΉ Please use `linewidth` instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
generated.
# ---- Plot with log10 y-axis ----
p_log <- df |>
mutate(npeaks = ifelse(npeaks <= 0, NA, npeaks)) |>
ggplot(aes(qscore, npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
x_fixed +
scale_y_log10(labels = scales::label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Peak Counts (log10)") +
theme_minimal(base_size = 12) +
theme(strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank())
# ---- Print both ----
p_linear

| Version | Author | Date |
|---|---|---|
| 9c77a6c | sayanpaul01 | 2025-08-24 |
p_log

| Version | Author | Date |
|---|---|---|
| 9c77a6c | sayanpaul01 | 2025-08-24 |
library(tidyverse)
library(readr)
# --- metadata ---
metadata <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP27", "Ind1_VEH_TOP2B",
"MCW_SP_ChIP28", "Ind1_DOX_TOP2B",
"MCW_SP_ChIP31", "Ind2_VEH_TOP2B",
"MCW_SP_ChIP32", "Ind2_DOX_TOP2B",
"MCW_SP_ChIP39", "Ind3_VEH_TOP2B",
"MCW_SP_ChIP40", "Ind3_DOX_TOP2B",
"MCW_SP_ChIP43", "Ind4_VEH_TOP2B",
"MCW_SP_ChIP44", "Ind4_DOX_TOP2B",
"MCW_SP_ChIP51", "Ind5_VEH_TOP2B",
"MCW_SP_ChIP52", "Ind5_DOX_TOP2B",
"MCW_SP_ChIP55", "Ind6_VEH_TOP2B",
"MCW_SP_ChIP56", "Ind6_DOX_TOP2B"
)
# --- load all cutoff analysis files ---
files <- list.files("data/macs3_narrow_out_TOP2B", pattern = "_cutoff_analysis\\.txt$", full.names = TRUE)
df <- files %>%
set_names() %>%
map_dfr(~ read_delim(.x, delim = "\t", show_col_types = FALSE), .id = "filepath") %>%
mutate(Sample = basename(filepath) %>% str_remove("_cutoff_analysis\\.txt")) %>%
left_join(metadata, by = "Sample")
# ---- Plot with linear y-axis ----
p_linear <- df %>%
ggplot(aes(x = qscore, y = npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7), # ensures "0" shows up
expand = c(0, 0)
) +
scale_y_continuous(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Peak Counts (linear)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- Plot with log10 y-axis ----
p_log <- df %>%
ggplot(aes(x = qscore, y = npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
) +
scale_y_log10(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Peak Counts (log10)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- Print both ----
p_linear

| Version | Author | Date |
|---|---|---|
| 9c77a6c | sayanpaul01 | 2025-08-24 |
p_log

| Version | Author | Date |
|---|---|---|
| 9c77a6c | sayanpaul01 | 2025-08-24 |
library(tidyverse)
library(readr)
library(scales)
# --- metadata for p53 ---
metadata_p53 <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP29", "Ind1_VEH_p53",
"MCW_SP_ChIP30", "Ind1_DOX_p53",
"MCW_SP_ChIP33", "Ind2_VEH_p53",
"MCW_SP_ChIP34", "Ind2_DOX_p53",
"MCW_SP_ChIP41", "Ind3_VEH_p53",
"MCW_SP_ChIP42", "Ind3_DOX_p53",
"MCW_SP_ChIP45", "Ind4_VEH_p53",
"MCW_SP_ChIP46", "Ind4_DOX_p53",
"MCW_SP_ChIP53", "Ind5_VEH_p53",
"MCW_SP_ChIP54", "Ind5_DOX_p53",
"MCW_SP_ChIP57", "Ind6_VEH_p53",
"MCW_SP_ChIP58", "Ind6_DOX_p53"
) %>%
mutate(
Sample = factor(Sample, levels = Sample),
Sample_Det = factor(Sample_Det, levels = Sample_Det)
)
# --- load all cutoff-analysis files (edit path if needed) ---
data_dir <- "data/macs3_narrow_out_P53" # <β change if your folder name differs
files <- list.files(data_dir, pattern = "_cutoff_analysis\\.txt$", full.names = TRUE)
df_p53 <- files %>%
set_names() %>%
map_dfr(~ read_delim(.x, delim = "\t", show_col_types = FALSE), .id = "filepath") %>%
mutate(Sample = basename(filepath) %>% str_remove("_cutoff_analysis\\.txt")) %>%
left_join(metadata_p53, by = "Sample") %>%
mutate(Sample_Det = factor(Sample_Det, levels = levels(metadata_p53$Sample_Det))) %>%
arrange(Sample_Det, qscore)
# --------- common x scale (forces 0..7 with a printed 0) ----------
x_fixed <- scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
)
# ---- linear y ----
p_linear_p53 <- ggplot(df_p53, aes(qscore, npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
x_fixed +
scale_y_continuous(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Peak Counts (linear)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- log10 y ----
p_log_p53 <- ggplot(df_p53, aes(qscore, npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
x_fixed +
scale_y_log10(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Peak Counts (log10)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- show both ----
p_linear_p53

| Version | Author | Date |
|---|---|---|
| 9c77a6c | sayanpaul01 | 2025-08-24 |
p_log_p53

| Version | Author | Date |
|---|---|---|
| 9c77a6c | sayanpaul01 | 2025-08-24 |
library(tidyverse)
library(readr)
# --- metadata ---
metadata <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP27", "Ind1_VEH_TOP2B",
"MCW_SP_ChIP28", "Ind1_DOX_TOP2B",
"MCW_SP_ChIP31", "Ind2_VEH_TOP2B",
"MCW_SP_ChIP32", "Ind2_DOX_TOP2B",
"MCW_SP_ChIP39", "Ind3_VEH_TOP2B",
"MCW_SP_ChIP40", "Ind3_DOX_TOP2B",
"MCW_SP_ChIP43", "Ind4_VEH_TOP2B",
"MCW_SP_ChIP44", "Ind4_DOX_TOP2B",
"MCW_SP_ChIP51", "Ind5_VEH_TOP2B",
"MCW_SP_ChIP52", "Ind5_DOX_TOP2B",
"MCW_SP_ChIP55", "Ind6_VEH_TOP2B",
"MCW_SP_ChIP56", "Ind6_DOX_TOP2B"
)
# --- load all cutoff analysis files ---
files <- list.files("data/macs3_broad_out_TOP2B_dedup", pattern = "_cutoff_analysis\\.txt$", full.names = TRUE)
df <- files %>%
set_names() %>%
map_dfr(~ read_delim(.x, delim = "\t", show_col_types = FALSE), .id = "filepath") %>%
mutate(Sample = basename(filepath) %>% str_remove("_cutoff_analysis\\.txt")) %>%
left_join(metadata, by = "Sample")
# ---- Plot with linear y-axis ----
p_linear <- df %>%
ggplot(aes(x = qscore, y = npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7), # ensures "0" shows up
expand = c(0, 0)
) +
scale_y_continuous(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Peak Counts (linear)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- Plot with log10 y-axis ----
p_log <- df %>%
ggplot(aes(x = qscore, y = npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
) +
scale_y_log10(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Peak Counts (log10)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- Print both ----
p_linear

| Version | Author | Date |
|---|---|---|
| 9c77a6c | sayanpaul01 | 2025-08-24 |
p_log

| Version | Author | Date |
|---|---|---|
| 9c77a6c | sayanpaul01 | 2025-08-24 |
library(tidyverse)
library(readr)
# --- metadata ---
metadata <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP27", "Ind1_VEH_TOP2B",
"MCW_SP_ChIP28", "Ind1_DOX_TOP2B",
"MCW_SP_ChIP31", "Ind2_VEH_TOP2B",
"MCW_SP_ChIP32", "Ind2_DOX_TOP2B",
"MCW_SP_ChIP39", "Ind3_VEH_TOP2B",
"MCW_SP_ChIP40", "Ind3_DOX_TOP2B",
"MCW_SP_ChIP43", "Ind4_VEH_TOP2B",
"MCW_SP_ChIP44", "Ind4_DOX_TOP2B",
"MCW_SP_ChIP51", "Ind5_VEH_TOP2B",
"MCW_SP_ChIP52", "Ind5_DOX_TOP2B",
"MCW_SP_ChIP55", "Ind6_VEH_TOP2B",
"MCW_SP_ChIP56", "Ind6_DOX_TOP2B"
)
# --- load all cutoff analysis files ---
files <- list.files("data/macs3_narrow_out_TOP2B_dedup", pattern = "_cutoff_analysis\\.txt$", full.names = TRUE)
df <- files %>%
set_names() %>%
map_dfr(~ read_delim(.x, delim = "\t", show_col_types = FALSE), .id = "filepath") %>%
mutate(Sample = basename(filepath) %>% str_remove("_cutoff_analysis\\.txt")) %>%
left_join(metadata, by = "Sample")
# ---- Plot with linear y-axis ----
p_linear <- df %>%
ggplot(aes(x = qscore, y = npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7), # ensures "0" shows up
expand = c(0, 0)
) +
scale_y_continuous(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Peak Counts (linear)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- Plot with log10 y-axis ----
p_log <- df %>%
ggplot(aes(x = qscore, y = npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
) +
scale_y_log10(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Peak Counts (log10)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- Print both ----
p_linear

| Version | Author | Date |
|---|---|---|
| 9c77a6c | sayanpaul01 | 2025-08-24 |
p_log

| Version | Author | Date |
|---|---|---|
| 9c77a6c | sayanpaul01 | 2025-08-24 |
library(tidyverse)
library(readr)
library(scales)
# --- metadata for p53 ---
metadata_p53 <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP29", "Ind1_VEH_p53",
"MCW_SP_ChIP30", "Ind1_DOX_p53",
"MCW_SP_ChIP33", "Ind2_VEH_p53",
"MCW_SP_ChIP34", "Ind2_DOX_p53",
"MCW_SP_ChIP41", "Ind3_VEH_p53",
"MCW_SP_ChIP42", "Ind3_DOX_p53",
"MCW_SP_ChIP45", "Ind4_VEH_p53",
"MCW_SP_ChIP46", "Ind4_DOX_p53",
"MCW_SP_ChIP53", "Ind5_VEH_p53",
"MCW_SP_ChIP54", "Ind5_DOX_p53",
"MCW_SP_ChIP57", "Ind6_VEH_p53",
"MCW_SP_ChIP58", "Ind6_DOX_p53"
) %>%
mutate(
Sample = factor(Sample, levels = Sample),
Sample_Det = factor(Sample_Det, levels = Sample_Det)
)
# --- load all cutoff-analysis files (edit path if needed) ---
data_dir <- "data/macs3_narrow_out_P53_dedup" # <β change if your folder name differs
files <- list.files(data_dir, pattern = "_cutoff_analysis\\.txt$", full.names = TRUE)
df_p53 <- files %>%
set_names() %>%
map_dfr(~ read_delim(.x, delim = "\t", show_col_types = FALSE), .id = "filepath") %>%
mutate(Sample = basename(filepath) %>% str_remove("_cutoff_analysis\\.txt")) %>%
left_join(metadata_p53, by = "Sample") %>%
mutate(Sample_Det = factor(Sample_Det, levels = levels(metadata_p53$Sample_Det))) %>%
arrange(Sample_Det, qscore)
# --------- common x scale (forces 0..7 with a printed 0) ----------
x_fixed <- scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
)
# ---- linear y ----
p_linear_p53 <- ggplot(df_p53, aes(qscore, npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
x_fixed +
scale_y_continuous(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Peak Counts (linear)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- log10 y ----
p_log_p53 <- ggplot(df_p53, aes(qscore, npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
x_fixed +
scale_y_log10(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Peak Counts (log10)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- show both ----
p_linear_p53

| Version | Author | Date |
|---|---|---|
| 9c77a6c | sayanpaul01 | 2025-08-24 |
p_log_p53

| Version | Author | Date |
|---|---|---|
| 9c77a6c | sayanpaul01 | 2025-08-24 |
library(tidyverse)
library(readr)
library(scales)
# --- metadata ---
metadata <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP27", "Ind1_VEH_TOP2B",
"MCW_SP_ChIP28", "Ind1_DOX_TOP2B",
"MCW_SP_ChIP31", "Ind2_VEH_TOP2B",
"MCW_SP_ChIP32", "Ind2_DOX_TOP2B",
"MCW_SP_ChIP39", "Ind3_VEH_TOP2B",
"MCW_SP_ChIP40", "Ind3_DOX_TOP2B",
"MCW_SP_ChIP43", "Ind4_VEH_TOP2B",
"MCW_SP_ChIP44", "Ind4_DOX_TOP2B",
"MCW_SP_ChIP51", "Ind5_VEH_TOP2B",
"MCW_SP_ChIP52", "Ind5_DOX_TOP2B",
"MCW_SP_ChIP55", "Ind6_VEH_TOP2B",
"MCW_SP_ChIP56", "Ind6_DOX_TOP2B"
) |> mutate(
Sample = factor(Sample, levels = Sample),
Sample_Det = factor(Sample_Det, levels = Sample_Det)
)
# --- load all cutoff analysis files ---
files <- list.files("data/macs3_broad_out_TOP2B",
pattern = "_cutoff_analysis\\.txt$", full.names = TRUE)
df <- files |>
set_names() |>
map_dfr(~ read_delim(.x, delim = "\t", show_col_types = FALSE), .id = "filepath") |>
mutate(Sample = basename(filepath) |> str_remove("_cutoff_analysis\\.txt")) |>
left_join(metadata, by = "Sample") |>
mutate(Sample_Det = factor(Sample_Det, levels = levels(metadata$Sample_Det))) |>
arrange(Sample_Det, qscore)
# Common x-scale (guarantees tick at 0)
x_fixed <- scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
)
# ---- Plot with linear y-axis (lpeaks) ----
p_linear <- ggplot(df, aes(qscore, lpeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
x_fixed +
scale_y_continuous(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Total Peak Length (bp, linear)") +
theme_minimal(base_size = 12) +
theme(strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank())
# ---- Plot with log10 y-axis (lpeaks) ----
p_log <- df |>
mutate(lpeaks = ifelse(lpeaks <= 0, NA, lpeaks)) |>
ggplot(aes(qscore, lpeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
x_fixed +
scale_y_log10(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Total Peak Length (bp, log10)") +
theme_minimal(base_size = 12) +
theme(strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank())
# ---- Print both ----
p_linear

| Version | Author | Date |
|---|---|---|
| bc515e6 | sayanpaul01 | 2025-08-31 |
p_log

| Version | Author | Date |
|---|---|---|
| bc515e6 | sayanpaul01 | 2025-08-31 |
library(tidyverse)
library(readr)
library(scales)
# --- metadata ---
metadata <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP27", "Ind1_VEH_TOP2B",
"MCW_SP_ChIP28", "Ind1_DOX_TOP2B",
"MCW_SP_ChIP31", "Ind2_VEH_TOP2B",
"MCW_SP_ChIP32", "Ind2_DOX_TOP2B",
"MCW_SP_ChIP39", "Ind3_VEH_TOP2B",
"MCW_SP_ChIP40", "Ind3_DOX_TOP2B",
"MCW_SP_ChIP43", "Ind4_VEH_TOP2B",
"MCW_SP_ChIP44", "Ind4_DOX_TOP2B",
"MCW_SP_ChIP51", "Ind5_VEH_TOP2B",
"MCW_SP_ChIP52", "Ind5_DOX_TOP2B",
"MCW_SP_ChIP55", "Ind6_VEH_TOP2B",
"MCW_SP_ChIP56", "Ind6_DOX_TOP2B"
)
# --- load all cutoff analysis files ---
files <- list.files("data/macs3_narrow_out_TOP2B", pattern = "_cutoff_analysis\\.txt$", full.names = TRUE)
df <- files %>%
set_names() %>%
map_dfr(~ read_delim(.x, delim = "\t", show_col_types = FALSE), .id = "filepath") %>%
mutate(Sample = basename(filepath) %>% str_remove("_cutoff_analysis\\.txt")) %>%
left_join(metadata, by = "Sample")
# ---- Plot with linear y-axis ----
p_linear <- df %>%
ggplot(aes(x = qscore, y = lpeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
) +
scale_y_continuous(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Total Peak Length (bp, linear)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- Plot with log10 y-axis ----
p_log <- df %>%
mutate(lpeaks = ifelse(lpeaks <= 0, NA, lpeaks)) %>%
ggplot(aes(x = qscore, y = lpeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
) +
scale_y_log10(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Total Peak Length (bp, log10)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- Print both ----
p_linear

| Version | Author | Date |
|---|---|---|
| bc515e6 | sayanpaul01 | 2025-08-31 |
p_log

| Version | Author | Date |
|---|---|---|
| bc515e6 | sayanpaul01 | 2025-08-31 |
library(tidyverse)
library(readr)
library(scales)
# --- metadata for p53 ---
metadata_p53 <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP29", "Ind1_VEH_p53",
"MCW_SP_ChIP30", "Ind1_DOX_p53",
"MCW_SP_ChIP33", "Ind2_VEH_p53",
"MCW_SP_ChIP34", "Ind2_DOX_p53",
"MCW_SP_ChIP41", "Ind3_VEH_p53",
"MCW_SP_ChIP42", "Ind3_DOX_p53",
"MCW_SP_ChIP45", "Ind4_VEH_p53",
"MCW_SP_ChIP46", "Ind4_DOX_p53",
"MCW_SP_ChIP53", "Ind5_VEH_p53",
"MCW_SP_ChIP54", "Ind5_DOX_p53",
"MCW_SP_ChIP57", "Ind6_VEH_p53",
"MCW_SP_ChIP58", "Ind6_DOX_p53"
) %>%
mutate(
Sample = factor(Sample, levels = Sample),
Sample_Det = factor(Sample_Det, levels = Sample_Det)
)
# --- load all cutoff-analysis files ---
data_dir <- "data/macs3_narrow_out_P53" # adjust if needed
files <- list.files(data_dir, pattern = "_cutoff_analysis\\.txt$", full.names = TRUE)
df_p53 <- files %>%
set_names() %>%
map_dfr(~ read_delim(.x, delim = "\t", show_col_types = FALSE), .id = "filepath") %>%
mutate(Sample = basename(filepath) %>% str_remove("_cutoff_analysis\\.txt")) %>%
left_join(metadata_p53, by = "Sample") %>%
mutate(Sample_Det = factor(Sample_Det, levels = levels(metadata_p53$Sample_Det))) %>%
arrange(Sample_Det, qscore)
# --------- common x scale (forces 0..7 with a printed 0) ----------
x_fixed <- scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
)
# ---- linear y ----
p_linear_p53 <- ggplot(df_p53, aes(qscore, lpeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
x_fixed +
scale_y_continuous(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Total Peak Length (bp, linear)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- log10 y ----
p_log_p53 <- df_p53 %>%
mutate(lpeaks = ifelse(lpeaks <= 0, NA, lpeaks)) %>%
ggplot(aes(qscore, lpeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
x_fixed +
scale_y_log10(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Total Peak Length (bp, log10)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- show both ----
p_linear_p53

| Version | Author | Date |
|---|---|---|
| bc515e6 | sayanpaul01 | 2025-08-31 |
p_log_p53

| Version | Author | Date |
|---|---|---|
| bc515e6 | sayanpaul01 | 2025-08-31 |
library(tidyverse)
library(readr)
library(scales)
# --- metadata ---
metadata <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP27", "Ind1_VEH_TOP2B",
"MCW_SP_ChIP28", "Ind1_DOX_TOP2B",
"MCW_SP_ChIP31", "Ind2_VEH_TOP2B",
"MCW_SP_ChIP32", "Ind2_DOX_TOP2B",
"MCW_SP_ChIP39", "Ind3_VEH_TOP2B",
"MCW_SP_ChIP40", "Ind3_DOX_TOP2B",
"MCW_SP_ChIP43", "Ind4_VEH_TOP2B",
"MCW_SP_ChIP44", "Ind4_DOX_TOP2B",
"MCW_SP_ChIP51", "Ind5_VEH_TOP2B",
"MCW_SP_ChIP52", "Ind5_DOX_TOP2B",
"MCW_SP_ChIP55", "Ind6_VEH_TOP2B",
"MCW_SP_ChIP56", "Ind6_DOX_TOP2B"
)
# --- load all cutoff analysis files ---
files <- list.files("data/macs3_broad_out_TOP2B_dedup", pattern = "_cutoff_analysis\\.txt$", full.names = TRUE)
df <- files %>%
set_names() %>%
map_dfr(~ read_delim(.x, delim = "\t", show_col_types = FALSE), .id = "filepath") %>%
mutate(Sample = basename(filepath) %>% str_remove("_cutoff_analysis\\.txt")) %>%
left_join(metadata, by = "Sample")
# ---- Plot with linear y-axis ----
p_linear <- df %>%
ggplot(aes(x = qscore, y = lpeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
) +
scale_y_continuous(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Total Peak Length (bp, linear)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- Plot with log10 y-axis ----
p_log <- df %>%
mutate(lpeaks = ifelse(lpeaks <= 0, NA, lpeaks)) %>%
ggplot(aes(x = qscore, y = lpeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
) +
scale_y_log10(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Total Peak Length (bp, log10)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- Print both ----
p_linear

| Version | Author | Date |
|---|---|---|
| bc515e6 | sayanpaul01 | 2025-08-31 |
p_log

| Version | Author | Date |
|---|---|---|
| bc515e6 | sayanpaul01 | 2025-08-31 |
library(tidyverse)
library(readr)
library(scales)
# --- metadata ---
metadata <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP27", "Ind1_VEH_TOP2B",
"MCW_SP_ChIP28", "Ind1_DOX_TOP2B",
"MCW_SP_ChIP31", "Ind2_VEH_TOP2B",
"MCW_SP_ChIP32", "Ind2_DOX_TOP2B",
"MCW_SP_ChIP39", "Ind3_VEH_TOP2B",
"MCW_SP_ChIP40", "Ind3_DOX_TOP2B",
"MCW_SP_ChIP43", "Ind4_VEH_TOP2B",
"MCW_SP_ChIP44", "Ind4_DOX_TOP2B",
"MCW_SP_ChIP51", "Ind5_VEH_TOP2B",
"MCW_SP_ChIP52", "Ind5_DOX_TOP2B",
"MCW_SP_ChIP55", "Ind6_VEH_TOP2B",
"MCW_SP_ChIP56", "Ind6_DOX_TOP2B"
)
# --- load all cutoff analysis files ---
files <- list.files("data/macs3_narrow_out_TOP2B_dedup", pattern = "_cutoff_analysis\\.txt$", full.names = TRUE)
df <- files %>%
set_names() %>%
map_dfr(~ read_delim(.x, delim = "\t", show_col_types = FALSE), .id = "filepath") %>%
mutate(Sample = basename(filepath) %>% str_remove("_cutoff_analysis\\.txt")) %>%
left_join(metadata, by = "Sample")
# ---- Plot with linear y-axis ----
p_linear <- df %>%
ggplot(aes(x = qscore, y = lpeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
) +
scale_y_continuous(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Total Peak Length (bp, linear)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- Plot with log10 y-axis ----
p_log <- df %>%
mutate(lpeaks = ifelse(lpeaks <= 0, NA, lpeaks)) %>%
ggplot(aes(x = qscore, y = lpeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
) +
scale_y_log10(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Total Peak Length (bp, log10)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- Print both ----
p_linear

| Version | Author | Date |
|---|---|---|
| bc515e6 | sayanpaul01 | 2025-08-31 |
p_log

| Version | Author | Date |
|---|---|---|
| bc515e6 | sayanpaul01 | 2025-08-31 |
library(tidyverse)
library(readr)
library(scales)
# --- metadata for p53 ---
metadata_p53 <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP29", "Ind1_VEH_p53",
"MCW_SP_ChIP30", "Ind1_DOX_p53",
"MCW_SP_ChIP33", "Ind2_VEH_p53",
"MCW_SP_ChIP34", "Ind2_DOX_p53",
"MCW_SP_ChIP41", "Ind3_VEH_p53",
"MCW_SP_ChIP42", "Ind3_DOX_p53",
"MCW_SP_ChIP45", "Ind4_VEH_p53",
"MCW_SP_ChIP46", "Ind4_DOX_p53",
"MCW_SP_ChIP53", "Ind5_VEH_p53",
"MCW_SP_ChIP54", "Ind5_DOX_p53",
"MCW_SP_ChIP57", "Ind6_VEH_p53",
"MCW_SP_ChIP58", "Ind6_DOX_p53"
) %>%
mutate(
Sample = factor(Sample, levels = Sample),
Sample_Det = factor(Sample_Det, levels = Sample_Det)
)
# --- load all cutoff-analysis files ---
data_dir <- "data/macs3_narrow_out_P53_dedup"
files <- list.files(data_dir, pattern = "_cutoff_analysis\\.txt$", full.names = TRUE)
df_p53 <- files %>%
set_names() %>%
map_dfr(~ read_delim(.x, delim = "\t", show_col_types = FALSE), .id = "filepath") %>%
mutate(Sample = basename(filepath) %>% str_remove("_cutoff_analysis\\.txt")) %>%
left_join(metadata_p53, by = "Sample") %>%
mutate(Sample_Det = factor(Sample_Det, levels = levels(metadata_p53$Sample_Det))) %>%
arrange(Sample_Det, qscore)
# --------- common x scale (forces 0..7 with a printed 0) ----------
x_fixed <- scale_x_continuous(
limits = c(0, 7),
breaks = 0:7,
labels = as.character(0:7),
expand = c(0, 0)
)
# ---- linear y (lpeaks) ----
p_linear_p53 <- ggplot(df_p53, aes(qscore, lpeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
x_fixed +
scale_y_continuous(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Total Peak Length (bp, linear)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- log10 y (lpeaks) ----
p_log_p53 <- df_p53 %>%
mutate(lpeaks = ifelse(lpeaks <= 0, NA, lpeaks)) %>%
ggplot(aes(qscore, lpeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02") +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 6) +
x_fixed +
scale_y_log10(labels = label_number(big.mark = ",")) +
labs(x = "Q Score", y = "Total Peak Length (bp, log10)") +
theme_minimal(base_size = 12) +
theme(
strip.text = element_text(face = "bold", size = 10),
panel.grid.minor = element_blank()
)
# ---- show both ----
p_linear_p53

| Version | Author | Date |
|---|---|---|
| bc515e6 | sayanpaul01 | 2025-08-31 |
p_log_p53

| Version | Author | Date |
|---|---|---|
| bc515e6 | sayanpaul01 | 2025-08-31 |
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] stats graphics grDevices utils datasets methods 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 grid_4.3.0
[9] timechange_0.3.0 fastmap_1.2.0 rprojroot_2.0.4 workflowr_1.7.1
[13] jsonlite_2.0.0 whisker_0.4.1 promises_1.3.2 jquerylib_0.1.4
[17] cli_3.6.1 crayon_1.5.3 rlang_1.1.3 bit64_4.6.0-1
[21] munsell_0.5.1 withr_3.0.2 cachem_1.1.0 yaml_2.3.10
[25] parallel_4.3.0 tools_4.3.0 tzdb_0.5.0 colorspace_2.1-0
[29] httpuv_1.6.15 vctrs_0.6.5 R6_2.6.1 lifecycle_1.0.4
[33] git2r_0.36.2 bit_4.6.0 fs_1.6.3 vroom_1.6.5
[37] pkgconfig_2.0.3 pillar_1.10.2 bslib_0.9.0 later_1.3.2
[41] gtable_0.3.6 glue_1.7.0 Rcpp_1.0.12 xfun_0.52
[45] tidyselect_1.2.1 rstudioapi_0.17.1 knitr_1.50 farver_2.1.2
[49] htmltools_0.5.8.1 labeling_0.4.3 rmarkdown_2.29 compiler_4.3.0