Last updated: 2021-07-08

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 2f76ac2. 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/igv/
    Ignored:    data/liftover/
    Ignored:    data/other/
    Ignored:    data/peaks
    Ignored:    data/rnaseq/
    Ignored:    figures_data/

Untracked files:
    Untracked:  analysis/fig_04_intermediate.Rmd
    Untracked:  data/meta/Kumar_2020_bins_panels_design.csv
    Untracked:  data/meta/Kumar_2020_master_bins_10kb_table_raw.tsv
    Untracked:  data/meta/Kumar_2020_master_bins_5kb_table_raw.tsv
    Untracked:  data/meta/Kumar_2020_master_bins_5kb_table_raw.zip
    Untracked:  data/meta/Kumar_2020_master_bins_5kb_table_replicates_only.tsv
    Untracked:  data/meta/Kumar_2020_master_bins_5kb_table_shrunk.tsv
    Untracked:  data/meta/Kumar_2020_master_bins_5kb_table_shrunk.zip
    Untracked:  data/meta/Kumar_2020_master_gene_table.zip
    Untracked:  data/meta/Kumar_2020_master_gene_table_rnaseq_shrunk.tsv
    Untracked:  data/meta/Kumar_2020_master_gene_table_rnaseq_shrunk_plus_annotations.tsv
    Untracked:  data/meta/Kumar_2020_master_gene_table_rnaseq_shrunk_plus_annotations.zip
    Untracked:  data/meta/Kumar_2020_promoters_panels_design.csv
    Untracked:  data/meta/gene_names_bivalent.tsv
    Untracked:  output/fig2_chr_means_boxplot.svg
    Untracked:  output/fig3_violin_rnaseq_ratios_naive_higher_than_pr.svg
    Untracked:  output/fig3_violin_rnaseq_ratios_primed_higher_than_ni.svg
    Untracked:  output/fig4_lineage_makers_new.png
    Untracked:  output/fig4_lineage_makers_new.svg
    Untracked:  output/fig4_lineage_markers_new.png
    Untracked:  output/fig4_lineage_markers_new.svg
    Untracked:  output/fig4_lineage_markers_new_cluster.png
    Untracked:  output/fig4_lineage_markers_new_cluster.svg
    Untracked:  output/fig4_lineage_markers_new_k4.png
    Untracked:  output/fig4_lineage_markers_new_k4.svg
    Untracked:  output/fig4_messmer_top25.png
    Untracked:  output/fig4_messmer_top25.svg
    Untracked:  output/fig4_messmer_top25_down.png
    Untracked:  output/fig4_messmer_top25_down.svg
    Untracked:  output/fig4_messmer_top25_up.png
    Untracked:  output/fig4_messmer_top25_up.svg
    Untracked:  output/fig4_messmer_top50_down.png
    Untracked:  output/fig4_messmer_top50_down.svg
    Untracked:  output/fig4_messmer_top50_up.png
    Untracked:  output/fig4_messmer_top50_up.svg
    Untracked:  output/fig4_pca_all_plus_dong_data.svg
    Untracked:  output/fig4_pca_only_our_samples.svg
    Untracked:  output/fig4_pca_only_our_samples_labeled.svg
    Untracked:  output/fig4_pluripotency_markers_new.png
    Untracked:  output/fig4_pluripotency_markers_new.svg
    Untracked:  output/fig4_pluripotency_markers_new_cluster.png
    Untracked:  output/fig4_pluripotency_markers_new_cluster.svg
    Untracked:  output/promoter_panels_final/

