Last updated: 2022-05-10
Checks: 6 1
Knit directory:
apocrine_signature_mdamb453/
This reproducible R Markdown analysis was created with workflowr (version 1.7.0). 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 staged 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(20220427) 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 b7c5dfd. 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/
Ignored: data/bigwig/
Unstaged changes:
Modified: analysis/comparison.Rmd
Staged changes:
Modified: analysis/_site.yml
New: analysis/comparison.Rmd
Modified: analysis/index.Rmd
New: data/annotations
New: data/external/ApoGenes.txt
New: data/external/hgnc-symbol-check.csv
New: data/h3k27ac/SE.gtf
New: data/h3k27ac/enhancers.bed
New: data/h3k27ac/promoters.bed
New: data/hichip/gi_10000_cis.rds
New: data/hichip/gi_20000_cis.rds
New: data/hichip/gi_40000_cis.rds
New: data/hichip/gi_5000_cis.rds
New: data/rnaseq/counts.out.gz
New: data/rnaseq/dge.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.
There are no past versions. Publish this analysis with
wflow_publish() to start tracking its development.
library(tidyverse)
library(magrittr)
library(extraChIPs)
library(plyranges)
library(pander)
library(scales)
library(reactable)
library(htmltools)
library(UpSetR)
library(rtracklayer)
library(GenomicInteractions)
theme_set(theme_bw())
dht_peaks <- here::here("data", "peaks") %>%
list.files(recursive = TRUE, pattern = "oracle", full.names = TRUE) %>%
sapply(read_rds, simplify = FALSE) %>%
lapply(function(x) x[["DHT"]]) %>%
lapply(setNames, nm = c()) %>%
setNames(str_extract_all(names(.), "AR|FOXA1|GATA3|TFAP2B"))
dht_consensus <- dht_peaks %>%
lapply(granges) %>%
GRangesList() %>%
unlist() %>%
reduce() %>%
mutate(
AR = overlapsAny(., dht_peaks$AR),
FOXA1 = overlapsAny(., dht_peaks$FOXA1),
GATA3 = overlapsAny(., dht_peaks$GATA3),
TFAP2B = overlapsAny(., dht_peaks$TFAP2B),
)
targets <- names(dht_peaks)
sq <- seqinfo(dht_consensus)
Oracle peaks from the DHT-treated samples in each ChIP target were obtained previously using the GRAVI workflow. AR and GATA3 peaks were derived from the same samples/passages, whilst FOXA1 and TFAP2B ChIP-Seq experiments were performed separately.
cp <- htmltools::tags$em(
"Summary of all oracle peaks from DHT-treated samples. FOXA1 clearly showed the most binding activity."
)
tbl <- dht_peaks %>%
lapply(
function(x) {
tibble(
n = length(x),
w = median(width(x)),
kb = sum(width(x)) / 1e3
)
}
) %>%
lapply(list) %>%
as_tibble() %>%
pivot_longer(cols = everything(), names_to = "target") %>%
unnest(everything()) %>%
reactable(
filterable = FALSE, searchable = FALSE,
columns = list(
target = colDef(name = "ChIP Target"),
n = colDef(name = "Total Peaks"),
w = colDef(name = "Median Width"),
kb = colDef(name = "Total Width (kb)", format = colFormat(digits = 1))
),
defaultColDef = colDef(
format = colFormat(separators = TRUE, digits = 0)
)
)
div(class = "table",
div(class = "table-header",
div(class = "caption", cp),
tbl
)
)
A set of target-agnostic set of binding regions was then defined as the union of all DHT-treat peaks across all targets.
dht_consensus %>%
as_tibble() %>%
pivot_longer(cols = all_of(targets), names_to = "target", values_to = "bound") %>%
dplyr::filter(bound) %>%
split(.$target) %>%
lapply(pull, "range") %>%
fromList() %>%
upset(
sets = rev(targets), keep.order = TRUE,
order.by = "freq",
set_size.show = TRUE, set_size.scale_max = nrow(.)
)
Using the union of all binding regions, those which overlapped an oracle peak from each ChIP target are shown
In order to more fully characterise the function of each binding region, the set of all regions was mapped to genes. To perform this step, externally-sourced data defining promoters & enhancers (H3K27ac ChIP-Seq), and H3K27ac-HiChIP obtained from SRA and analysed previously, were included. The H3K27ac-derived features were obtained from the same passages/experiments as GATA3 and AR. Conversely, the HiChIP data was obtained from a public dataset, not produced with the DRMCRL. HiChIP interactions were obtained using only the Vehicle controls from an Abemaciclib Vs. Vehicle experiment.
features <- here::here("data", "h3k27ac") %>%
list.files(full.names = TRUE, pattern = "bed$") %>%
sapply(import.bed, seqinfo = sq) %>%
lapply(granges) %>%
setNames(basename(names(.))) %>%
setNames(str_remove_all(names(.), "s.bed")) %>%
GRangesList() %>%
unlist() %>%
names_to_column("feature") %>%
sort()
fl <- here::here("data", "hichip") %>%
list.files(full.names = TRUE, pattern = "gi.+rds")
hic <- GInteractions()
for (f in fl) {
hic <- c(hic, read_rds(f))
}
hic <- sort(hic)
Before proceeding, the comparability of the H3K27ac-HiChIP and H3K27ac-derived features was checked. 93% of HiChIP long-range interactions overlapped a promoter or enhancer derived from H3K27ac ChIP-seq. Conversely, 86% or ChIP-Seq features mapped to a long-range interaction.
all_gr <- here::here("data", "annotations", "all_gr.rds") %>%
read_rds()
rnaseq <- here::here("data", "rnaseq", "dge.rds") %>%
read_rds()
counts <- here::here("data", "rnaseq", "counts.out.gz") %>%
read_tsv(skip = 1) %>%
dplyr::select(Geneid, ends_with("bam"))
detected <- counts %>%
pivot_longer(
cols = ends_with("bam"), names_to = "sample", values_to = "counts"
) %>%
mutate(detected = counts > 0) %>%
group_by(Geneid) %>%
summarise(detected = mean(detected) > 0.25, .groups = "drop") %>%
dplyr::filter(detected) %>%
pull("Geneid")
In order to more accurately assign genes to actively transcribed genes, the RNA-Seq dataset generated in 2013 studying DHT Vs. Vehicle in MDA-MB-453 cells was used. All 21,328 genes with >1 read in at least 1/4 of the samples was considered to be detected, and peaks were only mapped to detected genes.
dht_consensus <- mapByFeature(
dht_consensus,
genes = subset(all_gr$gene, gene_id %in% detected),
prom = subset(features, feature == "promoter"),
enh = subset(features, feature == "enhancer"),
gi = hic
)
all_targets <- dht_consensus %>%
as_tibble() %>%
dplyr::filter(if_all(targets)) %>%
unnest(everything()) %>%
distinct(gene_id) %>%
pull("gene_id")
92% of detected genes had one or more peaks mapped to them.
Looking specifically at the peaks for which all four targets directly overlapped, 10,743 of the 21,328 detected genes were mapped to at least one directly overlapping binding region.
hgnc <- read_csv(
here::here("data", "external", "hgnc-symbol-check.csv"), skip = 1
) %>%
dplyr::select(Gene = Input, gene_name = `Approved symbol`)
apo_ranks <- here::here("data", "external", "ApoGenes.txt") %>%
read_tsv() %>%
left_join(hgnc) %>%
left_join(
as_tibble(all_gr$gene) %>%
dplyr::select(gene_id, gene_name),
by = "gene_name"
) %>%
dplyr::select(starts_with("gene_"), ends_with("rank")) %>%
dplyr::filter(!is.na(gene_id))
The Apocrine genes and ranks from Farmer et al were loaded, updating gene names using the latest release from HGNC. 10,669 of the original genes were able to be mapped to gene identifiers matching Gencode release 33.
For the purposes of simple exploration, the provided list was sorted
by apo_rank and the proportion of genes mapped to at least
one set of overlapping peaks was compared to these ranks.
apo_ranks %>%
arrange(apo_rank) %>%
mutate(
all = gene_id %in% all_targets,
n = cumsum(all),
p = n / apo_rank
) %>%
ggplot(aes(apo_rank, p)) +
geom_line() +
coord_cartesian(xlim= c(0, 1000), ylim = c(0.6, 1))

