Last updated: 2021-09-10
Checks: 7 0
Knit directory: hesc-epigenomics/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). 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(20210202)
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 8601f32. 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/bed/
Ignored: data/bw/
Ignored: data/rnaseq/
Ignored: data_backup/
Ignored: figures_data/
Untracked files:
Untracked: Kumar_2021_hESC_data.zip
Untracked: analysis/sup_01_replicates.Rmd
Untracked: data/Lanner_lineagemarker_genes.csv
Untracked: data/Messmer_intermediate_down_top50.txt
Untracked: data/Messmer_intermediate_up_top50.txt
Untracked: data/meta/Kumar_2020_master_bins_10kb_table_final_raw.tsv
Untracked: data/meta/Kumar_2020_master_gene_table_rnaseq_shrunk_annotated.tsv
Untracked: output/
Unstaged changes:
Modified: .gitignore
Modified: analysis/fig_01_quantitative_chip.Rmd
Modified: analysis/master_bins_table.Rmd
Modified: analysis/master_gene_table.Rmd
Modified: analysis/rnaseq_comparison.Rmd
Deleted: data/README.md
Deleted: data/meta/Court_2017_gene_names_uniq.txt
Deleted: data/meta/Kumar_2020_master_gene_table_rnaseq_shrunk_annotated.zip
Deleted: data/meta/Kumar_2020_public_data_plus_layout.csv
Deleted: data/meta/biblio.bib
Deleted: data/meta/colors.R
Deleted: data/meta/style_info.csv
Deleted: data/other/Messmer_2019/Messmer_intermediate_down_top50.txt
Deleted: data/other/Messmer_2019/Messmer_intermediate_up_top50.txt
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/fig_04_intermediate.Rmd
) and HTML (docs/fig_04_intermediate.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 | 8601f32 | C. Navarro | 2021-09-10 | Fig 4 clean |
html | 2f9e4d5 | C. Navarro | 2021-07-08 | Build site. |
Rmd | 29dc324 | C. Navarro | 2021-07-08 | wflow_publish(“./analysis/fig_04_intermediate.Rmd”, verbose = T) |
This is the supplementary notebook for figures 4 and 5.
t <- rbind(genes %>% mutate(
ezh2i = factor(case_when(
RNASeq_DS_EZH2i_vs_Ni_padj < p_cutoff & RNASeq_DS_EZH2i_vs_Ni_log2FoldChange > fc_cutoff ~ "EZH2i up",
RNASeq_DS_EZH2i_vs_Ni_padj < p_cutoff & RNASeq_DS_EZH2i_vs_Ni_log2FoldChange < -fc_cutoff ~ "EZH2i down",
TRUE ~ "unchanged")
)) %>% dplyr::count(ezh2i) %>% mutate(type = "Naive"),
genes %>% mutate(
ezh2i = factor(case_when(
RNASeq_DS_EZH2i_vs_Pr_padj < p_cutoff & RNASeq_DS_EZH2i_vs_Pr_log2FoldChange > fc_cutoff ~ "EZH2i up",
RNASeq_DS_EZH2i_vs_Pr_padj < p_cutoff & RNASeq_DS_EZH2i_vs_Pr_log2FoldChange < -fc_cutoff ~ "EZH2i down",
TRUE ~ "unchanged")
)) %>% dplyr::count(ezh2i) %>% mutate(type = "Primed"))
t$ezh2i <- factor(t$ezh2i, levels = c("EZH2i up", "unchanged", "EZH2i down"))
t$type <- factor(t$type, levels = c("Primed", "Naive"))
ggplot(t, aes(x=type, y=n, fill=ezh2i)) +
geom_bar(stat="identity", position = "fill", color = "black") +
theme_default() +
scale_fill_manual(values = c("#ff9027", "#eeeeee", "#00b9f2" )) +
coord_flip() + labs(y = "Fraction of TSS", x = "All genes", title = "RNA-Seq: EZH2i in naive and primed")
t <- rbind(genes %>% filter(court_bivalent == "Yes") %>% mutate(
ezh2i = factor(case_when(
RNASeq_DS_EZH2i_vs_Ni_padj < p_cutoff & RNASeq_DS_EZH2i_vs_Ni_log2FoldChange > fc_cutoff ~ "EZH2i up",
RNASeq_DS_EZH2i_vs_Ni_padj < p_cutoff & RNASeq_DS_EZH2i_vs_Ni_log2FoldChange < -fc_cutoff ~ "EZH2i down",
TRUE ~ "unchanged")
)) %>% dplyr::count(ezh2i) %>% mutate(type = "Naive"),
genes %>% filter(court_bivalent == "Yes") %>% mutate(
ezh2i = factor(case_when(
RNASeq_DS_EZH2i_vs_Pr_padj < p_cutoff & RNASeq_DS_EZH2i_vs_Pr_log2FoldChange > fc_cutoff ~ "EZH2i up",
RNASeq_DS_EZH2i_vs_Pr_padj < p_cutoff & RNASeq_DS_EZH2i_vs_Pr_log2FoldChange < -fc_cutoff ~ "EZH2i down",
TRUE ~ "unchanged")
)) %>% dplyr::count(ezh2i) %>% mutate(type = "Primed"))
t$ezh2i <- factor(t$ezh2i, levels = c("EZH2i up", "unchanged", "EZH2i down"))
t$type <- factor(t$type, levels = c("Primed", "Naive"))
ggplot(t, aes(x=type, y=n, fill=ezh2i)) +
geom_bar(stat="identity", position = "fill", color = "black") +
theme_default() +
scale_fill_manual(values = c("#ff9027", "#eeeeee", "#00b9f2" )) +
coord_flip() + labs(y = "Fraction of TSS", x = "Bivalent", title = "RNA-Seq: EZH2i in naive and primed")
read_counts_file <- function(f, id_col = 1, count_col = 3, sample_suffix = "") {
counts <- read.delim(file = f, header = TRUE)
counts <- counts[, c(id_col, count_col:ncol(counts)), drop = FALSE]
colnames(counts) <- gsub(sample_suffix, "", colnames(counts))
colnames(counts) <- gsub(pattern = '\\.$', replacement = '', colnames(counts))
counts
}
counts <-
read_counts_file(file.path(
params$rnaseqdir,
"Kumar_2020",
"rsem.merged.gene_counts.tsv"
))
rownames(counts) <- counts$gene_id
counts$gene_id <- NULL
samples.vec <- sort(colnames(counts))
groups <- sub("_[^_]+$", "", samples.vec)
counts <- counts[, samples.vec, drop = FALSE]
coldata <- data.frame(row.names = colnames(counts), condition = groups)
dds <-
DESeqDataSetFromMatrix(
countData = round(counts),
colData = coldata,
design = ~ condition
)
dds <- DESeq(dds)
manual_colors <- scale_color_manual(values = c(
Kumar_2020_Naive = gl_condition_colors[["Naive_Untreated"]],
Kumar_2020_Naive_EZH2i = gl_condition_colors[["Naive_EZH2i"]],
Kumar_2020_Primed = gl_condition_colors[["Primed_Untreated"]],
Kumar_2020_Primed_EZH2i = gl_condition_colors[["Primed_EZH2i"]]
))
vst <- varianceStabilizingTransformation(dds)
plotPCA(vst, ntop=Inf, returnData = F) +
manual_colors +
theme_default() +
labs(title = "RNA-Seq PCA")
Version | Author | Date |
---|---|---|
2f9e4d5 | C. Navarro | 2021-07-08 |
df <- plotPCA(vst, ntop=Inf, returnData = T)
Download PCA data here.
ni_ezh2i_up_rnaseq <- genes %>% filter(RNASeq_DS_EZH2i_vs_Ni_padj < p_cutoff & RNASeq_DS_EZH2i_vs_Ni_log2FoldChange > fc_cutoff)
pr_ezh2i_up_rnaseq <- genes %>% filter(RNASeq_DS_EZH2i_vs_Pr_padj < p_cutoff & RNASeq_DS_EZH2i_vs_Pr_log2FoldChange > fc_cutoff)
genes$class <- "None"
common <- intersect(ni_ezh2i_up_rnaseq$name, pr_ezh2i_up_rnaseq$name)
genes[genes$name %in% common, "class"] <- "Both_EZH2i_up"
genes[genes$name %in% setdiff(ni_ezh2i_up_rnaseq$name, common), "class"] <- "Ni_EZH2i_up"
genes[genes$name %in% setdiff(pr_ezh2i_up_rnaseq$name, common), "class"] <- "Pr_EZH2i_up"
class_tab <- table(dplyr::select(genes, "k27_bivalency_grp", "class"))
colSums(class_tab)
Both_EZH2i_up Ni_EZH2i_up None Pr_EZH2i_up
169 1725 24243 349
mean_cutoff_pr <- quantile(genes[["H3K27m3_Pr_mean_cov"]], 0.8)
mean_cutoff_ni <- quantile(genes[["H3K27m3_Ni_mean_cov"]], 0.8)
# genes$has_ni_k27 <- "No"
# genes[genes$H3K27m3_Ni_mean_cov > mean_cutoff_ni, "has_ni_k27"] <- "Yes"
#
# genes$has_pr_k27 <- "No"
# genes[genes$H3K27m3_Pr_mean_cov > mean_cutoff_pr, "has_pr_k27"] <- "Yes"
genes$has_ni_k27 <- "No_K27_Ni"
genes[genes$H3K27m3_Ni_mean_cov > mean_cutoff_ni, "has_ni_k27"] <- "Yes_K27_Ni"
genes$has_pr_k27 <- "No_K27_Pr"
genes[genes$H3K27m3_Pr_mean_cov > mean_cutoff_pr, "has_pr_k27"] <- "Yes_K27_Pr"
dplyr::count(genes, has_ni_k27, has_pr_k27, class) %>% arrange(class)
has_ni_k27 has_pr_k27 class n
1 No_K27_Ni No_K27_Pr Both_EZH2i_up 17
2 No_K27_Ni Yes_K27_Pr Both_EZH2i_up 41
3 Yes_K27_Ni No_K27_Pr Both_EZH2i_up 5
4 Yes_K27_Ni Yes_K27_Pr Both_EZH2i_up 106
5 No_K27_Ni No_K27_Pr Ni_EZH2i_up 793
6 No_K27_Ni Yes_K27_Pr Ni_EZH2i_up 273
7 Yes_K27_Ni No_K27_Pr Ni_EZH2i_up 233
8 Yes_K27_Ni Yes_K27_Pr Ni_EZH2i_up 426
9 No_K27_Ni No_K27_Pr None 17709
10 No_K27_Ni Yes_K27_Pr None 2195
11 Yes_K27_Ni No_K27_Pr None 2379
12 Yes_K27_Ni Yes_K27_Pr None 1960
13 No_K27_Ni No_K27_Pr Pr_EZH2i_up 42
14 No_K27_Ni Yes_K27_Pr Pr_EZH2i_up 121
15 Yes_K27_Ni No_K27_Pr Pr_EZH2i_up 11
16 Yes_K27_Ni Yes_K27_Pr Pr_EZH2i_up 175
genes_list <- read.table("./data/Messmer_intermediate_down_top50.txt",
header = F)
fig <- combined_heatmap(
genes,
genes_list[, 1],
rnaseq_limits = c(0, 12.5),
k4m3_limits = c(0, 80),
k27m3_limits = c(0, 11),
ub_limits = c(0, 11)
)
fig
orca(fig, "./output/fig5_messmer_intermediate_top_50_up_global_scale.svg", width = 9, height = 9, more_args = c('--disable-gpu'))
genes_list <- read.table("./data/Messmer_intermediate_up_top50.txt",
header = F)
fig <- combined_heatmap(
genes,
genes_list[, 1],
rnaseq_limits = c(0, 12.5),
k4m3_limits = c(0, 80),
k27m3_limits = c(0, 11),
ub_limits = c(0, 11)
)
fig
orca(fig, "./output/fig4_messmer_intermediate_top_50_down_global_scale.svg", width = 9, height = 9, more_args = c('--disable-gpu'))
genes_list <-
c("EPAS1",
"MSX2",
"GATA3",
"NR2F2",
"CLDN4",
"GATA2",
"IGF2",
"CDX2",
"SLC40A1",
"KRT7",
"FRZB",
"CGA",
"ERP27",
"KRT23",
"CGB5",
"VGLL1",
"ENPEP",
"TP63"
)
fig <- combined_heatmap(genes, genes_list, cluster_rows = F,
rnaseq_limits = c(0, 12.5),
k4m3_limits = c(0, 80),
k27m3_limits = c(0, 12),
ub_limits = c(0, 12))
fig
orca(fig, "./output/fig5_heatmap_lineage_specific_global_scale_new.svg", width = 9, height = 9, more_args = c('--disable-gpu'))
sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=sv_SE.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=sv_SE.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=sv_SE.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=sv_SE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats4 stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] svglite_2.0.0 heatmaply_1.2.1
[3] viridis_0.6.1 viridisLite_0.4.0
[5] plotly_4.9.4.1 wigglescout_0.13.1
[7] cowplot_1.1.1 DESeq2_1.32.0
[9] SummarizedExperiment_1.22.0 Biobase_2.52.0
[11] MatrixGenerics_1.4.0 matrixStats_0.60.1
[13] ggrastr_0.2.3 forcats_0.5.1
[15] stringr_1.4.0 dplyr_1.0.7
[17] purrr_0.3.4 readr_1.4.0
[19] tidyr_1.1.3 tibble_3.1.4
[21] ggplot2_3.3.5 tidyverse_1.3.1
[23] rtracklayer_1.52.0 GenomicRanges_1.44.0
[25] GenomeInfoDb_1.28.1 IRanges_2.26.0
[27] S4Vectors_0.30.0 BiocGenerics_0.38.0
[29] workflowr_1.6.2
loaded via a namespace (and not attached):
[1] readxl_1.3.1 backports_1.2.1 systemfonts_1.0.2
[4] plyr_1.8.6 lazyeval_0.2.2 splines_4.1.1
[7] crosstalk_1.1.1 BiocParallel_1.26.0 listenv_0.8.0
[10] digest_0.6.27 foreach_1.5.1 htmltools_0.5.2
[13] fansi_0.5.0 magrittr_2.0.1 memoise_2.0.0
[16] globals_0.14.0 Biostrings_2.60.2 annotate_1.70.0
[19] modelr_0.1.8 askpass_1.1 colorspace_2.0-2
[22] blob_1.2.2 rvest_1.0.0 haven_2.4.1
[25] xfun_0.24 crayon_1.4.1 RCurl_1.98-1.4
[28] jsonlite_1.7.2 genefilter_1.74.0 iterators_1.0.13
[31] survival_3.2-13 glue_1.4.2 registry_0.5-1
[34] gtable_0.3.0 zlibbioc_1.38.0 XVector_0.32.0
[37] webshot_0.5.2 DelayedArray_0.18.0 scales_1.1.1
[40] DBI_1.1.1 Rcpp_1.0.7 xtable_1.8-4
[43] bit_4.0.4 htmlwidgets_1.5.3 httr_1.4.2
[46] RColorBrewer_1.1-2 ellipsis_0.3.2 farver_2.1.0
[49] pkgconfig_2.0.3 XML_3.99-0.7 sass_0.4.0
[52] dbplyr_2.1.1 locfit_1.5-9.4 utf8_1.2.2
[55] labeling_0.4.2 tidyselect_1.1.1 rlang_0.4.11
[58] reshape2_1.4.4 later_1.3.0 AnnotationDbi_1.54.1
[61] munsell_0.5.0 cellranger_1.1.0 tools_4.1.1
[64] cachem_1.0.6 cli_3.0.1 generics_0.1.0
[67] RSQLite_2.2.8 broom_0.7.8 evaluate_0.14
[70] fastmap_1.1.0 yaml_2.2.1 processx_3.5.2
[73] knitr_1.33 bit64_4.0.5 fs_1.5.0
[76] KEGGREST_1.32.0 dendextend_1.15.1 future_1.21.0
[79] whisker_0.4 xml2_1.3.2 compiler_4.1.1
[82] rstudioapi_0.13 beeswarm_0.4.0 png_0.1-7
[85] reprex_2.0.0 geneplotter_1.70.0 bslib_0.2.5.1
[88] stringi_1.7.4 ps_1.6.0 highr_0.9
[91] lattice_0.20-44 Matrix_1.3-4 vctrs_0.3.8
[94] pillar_1.6.2 lifecycle_1.0.0 furrr_0.2.3
[97] jquerylib_0.1.4 data.table_1.14.0 bitops_1.0-7
[100] seriation_1.3.0 httpuv_1.6.2 R6_2.5.1
[103] BiocIO_1.2.0 TSP_1.1-10 promises_1.2.0.1
[106] gridExtra_2.3 vipor_0.4.5 parallelly_1.26.1
[109] codetools_0.2-18 assertthat_0.2.1 openssl_1.4.4
[112] rprojroot_2.0.2 rjson_0.2.20 withr_2.4.2
[115] GenomicAlignments_1.28.0 Rsamtools_2.8.0 GenomeInfoDbData_1.2.6
[118] hms_1.1.0 grid_4.1.1 rmarkdown_2.9
[121] git2r_0.28.0 lubridate_1.7.10 ggbeeswarm_0.6.0
[124] restfulr_0.0.13