Unstaged changes:
    Modified:   .gitignore
    Modified:   analysis/index.Rmd
    Modified:   analysis/rnaseq_comparison.Rmd

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_02_x_chromosome.Rmd) and HTML (docs/fig_02_x_chromosome.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 2f76ac2 C. Navarro 2021-07-08 wflow_publish(“./analysis/fig_02_x_chromosome.Rmd”, verbose = T)
html 51c57d8 C. Navarro 2021-07-07 Build site.
Rmd d3fb55c C. Navarro 2021-07-07 wflow_publish(“./analysis/fig_02_x_chromosome.Rmd”, verbose = T)
Rmd ded0029 C. Navarro 2021-07-06 wflow_rename(“./analysis/x_chromosome.Rmd”, “./analysis/fig_02_x_chromosome.Rmd”)
html ded0029 C. Navarro 2021-07-06 wflow_rename(“./analysis/x_chromosome.Rmd”, “./analysis/fig_02_x_chromosome.Rmd”)

Summary

Corresponding figures for chromosome X analysis.

Helper functions

Extra functions used to cleanup the relevant code. Click code to see the source.

#' Summarize stats per chromosome on a scaled bigWig file
#'
#' @param bwfile BigWig file to summarize
#' @param chromosomes Array of chromosome names to include.
#'
#' @return A data frame with stats per chromosome: mean, chr size, #reads
#'   (estimated as (score * chr size) / fraglen), %reads.
scaled_reads_per_chromosome <- function(bwfile, chromosomes, fraglen = 150) {
  granges <- unlist(summary(BigWigFile(bwfile)))
  df <- data.frame(granges[seqnames(granges) %in% chromosomes, ])
  rownames(df) <- df$seqnames
  
  # Calculate scaled number of reads as mean x chromosome length / read length
  df$nreads <- (df$score * df$width) / fraglen
  
  # Perc of total
  df$perc <- (df$nreads / sum(df$nreads)) * 100
  
  # Perc size
  df$size <- df$width / sum(df$width)

  df$group <- basename(bwfile)
  df[chromosomes, ]
}

chromosomes <- paste0("chr", c(1:22, "X"))

# Fix some parameters on treemap function to remove some clutter from nb.
chr_treeplot <- partial(
  treemap,
  index = "seqnames",
  vSize = "nreads",
  vColor = "score",
  type = "value",
  mapping = c(0, 3),
  range = c(0, 3),
  fontsize.labels = 16,
  fontsize.legend = 16,
  fontsize.title = 20
)


ridges_chromosome_plot <- function(values, column, color, main_seqs = chromosomes, scale = 1.7) {
  value_name <- column
  df <- values[values$seqnames %in% main_seqs, c("seqnames", value_name)]
  colnames(df) <- c("seqnames", "value")
  df$value <- as.numeric(df$value)
  df$seqnames <- factor(df$seqnames, levels = rev(main_seqs))

  df_summary <- df %>% group_by(seqnames) %>%
    summarise(value=median(value, na.rm = T))
  x_nudge <- quantile(df$value, 0.02, na.rm = T)

  ggplot(df, aes(x = value, y = seqnames, fill = seqnames)) +
    geom_density_ridges(
      rel_min_height = 0.001,
      scale = 1.7,
      calc_ecdf = TRUE,
      quantile_lines = TRUE, quantiles = 2,
    ) +
    theme_default(base_size = 12) +
    labs(y = "", x = "log2FC") +
    scale_fill_manual(values = c(color, rep("#bbbbbb", 22))) + theme(legend.position = "none") +
    geom_vline(xintercept = 0, linetype = "dashed", size = 0.2) +
    geom_text(data=df_summary,
              aes(label=sprintf("%1.2f", value)),
              position=position_nudge(y=0.35, x = x_nudge), colour="black", size=3)
}

get_long_format_heatmap_data <- function(df, mark) {
  columns <- grep("mean_cov", colnames(df), value = T)
  main_seqs <- paste0("chr", c(1:22, "X"))
  df <- df[df$seqnames %in% main_seqs, c("seqnames", columns)]
  
  summary_mat <- df %>% group_by(seqnames) %>% summarise_at(columns, mean, na.rm = TRUE)
  
  to_plot <- summary_mat %>% 
    select("seqnames", contains(mark) & contains("mean_cov") & !contains("rep"))
  
  # Reorder chromosomes and conditions
  conditions <- c("Ni", "Ni_EZH2i", "Pr", "Pr_EZH2i")
  to_plot$seqnames <- gsub("chr", "", to_plot$seqnames)
  to_plot$seqnames <- factor(to_plot$seqnames, levels = c(1:22, "X"))
  colnames(to_plot) <- c("seqnames", conditions)
  to_plot_melt <- pivot_longer(to_plot, !seqnames)
  to_plot_melt$name <- factor(to_plot_melt$name, levels = rev(conditions))
  to_plot_melt
}

Read the main tables:

genes <- read.table("./data/meta/Kumar_2020_master_gene_table_rnaseq_shrunk.tsv",
                    header = T, sep = "\t",
                    colClasses = c(rep("character", 5), rep("numeric", 86)))

bins <- read.table("./data/meta/Kumar_2020_master_bins_5kb_table_raw.tsv",
                   header = T, sep = "\t",
                   colClasses = c(rep("character", 4), rep("numeric", 112)))

Heatmaps

to_plot_melt <- get_long_format_heatmap_data(bins, "H3K4m3")

ggplot(to_plot_melt, aes(fill = value, x = seqnames, y = name)) +
  geom_tile(color = "white", size = 1) +
  coord_fixed() +
  theme_minimal(base_size = 12) +
  labs(x = "", y = "", title = "H3K4m3 mean of 5kb bins per chromosome") + 
  scale_fill_gradient(low = "white", high = "#b64c28", limits = c(0, 4.5))

Version Author Date
51c57d8 C. Navarro 2021-07-07

Download plot data: download plot data

to_plot_melt <- get_long_format_heatmap_data(bins, "H3K27m3")

ggplot(to_plot_melt, aes(fill = value, x = seqnames, y = name)) +
  geom_tile(color = "white", size = 1) +
  coord_fixed() +
  theme_minimal(base_size = 12) +
  labs(x = "", y = "", title = "H3K27m3 mean of 5kb bins per chromosome") + 
  scale_fill_gradient(low = "white", high = gl_mark_colors$H3K27m3, limits = c(0, 3))

Version Author Date
51c57d8 C. Navarro 2021-07-07

Download plot data: download plot data

to_plot_melt <- get_long_format_heatmap_data(bins, "H2Aub")

ggplot(to_plot_melt, aes(fill = value, x = seqnames, y = name)) +
  geom_tile(color = "white", size = 1) +
  coord_fixed() +
  theme_minimal(base_size = 12) +
  labs(x = "", y = "", title = "H2AUb mean of 5kb bins per chromosome") + 
  scale_fill_gradient(low = "white", high = gl_mark_colors$H2Aub, limits = c(0, 2))

Version Author Date
51c57d8 C. Navarro 2021-07-07

Download plot data: download plot data

columns <- grep("mean_cov", colnames(bins), value = T)
main_seqs <- paste0("chr", c(1:22, "X"))
df <- bins[bins$seqnames %in% main_seqs, c("seqnames", columns)]

summary_mat <- df %>% group_by(seqnames) %>% summarise_at(columns, mean, na.rm = TRUE)

to_plot <- summary_mat %>% select("seqnames", contains("mean_cov") & !contains("IN") & !contains("rep"))
# Reorder chromosomes
to_plot$seqnames <- gsub("chr", "", to_plot$seqnames)
to_plot$seqnames <- factor(to_plot$seqnames, levels = c(1:22, "X"))
to_plot_melt <- pivot_longer(to_plot, !seqnames)

to_plot_melt$name <- gsub("_mean_cov", "", to_plot_melt$name)
to_plot_melt$ip <- str_split_fixed(to_plot_melt$name, "_", 2)[, 1]
to_plot_melt$condition <- str_split_fixed(to_plot_melt$name, "_", 2)[, 2]

ggplot(to_plot_melt, aes(color = ip, x = condition, y = value, label = seqnames)) +
  geom_boxplot(color = "gray", alpha = 0.9) +
  geom_jitter(position = "dodge") +
  geom_jitter(data = to_plot_melt %>% filter(seqnames == "X"), color = "black", size = 3.5, position = "dodge") +
  geom_label_repel(data = to_plot_melt %>% filter(
    seqnames == "X" & ip == "H3K27m3" & condition == "Ni"), color = "black", box.padding = 1.5) +
  theme_default(base_size=12) + 
  facet_wrap(. ~ ip, nrow = 1) +
  geom_hline(yintercept = 1, linetype = "dashed", alpha = 0.8) +
  scale_color_manual(
    values = c("H2Aub" = gl_mark_colors$H2Aub,
               "H3K27m3" = gl_mark_colors$H3K27m3,
               "H3K4m3" = gl_mark_colors$H3K4m3)) +
  labs(y="FPGC", title =
         "Mean 5kb bin RPGC per chromosome and histone mark",
       subtitle = "Chromosome X in black")

Version Author Date
51c57d8 C. Navarro 2021-07-07

Treemaps

H3K27me3

H3K27me3 is highly abundant on X chromosome on naïve cells.

If we take a look at coverage per chromosome for both Naïve and Primed cells:

bw <- file.path(params$bwdir, "H3K27m3_H9_Ni_pooled.hg38.scaled.bw")
values <- scaled_reads_per_chromosome(bw, chromosomes = chromosomes)

chr_treeplot(
  values,
  palette = c("#ffffff", gl_condition_colors[["Naive_Untreated"]]),
  fontcolor.labels = "#555555",
  border.col = c("white"),
  title = "H3K27m3 - Naïve"
)

Version Author Date
51c57d8 C. Navarro 2021-07-07
ded0029 C. Navarro 2021-07-06

Values can be downloaded here: download plot data.

In this and subsequent plots, each rectangle’s size is proportional to the number of read mapped to its corresponding chromosome. Color intensity represents mean coverage per chromosome, and rectangles are ordered according to size. Top-left is the highest value.

As opposed to primed, where values are very even:

bw <- file.path(params$bwdir, "H3K27m3_H9_Pr_pooled.hg38.scaled.bw")
values <- scaled_reads_per_chromosome(bw, chromosomes = chromosomes)

chr_treeplot(
  values,
  palette = c("#ffffff", gl_condition_colors[["Primed_Untreated"]]),
  fontcolor.labels = "#555555",
  border.col = c("white"),
  title = "H3K27m3 - Primed"
)

Version Author Date
51c57d8 C. Navarro 2021-07-07
ded0029 C. Navarro 2021-07-06

Values can be downloaded here: download plot data.

EZH2i-treated cells, in comparison, have H3K27m3 globally removed:

bw <- file.path(params$bwdir, "H3K27m3_H9_Ni-EZH2i_pooled.hg38.scaled.bw")
values <- scaled_reads_per_chromosome(bw, chromosomes = chromosomes)

chr_treeplot(
  values,
  palette = c("#ffffff", gl_condition_colors[["Naive_Untreated"]]),
  fontcolor.labels = "#555555",
  border.col = "#999999",
  title = "H3K27m3 - Naïve-EZH2i"
)

Version Author Date
51c57d8 C. Navarro 2021-07-07
ded0029 C. Navarro 2021-07-06

Values can be downloaded here: download plot data.

bw <- file.path(params$bwdir, "H3K27m3_H9_Pr-EZH2i_pooled.hg38.scaled.bw")
values <- scaled_reads_per_chromosome(bw, chromosomes = chromosomes)

chr_treeplot(
  values,
  palette = c("#ffffff", gl_condition_colors[["Primed_Untreated"]]),
  fontcolor.labels = "#555555",
  border.col = "#999999",
  title = "H3K27m3 - Primed-EZH2i"
)

Version Author Date
51c57d8 C. Navarro 2021-07-07
ded0029 C. Navarro 2021-07-06

Values can be downloaded here: download plot data.

If we look at the rest of the histone marks:

H3K4me3

H3K4me3 does not show this X-chromosome specificity.

bw <- file.path(params$bwdir, "H3K4m3_H9_Ni_pooled.hg38.scaled.bw")
values <- scaled_reads_per_chromosome(bw, chromosomes = chromosomes)

chr_treeplot(
  values,
  palette = c("#ffffff", gl_condition_colors[["Naive_Untreated"]]),
  fontcolor.labels = "#555555",
  border.col = c("white"),
  title = "H3K4m3 - Naïve"
)

Version Author Date
51c57d8 C. Navarro 2021-07-07
ded0029 C. Navarro 2021-07-06

Underlying values can be downloaded here: download plot data.

bw <- file.path(params$bwdir, "H3K4m3_H9_Pr_pooled.hg38.scaled.bw")
values <- scaled_reads_per_chromosome(bw, chromosomes = chromosomes)

chr_treeplot(
  values,
  palette = c("#ffffff", gl_condition_colors[["Primed_Untreated"]]),
  fontcolor.labels = "#555555",
  border.col = c("white"),
  title = "H3K4m3 - Primed"
)

Version Author Date
51c57d8 C. Navarro 2021-07-07
ded0029 C. Navarro 2021-07-06

Underlying values can be downloaded here: download plot data.

EZH2i-treated cells, in comparison, have H3K27m3 globally removed:

bw <- file.path(params$bwdir, "H3K4m3_H9_Ni-EZH2i_pooled.hg38.scaled.bw")
values <- scaled_reads_per_chromosome(bw, chromosomes = chromosomes)

chr_treeplot(
  values,
  palette = c("#ffffff", gl_condition_colors[["Naive_Untreated"]]),
  fontcolor.labels = "#555555",
  border.col = c("white"),
  title = "H3K4m3 - Naïve-EZH2i"
)

Version Author Date
51c57d8 C. Navarro 2021-07-07
ded0029 C. Navarro 2021-07-06

Underlying values can be downloaded here: download plot data.

bw <- file.path(params$bwdir, "H3K4m3_H9_Pr-EZH2i_pooled.hg38.scaled.bw")
values <- scaled_reads_per_chromosome(bw, chromosomes = chromosomes)

chr_treeplot(
  values,
  palette = c("#ffffff", gl_condition_colors[["Primed_Untreated"]]),
  fontcolor.labels = "#555555",
  border.col = c("white"),
  title = "H3K4m3 - Primed-EZH2i"
)

Version Author Date
51c57d8 C. Navarro 2021-07-07
ded0029 C. Navarro 2021-07-06

H2AUb

bw <- file.path(params$bwdir, "H2Aub_H9_Ni_pooled.hg38.scaled.bw")
values <- scaled_reads_per_chromosome(bw, chromosomes = chromosomes)

chr_treeplot(
  values,
  palette = c("#ffffff", gl_condition_colors[["Naive_Untreated"]]),
  fontcolor.labels = "#555555",
  border.col = c("white"),
  title = "H2Aub - Naïve"
)

Version Author Date
51c57d8 C. Navarro 2021-07-07
ded0029 C. Navarro 2021-07-06

Underlying values can be downloaded here: download plot data.

bw <- file.path(params$bwdir, "H2Aub_H9_Pr_pooled.hg38.scaled.bw")
values <- scaled_reads_per_chromosome(bw, chromosomes = chromosomes)

chr_treeplot(
  values,
  palette = c("#ffffff", gl_condition_colors[["Primed_Untreated"]]),
  fontcolor.labels = "#555555",
  border.col = c("white"),
  title = "H2Aub - Primed"
)

Version Author Date
51c57d8 C. Navarro 2021-07-07
ded0029 C. Navarro 2021-07-06

Underlying values can be downloaded here: download plot data.

EZH2i-treated cells, in comparison, have H3K27m3 globally removed:

bw <- file.path(params$bwdir, "H2Aub_H9_Ni-EZH2i_pooled.hg38.scaled.bw")
values <- scaled_reads_per_chromosome(bw, chromosomes = chromosomes)

chr_treeplot(
  values,
  palette = c("#ffffff", gl_condition_colors[["Naive_Untreated"]]),
  fontcolor.labels = "#555555",
  border.col = c("white"),
  title = "H2Aub - Naïve-EZH2i"
)

Version Author Date
51c57d8 C. Navarro 2021-07-07
ded0029 C. Navarro 2021-07-06

Values can be downloaded here: download plot data.

bw <- file.path(params$bwdir, "H2Aub_H9_Pr-EZH2i_pooled.hg38.scaled.bw")
values <- scaled_reads_per_chromosome(bw, chromosomes = chromosomes)

chr_treeplot(
  values,
  palette = c("#ffffff", gl_condition_colors[["Primed_Untreated"]]),
  fontcolor.labels = "#555555",
  border.col = c("white"),
  title = "H2Aub - Primed-EZH2i"
)

Version Author Date
51c57d8 C. Navarro 2021-07-07
ded0029 C. Navarro 2021-07-06

Values can be downloaded here: download plot data.

Ridgeplots

These figures are made using the package ggridges: https://wilkelab.org/ggridges/

Primed vs Naive

RNA-seq data

ridges_chromosome_plot(genes, "RNASeq_DS_Pr_vs_Ni_log2FoldChange", "#F08080") +
  labs(title = "RNA Seq log2FC distribution Primed vs Naïve DESeq2") +
  coord_cartesian(xlim=c(-7, 7))

Version Author Date
51c57d8 C. Navarro 2021-07-07

Values used in this plot.

H3K27m3

ridges_chromosome_plot(genes, "H3K27m3_DS_Pr_vs_Ni_log2FoldChange", "#3e5aa8") +
  labs(title = "H3K27m3 log2FC distribution Primed vs Naïve DESeq2") + coord_cartesian(xlim=c(-7, 7))

Version Author Date
51c57d8 C. Navarro 2021-07-07

Values used in this plot.

EZH2i vs Naive

RNA-seq data

ridges_chromosome_plot(genes, "RNASeq_DS_EZH2i_vs_Ni_log2FoldChange", "#F08080") +
  labs(title = "RNA Seq log2FC distribution EZH2i vs Naïve DESeq2") +
  coord_cartesian(xlim=c(-5, 5))

Version Author Date
51c57d8 C. Navarro 2021-07-07

Values used in this plot.

MA plots

# Too many points make huge svgs
library(ggrastr)

interest_genes <- c("XIST", "VGLL1", "HUWE1", "ATRX", "THOC2", "IDS", "MPP1", "RBM3")

ggplot(genes, aes(x=RNASeq_DS_Pr_vs_Ni_baseMean, y=RNASeq_DS_Pr_vs_Ni_log2FoldChange)) +
  rasterise(geom_point(size = 0.5, alpha = 0.8, color = "gray"), dpi = 300) +
  rasterise(geom_point(data = genes %>% filter(seqnames == "chrX"), color = "black", size = 1.5), dpi = 300) +
  theme_default(base_size = 12) +
  labs(x = "Base mean",
       y = "Log2 FC",
       title = paste("MA plot - Primed vs Naive"),
       subtitle = "Highlighted in black chrX genes") +
  geom_hline(yintercept = 0, linetype = "dashed", alpha = 0.8) +
  geom_label_repel(data = genes %>% filter(name %in% interest_genes), aes(label = name), box.padding = 0.5) +
  scale_x_log10(breaks = trans_breaks("log10", function(x) 10^x),
                labels = trans_format("log10", math_format(10^.x)))

Version Author Date
51c57d8 C. Navarro 2021-07-07
ggplot(genes, aes(x=RNASeq_DS_EZH2i_vs_Ni_baseMean, y=RNASeq_DS_EZH2i_vs_Ni_log2FoldChange)) +
  rasterise(geom_point(size = 0.5, alpha = 0.8, color = "gray"), dpi = 300) +
  rasterise(geom_point(data = genes %>% filter(seqnames == "chrX"), color = "black", size = 1.6), dpi = 300) +
  theme_default(base_size = 12) +
  labs(x = "Base mean",
       y = "Log2 FC",
       title = paste("MA plot - EZH2i vs Naive"),
       subtitle = "Highlighted in black chrX genes") +
  geom_hline(yintercept = 0, linetype = "dashed", alpha = 0.8) +
  geom_label_repel(data = genes %>% filter(name %in% interest_genes), aes(label = name), box.padding = 0.5) +
  scale_x_log10(breaks = trans_breaks("log10", function(x) 10^x),
                labels = trans_format("log10", math_format(10^.x)))

Version Author Date
51c57d8 C. Navarro 2021-07-07

Karyoplots

These figures are made using the package karyoploteR: https://academic.oup.com/bioinformatics/article/33/19/3088/3857734

H3K27m3

bwfiles <- list(
  k4 = list.files(params$bwdir, pattern = "H3K4m3.*pooled.hg38.scaled.*", full.names = T),
  k27 = list.files(params$bwdir, pattern = "H3K27m3.*pooled.hg38.scaled.*", full.names = T),
  ub = list.files(params$bwdir, pattern = "H2Aub.*pooled.hg38.scaled.*", full.names = T),
  input = list.files(params$bwdir, pattern = "IN.*pooled.hg38.*", full.names = T))

kp <-
  plotKaryotype(
    genome = "hg38",
    plot.type = 1,
    main = "H3K27m3 Naïve vs Primed",
    chromosomes = c("chr7", "chrX")
  )

kpPlotDensity(
  kp,
  rtracklayer::import(bwfiles$k27[[1]]),
  data.panel = 1,
  col = "#092ba8",
  chromosomes = c("chr7", "chrX"),
  window.size = 500000
)

kpPlotDensity(
  kp,
  rtracklayer::import(bwfiles$k27[[3]]),
  data.panel = 2,
  col =
    "#5d9ddd",
  chromosomes = c("chr7", "chrX"),
  window.size = 500000
)

Version Author Date
51c57d8 C. Navarro 2021-07-07

H3K4m3

kp <-
  plotKaryotype(
    genome = "hg38",
    plot.type = 1,
    main = "H3K4m3 Naïve vs Primed",
    chromosomes = c("chr7", "chrX")
  )

kpPlotDensity(
  kp,
  rtracklayer::import(bwfiles$k4[[1]]),
  data.panel = 1,
  col = "#e76e3b",
  chromosomes = c("chr7", "chrX"),
  window.size = 500000
)

kpPlotDensity(
  kp,
  rtracklayer::import(bwfiles$k4[[3]]),
  data.panel = 2,
  col =
    "#ffab45",
  chromosomes = c("chr7", "chrX"),
  window.size = 500000
)

Version Author Date
51c57d8 C. Navarro 2021-07-07

H2Aub

kp <-
  plotKaryotype(
    genome = "hg38",
    plot.type = 1,
    main = "H2Aub Naïve vs Primed",
    chromosomes = c("chr7", "chrX")
  )

kpPlotDensity(
  kp,
  rtracklayer::import(bwfiles$ub[[1]]),
  data.panel = 1,
  col = "#400c84",
  chromosomes = c("chr7", "chrX"),
  window.size = 500000
)

kpPlotDensity(
  kp,
  rtracklayer::import(bwfiles$ub[[3]]),
  data.panel = 2,
  col =
    "#a07af0",
  chromosomes = c("chr7", "chrX"),
  window.size = 500000
)

Version Author Date
51c57d8 C. Navarro 2021-07-07

sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 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] ggrastr_0.2.3        scales_1.1.1         ggrepel_0.9.1       
 [4] cowplot_1.1.1        karyoploteR_1.18.0   regioneR_1.24.0     
 [7] forcats_0.5.1        stringr_1.4.0        dplyr_1.0.7         
