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 9db528a. 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_Calling_cutoff_CTCF_RAD21.Rmd
Untracked: data/macs3_narrow_out_CTCF/
Untracked: data/macs3_narrow_out_CTCF_dedup/
Untracked: data/macs3_narrow_out_RAD21/
Untracked: data/macs3_narrow_out_RAD21_dedup/
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.
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) # 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 (CTCF) ---
metadata <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP63", "Ind1_VEH_CTCF",
"MCW_SP_ChIP64", "Ind1_DOX_CTCF",
"MCW_SP_ChIP65", "Ind2_VEH_CTCF",
"MCW_SP_ChIP66", "Ind2_DOX_CTCF",
"MCW_SP_ChIP67", "Ind3_VEH_CTCF",
"MCW_SP_ChIP68", "Ind3_DOX_CTCF"
) |> mutate(
Sample = factor(Sample, levels = Sample),
Sample_Det = factor(Sample_Det, levels = Sample_Det)
)
# --- load all cutoff-analysis files (CTCF narrow peaks) ---
files <- list.files("data/macs3_narrow_out_CTCF",
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 through 7)
# Common x-axis (ticks only; no limits here)
x_ticks <- scale_x_continuous(
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", na.rm = TRUE) +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 3) +
x_ticks +
coord_cartesian(xlim = c(0, 7)) + # zoom without dropping rows
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_real_, npeaks)) %>% # log can't show 0/neg
ggplot(aes(qscore, npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02", na.rm = TRUE) + # drop NA quietly
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 3) +
x_ticks +
coord_cartesian(xlim = c(0, 7)) + # no row removal
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())
p_linear
p_log
library(tidyverse)
library(readr)
library(scales) # for label_number()
# --- metadata (RAD21) ---
metadata <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP69", "Ind1_VEH_RAD21",
"MCW_SP_ChIP70", "Ind1_DOX_RAD21",
"MCW_SP_ChIP71", "Ind2_VEH_RAD21",
"MCW_SP_ChIP72", "Ind2_DOX_RAD21",
"MCW_SP_ChIP73", "Ind3_VEH_RAD21",
"MCW_SP_ChIP74", "Ind3_DOX_RAD21"
) |>
mutate(
Sample = factor(Sample, levels = Sample),
Sample_Det = factor(Sample_Det, levels = Sample_Det)
)
# --- load cutoff-analysis files (RAD21 narrow peaks) ---
files <- list.files("data/macs3_narrow_out_RAD21",
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)
# X-axis ticks (0..7) and view window without dropping rows
x_ticks <- scale_x_continuous(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", na.rm = TRUE) +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 3) +
x_ticks + coord_cartesian(xlim = c(0, 7)) +
scale_y_continuous(labels = scales::label_number(big.mark = ",")) +
labs(title = "RAD21 narrow peaks across samples (before deduplication)",
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.title = element_text(hjust = 0.5, face = "bold"))
# ---- Plot with log10 y-axis ----
p_log <- df |>
mutate(npeaks = ifelse(npeaks <= 0, NA_real_, npeaks)) |>
ggplot(aes(qscore, npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02", na.rm = TRUE) +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 3) +
x_ticks + coord_cartesian(xlim = c(0, 7)) +
scale_y_log10(labels = scales::label_number(big.mark = ",")) +
labs(title = "RAD21 narrow peaks across samples (before deduplication)",
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(),
plot.title = element_text(hjust = 0.5, face = "bold"))
# ---- Print both ----
p_linear
p_log
library(tidyverse)
library(readr)
library(scales) # for label_number()
# --- metadata (CTCF) ---
metadata <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP63", "Ind1_VEH_CTCF",
"MCW_SP_ChIP64", "Ind1_DOX_CTCF",
"MCW_SP_ChIP65", "Ind2_VEH_CTCF",
"MCW_SP_ChIP66", "Ind2_DOX_CTCF",
"MCW_SP_ChIP67", "Ind3_VEH_CTCF",
"MCW_SP_ChIP68", "Ind3_DOX_CTCF"
) |> mutate(
Sample = factor(Sample, levels = Sample),
Sample_Det = factor(Sample_Det, levels = Sample_Det)
)
# --- load all cutoff-analysis files (CTCF narrow peaks) ---
files <- list.files("data/macs3_narrow_out_CTCF_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") |>
mutate(Sample_Det = factor(Sample_Det, levels = levels(metadata$Sample_Det))) |>
arrange(Sample_Det, qscore)
# Common x-scale (guarantees tick at 0 through 7)
# Common x-axis (ticks only; no limits here)
x_ticks <- scale_x_continuous(
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", na.rm = TRUE) +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 3) +
x_ticks +
coord_cartesian(xlim = c(0, 7)) + # zoom without dropping rows
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())
# ---- Plot with log10 y-axis ----
p_log <- df %>%
mutate(npeaks = ifelse(npeaks <= 0, NA_real_, npeaks)) %>% # log can't show 0/neg
ggplot(aes(qscore, npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02", na.rm = TRUE) + # drop NA quietly
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 3) +
x_ticks +
coord_cartesian(xlim = c(0, 7)) + # no row removal
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())
p_linear
p_log
library(tidyverse)
library(readr)
library(scales) # for label_number()
# --- metadata (RAD21) ---
metadata <- tribble(
~Sample, ~Sample_Det,
"MCW_SP_ChIP69", "Ind1_VEH_RAD21",
"MCW_SP_ChIP70", "Ind1_DOX_RAD21",
"MCW_SP_ChIP71", "Ind2_VEH_RAD21",
"MCW_SP_ChIP72", "Ind2_DOX_RAD21",
"MCW_SP_ChIP73", "Ind3_VEH_RAD21",
"MCW_SP_ChIP74", "Ind3_DOX_RAD21"
) |>
mutate(
Sample = factor(Sample, levels = Sample),
Sample_Det = factor(Sample_Det, levels = Sample_Det)
)
# --- load cutoff-analysis files (RAD21 narrow peaks) ---
files <- list.files("data/macs3_narrow_out_RAD21_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") |>
mutate(Sample_Det = factor(Sample_Det, levels = levels(metadata$Sample_Det))) |>
arrange(Sample_Det, qscore)
# X-axis ticks (0..7) and view window without dropping rows
x_ticks <- scale_x_continuous(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", na.rm = TRUE) +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 3) +
x_ticks + coord_cartesian(xlim = c(0, 7)) +
scale_y_continuous(labels = scales::label_number(big.mark = ",")) +
labs(title = "RAD21 narrow peaks across samples (after deduplication)",
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.title = element_text(hjust = 0.5, face = "bold"))
# ---- Plot with log10 y-axis ----
p_log <- df |>
mutate(npeaks = ifelse(npeaks <= 0, NA_real_, npeaks)) |>
ggplot(aes(qscore, npeaks, group = Sample)) +
geom_line(size = 0.8, color = "#d95f02", na.rm = TRUE) +
facet_wrap(~ Sample_Det, scales = "free_y", ncol = 3) +
x_ticks + coord_cartesian(xlim = c(0, 7)) +
scale_y_log10(labels = scales::label_number(big.mark = ",")) +
labs(title = "RAD21 narrow peaks across samples (after deduplication)",
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(),
plot.title = element_text(hjust = 0.5, face = "bold"))
# ---- Print both ----
p_linear
p_log
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 promises_1.3.2 jquerylib_0.1.4 cli_3.6.1
[17] crayon_1.5.3 rlang_1.1.3 bit64_4.6.0-1 munsell_0.5.1
[21] withr_3.0.2 cachem_1.1.0 yaml_2.3.10 parallel_4.3.0
[25] tools_4.3.0 tzdb_0.5.0 colorspace_2.1-0 httpuv_1.6.15
[29] vctrs_0.6.5 R6_2.6.1 lifecycle_1.0.4 git2r_0.36.2
[33] bit_4.6.0 fs_1.6.3 vroom_1.6.5 pkgconfig_2.0.3
[37] pillar_1.10.2 bslib_0.9.0 later_1.3.2 gtable_0.3.6
[41] glue_1.7.0 Rcpp_1.0.12 xfun_0.52 tidyselect_1.2.1
[45] rstudioapi_0.17.1 knitr_1.50 farver_2.1.2 htmltools_0.5.8.1
[49] labeling_0.4.3 rmarkdown_2.29 compiler_4.3.0