The same approach was applied to AB ranks
apo_ranks %>%
dplyr::filter(!is.na(ABrank)) %>%
arrange(ABrank) %>%
mutate(
ABrank = seq_along(ABrank),
all = gene_id %in% all_targets,
n = cumsum(all),
p = n / ABrank
) %>%
ggplot(aes(ABrank, p)) +
geom_line()

The same approach was applied to AL ranks
apo_ranks %>%
dplyr::filter(!is.na(ALrank)) %>%
arrange(ALrank) %>%
mutate(
ALrank = seq_along(ALrank),
all = gene_id %in% all_targets,
n = cumsum(all),
p = n / ALrank
) %>%
ggplot(aes(ALrank, p)) +
geom_line()

sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8
[5] LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8
[7] LC_PAPER=en_AU.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] GenomicInteractions_1.30.0 InteractionSet_1.24.0
[3] rtracklayer_1.56.0 UpSetR_1.4.0
[5] htmltools_0.5.2 reactable_0.2.3
[7] scales_1.2.0 pander_0.6.5
[9] plyranges_1.16.0 extraChIPs_1.0.0
[11] SummarizedExperiment_1.26.1 Biobase_2.56.0
[13] MatrixGenerics_1.8.0 matrixStats_0.62.0
[15] GenomicRanges_1.48.0 GenomeInfoDb_1.32.1
[17] IRanges_2.30.0 S4Vectors_0.34.0
[19] BiocGenerics_0.42.0 BiocParallel_1.30.0
[21] magrittr_2.0.3 forcats_0.5.1
[23] stringr_1.4.0 dplyr_1.0.9
[25] purrr_0.3.4 readr_2.1.2
[27] tidyr_1.2.0 tibble_3.1.6
[29] ggplot2_3.3.5 tidyverse_1.3.1
[31] workflowr_1.7.0
loaded via a namespace (and not attached):
[1] utf8_1.2.2 tidyselect_1.1.2 RSQLite_2.2.13
[4] AnnotationDbi_1.58.0 htmlwidgets_1.5.4 grid_4.2.0
[7] scatterpie_0.1.7 munsell_0.5.0 codetools_0.2-18
[10] withr_2.5.0 colorspace_2.0-3 filelock_1.0.2
[13] highr_0.9 knitr_1.39 rstudioapi_0.13
[16] ggside_0.2.0 labeling_0.4.2 git2r_0.30.1
[19] GenomeInfoDbData_1.2.8 polyclip_1.10-0 farver_2.1.0
[22] bit64_4.0.5 rprojroot_2.0.3 vctrs_0.4.1
[25] generics_0.1.2 xfun_0.30 biovizBase_1.44.0
[28] csaw_1.30.0 BiocFileCache_2.4.0 R6_2.5.1
[31] doParallel_1.0.17 clue_0.3-60 locfit_1.5-9.5
[34] AnnotationFilter_1.20.0 bitops_1.0-7 cachem_1.0.6
[37] DelayedArray_0.22.0 assertthat_0.2.1 vroom_1.5.7
[40] promises_1.2.0.1 BiocIO_1.6.0 nnet_7.3-17
[43] gtable_0.3.0 processx_3.5.3 ensembldb_2.20.1
[46] rlang_1.0.2 GlobalOptions_0.1.2 splines_4.2.0
[49] lazyeval_0.2.2 dichromat_2.0-0.1 broom_0.8.0
[52] checkmate_2.1.0 yaml_2.3.5 modelr_0.1.8
[55] crosstalk_1.2.0 GenomicFeatures_1.48.0 backports_1.4.1
[58] httpuv_1.6.5 Hmisc_4.7-0 EnrichedHeatmap_1.26.0
[61] tools_4.2.0 ellipsis_0.3.2 jquerylib_0.1.4
[64] RColorBrewer_1.1-3 plyr_1.8.7 Rcpp_1.0.8.3
[67] base64enc_0.1-3 progress_1.2.2 zlibbioc_1.42.0
[70] RCurl_1.98-1.6 ps_1.7.0 prettyunits_1.1.1
[73] rpart_4.1.16 GetoptLong_1.0.5 reactR_0.4.4
[76] ggrepel_0.9.1 haven_2.5.0 cluster_2.1.3
[79] here_1.0.1 fs_1.5.2 data.table_1.14.2
[82] circlize_0.4.14 reprex_2.0.1 whisker_0.4
[85] ProtGenerics_1.28.0 hms_1.1.1 evaluate_0.15
[88] XML_3.99-0.9 jpeg_0.1-9 readxl_1.4.0
[91] gridExtra_2.3 shape_1.4.6 compiler_4.2.0
[94] biomaRt_2.52.0 crayon_1.5.1 ggfun_0.0.6
[97] later_1.3.0 tzdb_0.3.0 Formula_1.2-4
[100] lubridate_1.8.0 DBI_1.1.2 tweenr_1.0.2
[103] dbplyr_2.1.1 ComplexHeatmap_2.12.0 MASS_7.3-56
[106] rappdirs_0.3.3 Matrix_1.4-1 cli_3.3.0
[109] parallel_4.2.0 Gviz_1.40.0 metapod_1.4.0
[112] igraph_1.3.1 pkgconfig_2.0.3 getPass_0.2-2
[115] GenomicAlignments_1.32.0 foreign_0.8-82 xml2_1.3.3
[118] foreach_1.5.2 bslib_0.3.1 XVector_0.36.0
[121] rvest_1.0.2 VariantAnnotation_1.42.0 callr_3.7.0
[124] digest_0.6.29 Biostrings_2.64.0 rmarkdown_2.14
[127] cellranger_1.1.0 htmlTable_2.4.0 edgeR_3.38.0
[130] restfulr_0.0.13 curl_4.3.2 Rsamtools_2.12.0
[133] rjson_0.2.21 lifecycle_1.0.1 jsonlite_1.8.0
[136] limma_3.52.0 BSgenome_1.64.0 fansi_1.0.3
[139] pillar_1.7.0 lattice_0.20-45 KEGGREST_1.36.0
[142] fastmap_1.1.0 httr_1.4.2 survival_3.2-13
[145] glue_1.6.2 png_0.1-7 iterators_1.0.14
[148] bit_4.0.4 ggforce_0.3.3 stringi_1.7.6
[151] sass_0.4.1 blob_1.2.3 latticeExtra_0.6-29
[154] memoise_2.0.1