[10] readr_1.4.0          tidyr_1.1.3          tibble_3.1.2        
[13] ggplot2_3.3.5        tidyverse_1.3.1      ggridges_0.5.3      
[16] purrr_0.3.4          treemap_2.4-2        rtracklayer_1.52.0  
[19] GenomicRanges_1.44.0 GenomeInfoDb_1.28.1  IRanges_2.26.0      
[22] S4Vectors_0.30.0     BiocGenerics_0.38.0  wigglescout_0.13.1  
[25] workflowr_1.6.2     

loaded via a namespace (and not attached):
  [1] utf8_1.2.1                  tidyselect_1.1.1           
  [3] RSQLite_2.2.7               AnnotationDbi_1.54.1       
  [5] htmlwidgets_1.5.3           grid_4.1.0                 
  [7] BiocParallel_1.26.0         munsell_0.5.0              
  [9] codetools_0.2-18            future_1.21.0              
 [11] withr_2.4.2                 colorspace_2.0-2           
 [13] Biobase_2.52.0              filelock_1.0.2             
 [15] highr_0.9                   knitr_1.33                 
 [17] rstudioapi_0.13             listenv_0.8.0              
 [19] MatrixGenerics_1.4.0        labeling_0.4.2             
 [21] git2r_0.28.0                GenomeInfoDbData_1.2.6     
 [23] bit64_4.0.5                 farver_2.1.0               
 [25] rprojroot_2.0.2             parallelly_1.26.1          
 [27] vctrs_0.3.8                 generics_0.1.0             
 [29] xfun_0.24                   biovizBase_1.40.0          
 [31] BiocFileCache_2.0.0         R6_2.5.0                   
 [33] ggbeeswarm_0.6.0            AnnotationFilter_1.16.0    
 [35] bitops_1.0-7                cachem_1.0.5               
 [37] DelayedArray_0.18.0         assertthat_0.2.1           
 [39] promises_1.2.0.1            BiocIO_1.2.0               
 [41] nnet_7.3-16                 beeswarm_0.4.0             
 [43] gtable_0.3.0                Cairo_1.5-12.2             
 [45] globals_0.14.0              ensembldb_2.16.2           
 [47] rlang_0.4.11                splines_4.1.0              
 [49] lazyeval_0.2.2              dichromat_2.0-0            
 [51] broom_0.7.8                 checkmate_2.0.0            
 [53] yaml_2.2.1                  reshape2_1.4.4             
 [55] modelr_0.1.8                GenomicFeatures_1.44.0     
 [57] backports_1.2.1             httpuv_1.6.1               
 [59] Hmisc_4.5-0                 tools_4.1.0                
 [61] gridBase_0.4-7              ellipsis_0.3.2             
 [63] jquerylib_0.1.4             RColorBrewer_1.1-2         
 [65] Rcpp_1.0.6                  plyr_1.8.6                 
 [67] base64enc_0.1-3             progress_1.2.2             
 [69] zlibbioc_1.38.0             RCurl_1.98-1.3             
 [71] prettyunits_1.1.1           rpart_4.1-15               
 [73] openssl_1.4.4               SummarizedExperiment_1.22.0
 [75] haven_2.4.1                 cluster_2.1.2              
 [77] fs_1.5.0                    furrr_0.2.3                
 [79] magrittr_2.0.1              data.table_1.14.0          
 [81] reprex_2.0.0                whisker_0.4                
 [83] ProtGenerics_1.24.0         matrixStats_0.59.0         
 [85] hms_1.1.0                   mime_0.11                  
 [87] evaluate_0.14               xtable_1.8-4               
 [89] XML_3.99-0.6                jpeg_0.1-8.1               
 [91] readxl_1.3.1                gridExtra_2.3              
 [93] compiler_4.1.0              biomaRt_2.48.2             
 [95] crayon_1.4.1                htmltools_0.5.1.1          
 [97] later_1.2.0                 Formula_1.2-4              
 [99] lubridate_1.7.10            DBI_1.1.1                  
[101] dbplyr_2.1.1                rappdirs_0.3.3             
[103] Matrix_1.3-4                cli_3.0.0                  
[105] igraph_1.2.6                pkgconfig_2.0.3            
[107] GenomicAlignments_1.28.0    foreign_0.8-81             
[109] xml2_1.3.2                  vipor_0.4.5                
[111] bslib_0.2.5.1               XVector_0.32.0             
[113] rvest_1.0.0                 bezier_1.1.2               
[115] VariantAnnotation_1.38.0    digest_0.6.27              
[117] Biostrings_2.60.1           rmarkdown_2.9              
[119] cellranger_1.1.0            htmlTable_2.2.1            
[121] restfulr_0.0.13             curl_4.3.2                 
[123] shiny_1.6.0                 Rsamtools_2.8.0            
[125] rjson_0.2.20                lifecycle_1.0.0            
[127] jsonlite_1.7.2              askpass_1.1                
[129] BSgenome_1.60.0             fansi_0.5.0                
[131] pillar_1.6.1                lattice_0.20-44            
[133] KEGGREST_1.32.0             fastmap_1.1.0              
[135] httr_1.4.2                  survival_3.2-11            
[137] glue_1.4.2                  bamsignals_1.24.0          
[139] png_0.1-7                   bit_4.0.4                  
[141] stringi_1.6.2               sass_0.4.0                 
[143] blob_1.2.1                  latticeExtra_0.6-29        
[145] memoise_2.0.0