OSCR

CRISPR-engineered deletion of POGZ alters transcription factor binding at promoters of genes involved in synaptic signaling.

Code ↔ Paper

17 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

15 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 17 matches · 3 of them tie a paragraph to a whole file without given lines: weak matches, whose lines are not tinted
  1. [1] § Material and methods › RNA-seq data analysis ↔ RNA-seq/runSTAR.sh, the whole file · a weak match · score 0.98 · GeneCounts, alignEndsType, alignIntronMax, outFilterMismatchNoverLmax, outSAMunmapped, quantMode · block oscr:b:RJ46AQR9JGHH3-3 · Report a mismatch
  2. [2] § Material and methods › Enrichment analysis ↔ RNA-seq/RNAseq.analysis/R/read_pathway_db.R, the whole file · a weak match · score 0.85 · Human Phenotype Ontology, canonical pathways, transcription factor, mSigDB, SynGO, hs · block oscr:b:AH3N7Y25HEV2R-V · Report a mismatch
  3. [3] § Material and methods › ATAC-seq analysis › TF footprint ↔ ATAC-seq/Transcription_factor_footprint/5. call_TF_bindings.sh, the whole file · a weak match · score 0.80 · TF footprint, TF binding, merged peak, ATAC seq, transcription factor, motifs · block oscr:b:SGBQZKW106YDN-F · Report a mismatch
  4. [4] § Material and methods › Co-expression analysis ↔ RNA-seq/co-expression_analysis_allsamples.R, lines 53 to 95 · score 0.75 · Soft power, Module membership, Co expression, eigengene, outlier, network · block oscr:b:M9B9G67MBSNPQ-9 · Report a mismatch
  5. [5] § Material and methods › ATAC-seq analysis › Data processing ↔ atac-seq-pipeline-1.5.4.zip/src/encode_task_qc_report.py, lines 277 to 421 · score 0.75 · alignment quality, GC bias, fragment length, PCR, duplicates, mitochondria · block oscr:b:AQ03P7J9VD2MB-T · Report a mismatch
  6. [6] § Material and methods › ATAC-seq analysis › Differential accessibility ↔ ATAC-seq/Differential_accessibility/diff_peaks_v2.R, lines 91 to 153 · score 0.74 · dba.contrast, model design, Treatment, peaks, DARs, accessibility · block oscr:b:W4QKG64T90WQG-I · Report a mismatch
  7. [7] § Material and methods › ATAC-seq analysis › Direct and indirect POGZ regulation ↔ ATAC-seq/Transcription_factor_footprint/tf_binding.Rmd, lines 181 to 248 · score 0.74 · predicted bound, log2 fold change, binding site, DTF, DEL, promoter · block oscr:b:WA6QZ95EPH9G6-3 · Report a mismatch
  8. [8] § Material and methods › Co-expression analysis ↔ RNA-seq/RNAseq.analysis/R/co_expression_functions.R, lines 125 to 159 · score 0.74 · Soft power, scale free topology, Co expression, fit, outlier, network · block oscr:b:KF5FNYS7Y92MJ-3 · Report a mismatch
  9. [9] § Material and methods › ATAC-seq analysis › Data processing ↔ atac-seq-pipeline-1.1.7.zip/src/run_ataqc.py, lines 1470 to 1518 · score 0.74 · GC bias, naive overlap, overlapped peaks, duplicates, quality, fraction · block oscr:b:BF0X5SVW6X8J0-Y · Report a mismatch
  10. [10] § Material and methods › ATAC-seq analysis › Differential accessibility ↔ ATAC-seq/Differential_accessibility/differential_accessibility.Rmd, lines 72 to 121 · score 0.68 · dba.contrast, DiffBind, Treatment, DARs, accessibility, DEL · block oscr:b:87S7YDV755XKS-9 · Report a mismatch
  11. [11] § Material and methods › ATAC-seq analysis › TF footprint ↔ ATAC-seq/Transcription_factor_footprint/tf_binding.Rmd, lines 181 to 248 · score 0.67 · TF binding, transcription factor, bound, footprint, predict, motifs · block oscr:b:WA6QZ95EPH9G6-3 · Report a mismatch
  12. [12] § Material and methods › Enrichment analysis ↔ RNA-seq/RNAseq.analysis/R/enrichment.R, lines 53 to 123 · score 0.60 · co expression, KEGG, REACTOME, SynGO, Ontology, enrichments · block oscr:b:ES9C06VKX9S8F-Q · Report a mismatch
  13. [13] § Material and methods › RNA-seq data analysis ↔ RNA-seq/rnaseq_analysis_iN_final.Rmd, lines 32 to 56 · score 0.58 · wt c6, gene annotations, RNA seq, STAR, Ensembl, alignments · block oscr:b:GRYFR545QE3NC-N · Report a mismatch
  14. [14] § Material and methods › ATAC-seq analysis › Direct and indirect POGZ regulation ↔ ATAC-seq/Differential_accessibility/differential_accessibility.Rmd, lines 393 to 464 · score 0.57 · log2 fold change, POGZ target, cortex, DEL, binding, regulated · block oscr:b:BJ98Y71H53056-V · Report a mismatch
  15. [15] § Results › POGZ direct regulatory targets modulated in edited NSCs are associated with chromatin regulation, cell cycle, and RNA processing ↔ ATAC-seq/Differential_accessibility/differential_accessibility.Rmd, lines 393 to 464 · score 0.57 · NSC DEGs, overlapping genes, POGZ target genes, binding, regulation, enrichment · block oscr:b:BJ98Y71H53056-V · Report a mismatch
  16. [16] § Material and methods › Differential expression analysis ↔ RNA-seq/RNAseq.analysis/R/rnaseq_analysis_functions.R, lines 623 to 684 · score 0.56 · DESeq2, RNA seq, weighted, SVA, meta, scores · block oscr:b:22AXR3QMHZR4J-U · Report a mismatch
  17. [17] § Results › Indirect effects are mediated by other TFs ↔ ATAC-seq/Transcription_factor_footprint/tf_binding.Rmd, lines 147 to 179 · score 0.53 · TF footprint, TF binding, probability, motif, scored, seq · block oscr:b:2HETWKYYZQ2A7-E · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R Markdown · 896 lines · 64 KB · no license · 3 matches

  1. ---
  2. title: "POGZ TF binding"
  3. author: "Yating Liu"
  4. date: "3/2/2023"
  5. output: html_document
  6. ---
  7. ```{r setup, include=FALSE}
  8. knitr::opts_knit$set(root.dir = "~/Documents/Talkowski/POGZ_project/ATAC_seq")
  9. knitr::opts_chunk$set(echo = TRUE)
  10. ```
  11. ```{r message=FALSE}
  12. library(ggplot2)
  13. library(dplyr)
  14. library(stringr)
  15. library(biomaRt)
  16. library(GenomicRanges)
  17. options(stringsAsFactors = F)
  18. ```
  19. ## Get differential TF binding bw DEL vs WT from TF footprinting
  20. ### Read iN TF footprinting results into a list
  21. ```{r}
  22. if (!file.exists("TF_footprint/iN_bindetect_results.rds")) {
  23. iN_bindetect_results <- list()
  24. iN_bindetect_results[["iN_GM_DEL2_vs_WT2"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_GM8330_Feb2021.DEL2_vs_WT2.conservative/bindetect_results.txt", header = T)
  25. iN_bindetect_results[["iN_GM_DEL1_vs_WT1"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_GM8330_Mar2021.DEL1_vs_WT1.conservative/bindetect_results.txt", header = T)
  26. iN_bindetect_results[["iN_MGH_DEL2_vs_WT2"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_MGH_Feb2021.DEL2_vs_WT2.conservative/bindetect_results.txt", header = T)
  27. iN_bindetect_results[["iN_MGH_DEL1_vs_WT1"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_MGH_Mar2021.DEL1_vs_WT1.conservative/bindetect_results.txt", header = T)
  28. iN_bindetect_results[["iN_GM_DEL_vs_WT"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_GM.DEL_vs_WT.conservative/bindetect_results.txt", header = T)
  29. iN_bindetect_results[["iN_MGH_DEL_vs_WT"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_MGH.DEL_vs_WT.conservative/bindetect_results.txt", header = T)
  30. iN_bindetect_results[["iN_GM_del1del2_vs_WT"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_GM8330_Sep2020.DEL1DEL2_vs_WT.conservative_with_pogz_motifs/bindetect_results.txt", header = T)
  31. iN_bindetect_results[["iN_GM_del1_vs_WT"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_GM8330_Sep2020.DEL1_vs_WT.conservative_with_pogz_motifs/bindetect_results.txt", header = T)
  32. saveRDS(iN_bindetect_results, "TF_footprint/iN_bindetect_results.rds")
  33. }
  34. iN_bindetect_results <- readRDS("TF_footprint/iN_bindetect_results.rds")
  35. ```
  36. ### Read NSC TF footprinting results into a list
  37. ```{r}
  38. if (!file.exists("TF_footprint/NSC_bindetect_results.rds")) {
  39. NSC_bindetect_results <- list()
  40. NSC_bindetect_results[["NSC_GM_DEL1_vs_WT1"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.NSC_GM8330_Nov2020.DEL1_vs_WT1.conservative/bindetect_results.txt", header = T)
  41. NSC_bindetect_results[["NSC_GM_DEL2_vs_WT2"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.NSC_GM8330_Nov2020.DEL2_vs_WT2.conservative/bindetect_results.txt", header = T)
  42. NSC_bindetect_results[["NSC_MGH_DEL1_vs_WT1"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.NSC_MGH_Nov2020.DEL1_vs_WT1.conservative/bindetect_results.txt", header = T)
  43. NSC_bindetect_results[["NSC_MGH_DEL2_vs_WT2"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.NSC_MGH_Nov2020.DEL2_vs_WT2.conservative/bindetect_results.txt", header = T)
  44. NSC_bindetect_results[["NSC_GM_del1del2_vs_WT"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.NSC_GM8330_Aug2020.DEL1DEL2_vs_WT.conservative_with_pogz_motifs/bindetect_results.txt", header = T)
  45. NSC_bindetect_results[["NSC_GM_del1_vs_WT"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.NSC_GM8330_Aug2020.DEL1_vs_WT.conservative_with_pogz_motifs/bindetect_results.txt", header = T)
  46. NSC_bindetect_results[["NSC_GM_DEL_vs_WT"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.NSC_GM.DEL_vs_WT.conservative/bindetect_results.txt", header = T)
  47. NSC_bindetect_results[["NSC_MGH_DEL_vs_WT"]] <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.NSC_MGH.DEL_vs_WT.conservative/bindetect_results.txt", header = T)
  48. saveRDS(NSC_bindetect_results, "TF_footprint/NSC_bindetect_results.rds")
  49. }
  50. NSC_bindetect_results <- readRDS("TF_footprint/NSC_bindetect_results.rds")
  51. ```
  52. ### Function to get differential TF bindings
  53. threshold is set according to the TOBIAS paper: https://www.nature.com/articles/s41467-020-18035-1
  54. All TFs with -log10(p-value) above the 95% quantile or differential binding scores smaller/larger than the 5%
  55. and 95% quantiles (top 5% in each direction) are colored and shown with labels.
  56. ```{r}
  57. identify_differential_TF <- function(bindetect_results, by = 0.05) {
  58. pvalue_col <- colnames(bindetect_results)[str_detect(colnames(bindetect_results), "_pvalue")]
  59. score_change_col <- colnames(bindetect_results)[str_detect(colnames(bindetect_results), "_change")]
  60. sig_pvalue <- quantile(-log10(bindetect_results[[pvalue_col]]), probs = seq(0,1,by))
  61. sig_pvalue <- unname(sig_pvalue[length(sig_pvalue)-1])
  62. score_change <- quantile(bindetect_results[[score_change_col]], probs = seq(0,1,by))
  63. score_change_small <- unname(score_change[2])
  64. score_change_large <- unname(score_change[length(score_change)-1])
  65. bindetect_results[["sig_change_up"]] <- bindetect_results[[score_change_col]] > 0 & (bindetect_results[[score_change_col]] > score_change_large | -log10(bindetect_results[[pvalue_col]]) > sig_pvalue)
  66. bindetect_results[["sig_change_down"]] <- bindetect_results[[score_change_col]] < 0 & (bindetect_results[[score_change_col]] < score_change_small | -log10(bindetect_results[[pvalue_col]]) > sig_pvalue)
  67. bindetect_results <- bindetect_results %>% mutate(sig_change = case_when(sig_change_up == TRUE ~ "up",
  68. sig_change_down == TRUE ~"down",
  69. TRUE ~"NA"))
  70. #print(str(bindetect_results))
  71. p <- ggplot(bindetect_results, aes(x = get(score_change_col), y = -log10(get(pvalue_col)), color = sig_change)) +
  72. geom_point() +
  73. scale_color_manual(breaks = c("up", "down", "NA"), values = c("red", "blue", "grey")) +
  74. labs(x = "score_change", y = "-log10(pvalue)") +
  75. geom_hline(yintercept = sig_pvalue, color = "purple", linetype = "dotted") +
  76. geom_vline(xintercept = score_change_small, color = "blue", linetype = "dotted") +
  77. geom_vline(xintercept = score_change_large, color = "red", linetype = "dotted")
  78. print(p)
  79. return (bindetect_results)
  80. }
  81. ```
  82. ## Overlap function
  83. ```{r}
  84. overlap_tf <- function(tf1, tf2, tf1_name, tf2_name) {
  85. up <- intersect(tf1[tf1$sig_change == "up",]$motif_id, tf2[tf2$sig_change == "up",]$motif_id)
  86. down <- intersect(tf1[tf1$sig_change == "down",]$motif_id, tf2[tf2$sig_change == "down",]$motif_id)
  87. up_down <- intersect(tf1[tf1$sig_change == "up",]$motif_id, tf2[tf2$sig_change == "down",]$motif_id)
  88. down_up <- intersect(tf1[tf1$sig_change == "down",]$motif_id, tf2[tf2$sig_change == "up",]$motif_id)
  89. summary_stat <- matrix(0, nrow = 2, ncol = 2)
  90. rownames(summary_stat) <- c(paste0(tf1_name, "_up"), paste0(tf1_name, "_down"))
  91. colnames(summary_stat) <- c(paste0(tf2_name, "_up"), paste0(tf2_name, "_down"))
  92. summary_stat[paste0(tf1_name, "_up"),paste0(tf2_name, "_up")] <- length(up)
  93. summary_stat[paste0(tf1_name, "_down"),paste0(tf2_name, "_down")] <- length(down)
  94. summary_stat[paste0(tf1_name, "_up"),paste0(tf2_name, "_down")] <- length(up_down)
  95. summary_stat[paste0(tf1_name, "_down"),paste0(tf2_name, "_up")] <- length(down_up)
  96. print(summary_stat)
  97. return (list(up = up, down = down, up_down = up_down, down_up = down_up))
  98. }
  99. ```
  100. ### iN DEL vs WT
  101. ```{r}
  102. iN_GM_DEL_vs_WT <- identify_differential_TF(iN_bindetect_results$iN_GM_DEL_vs_WT)
  103. iN_MGH_DEL_vs_WT <- identify_differential_TF(iN_bindetect_results$iN_MGH_DEL_vs_WT)
  104. # iN GM het vs iN MGH het
  105. iN_overlapping_DEL_vs_WT_GM_MGH <- overlap_tf(iN_GM_DEL_vs_WT, iN_MGH_DEL_vs_WT, "GM", "MGH")
  106. saveRDS(iN_overlapping_DEL_vs_WT_GM_MGH, "TF_footprint/iN_GM_MGH_overlapped_DTF.rds")
  107. iN_GM_del1del2_vs_WT <- identify_differential_TF(iN_bindetect_results$iN_GM_del1del2_vs_WT)
  108. # iN GM het vs comp het
  109. overlapping_DEL1DEL2_vs_WT_DEL_vs_WT <- overlap_tf(iN_GM_del1del2_vs_WT, iN_GM_DEL_vs_WT, "iN_GM_del1del2_vs_WT", "iN_GM_DEL_vs_WT")
  110. ```
  111. ### NSC DEL vs WT
  112. ```{r}
  113. NSC_GM_DEL_vs_WT <- identify_differential_TF(NSC_bindetect_results$NSC_GM_DEL_vs_WT)
  114. NSC_MGH_DEL_vs_WT <- identify_differential_TF(NSC_bindetect_results$NSC_MGH_DEL_vs_WT)
  115. NSC_overlapping_DEL_vs_WT_GM_MGH <- overlap_tf(NSC_GM_DEL_vs_WT, NSC_MGH_DEL_vs_WT, "GM", "MGH")
  116. saveRDS(NSC_overlapping_DEL_vs_WT_GM_MGH, "TF_footprint/NSC_GM_MGH_overlapped_DTF.rds")
  117. NSC_GM_del1del2_vs_WT <- identify_differential_TF(NSC_bindetect_results$NSC_GM_del1del2_vs_WT)
  118. # NSC GM het vs comp het
  119. overlapping_DEL1_vs_WT1_DEL2_vs_WT2 <- overlap_tf(NSC_GM_del1del2_vs_WT, NSC_GM_DEL_vs_WT, "NSC_GM_del1del2_vs_WT", "NSC_GM_DEL_vs_WT")
  120. ```
  121. #### POGZ motif change and pvalue
  122. ```{r}
  123. pogz_motif_stat <- data.frame()
  124. bindetect_lst <- list(iN_GM_DEL_vs_WT = iN_bindetect_results$iN_GM_DEL_vs_WT,
  125. iN_MGH_DEL_vs_WT = iN_bindetect_results$iN_MGH_DEL_vs_WT,
  126. NSC_GM_DEL_vs_WT = NSC_bindetect_results$NSC_GM_DEL_vs_WT,
  127. NSC_MGH_DEL_vs_WT = NSC_bindetect_results$NSC_MGH_DEL_vs_WT)
  128. for (bindetect_name in names(bindetect_lst)) {
  129. message(bindetect_name)
  130. bindetect_results <- bindetect_lst[[bindetect_name]]
  131. by = 0.05
  132. pvalue_col <- colnames(bindetect_results)[str_detect(colnames(bindetect_results), "_pvalue")]
  133. score_change_col <- colnames(bindetect_results)[str_detect(colnames(bindetect_results), "_change")]
  134. bindetect_results[["log10_pvalue"]] <- -log10(bindetect_results[[pvalue_col]])
  135. sig_pvalue <- quantile(-log10(bindetect_results[[pvalue_col]]), probs = seq(0,1,by))
  136. sig_pvalue_95 <- unname(sig_pvalue[length(sig_pvalue)-1])
  137. sig_pvalue_90 <- unname(sig_pvalue[length(sig_pvalue)-2])
  138. score_change <- quantile(bindetect_results[[score_change_col]], probs = seq(0,1,by))
  139. score_change_small <- unname(score_change[2])
  140. score_change_large <- unname(score_change[length(score_change)-1])
  141. colnames(bindetect_results) <- str_remove_all(colnames(bindetect_results), "_GM|_MGH")
  142. score_change_col <- colnames(bindetect_results)[str_detect(colnames(bindetect_results), "_change")]
  143. pogz_motif_stat <- rbind(pogz_motif_stat, data.frame(bindetect_results[str_detect(bindetect_results$name, "pogz"),],
  144. cell_type = bindetect_name,
  145. log10_pvalue_percentile = sapply(bindetect_results[str_detect(bindetect_results$name, "pogz"),c("log10_pvalue")], function(x) {return(names(tail(sig_pvalue[x > sig_pvalue],n=1)))}),
  146. score_change_percentile = sapply(bindetect_results[str_detect(bindetect_results$name, "pogz"),c(score_change_col)], function(x) {return(names(tail(score_change[x > score_change],n=1)))}),
  147. log10_pvalue_95_percentile = sig_pvalue_95,
  148. score_change_5_percentile = score_change_small,
  149. score_change_95_percentile = score_change_large))
  150. }
  151. write_xlsx(pogz_motif_stat, "TF_footprint/pogz_motif_stat.xlsx")
  152. ```
  153. ## Get differential binding TFs target genes
  154. ### Function for get target genes for a table of motif ids and name, in the end overlap these target genes with DEG results
  155. ```{r}
  156. ## Get promoters of all genes
  157. require(ensembldb)
  158. edb <- EnsDb("data/Homo_sapiens.GRCh38.92.sqlite")
  159. allpromoters <- promoters(edb, upstream = 1500, downstream = 500)
  160. allpromoters <- allpromoters[seqnames(allpromoters) %in% c(1:22, "X", "Y")]
  161. allpromoters <- keepStandardChromosomes(allpromoters)
  162. gene_annotation <- readRDS("../iN_05_2021/results/gene_annotation.rds")
  163. get_TF_target_genes <- function(motif_info, express_colname, allpromoters, gene_annotation, DTFB_path, del_vs_wt_final_degs, prefix) {
  164. # get motif directory name
  165. overlapped_TF_folder <- paste(motif_info$name, motif_info$motif_id, sep = "_")
  166. overlapped_TF_folder <- str_remove(overlapped_TF_folder, "::")
  167. overlapped_TF_folder <- str_remove_all(overlapped_TF_folder, "\\(|\\)")
  168. genes_vs_TF_overlapping <- data.frame()
  169. for (i in 1:length(overlapped_TF_folder)) {
  170. bind_sites <- read.table(file.path(DTFB_path, overlapped_TF_folder[i], paste0(overlapped_TF_folder[i],"_overview.txt")), header = T)
  171. bind_sites <- bind_sites[bind_sites$TFBS_chr %in% c(1:22, "X", "Y"),]
  172. # if the TF is up-regulated, we use the TF bind regions that specific to DEL, otherwise use TF bind region specific to WT
  173. del_bind_col <- which(str_detect(colnames(bind_sites), "DEL.*_bound"))
  174. wt_bind_col <- which(str_detect(colnames(bind_sites), "WT.*_bound"))
  175. # Filter bind sites by keeping the sites that are predicted bound within at least one condition (WT or DEL)
  176. bind_sites <- bind_sites[bind_sites[[del_bind_col]] + bind_sites[[wt_bind_col]] > 0,]
  177. # Filter annotated bind sites that have the log2 fold change between the footprint scores of the two conditions > 90% quantile or < 10% quantile
  178. log2fc_col <- which(str_detect(colnames(bind_sites), "_log2fc"))
  179. log2fc_quantile <- quantile(bind_sites[[log2fc_col]], prob = seq(0,1, by = 0.05))
  180. # print(log2fc_quantile)
  181. bind_sites <- bind_sites[bind_sites[[log2fc_col]] < log2fc_quantile[["10%"]] | bind_sites[[log2fc_col]] > log2fc_quantile[["90%"]],]
  182. message(motif_info[i,]$name, ": number of bind sites in top quantitle: ", nrow(bind_sites))
  183. # if (motif_info[i,]$sig_change == "up") {
  184. # bind_sites <- bind_sites[bind_sites[[del_bind_col]] == 1 & bind_sites[[wt_bind_col]] == 0,]
  185. # } else {
  186. # bind_sites <- bind_sites[bind_sites[[del_bind_col]] == 0 & bind_sites[[wt_bind_col]] == 1,]
  187. # }
  188. bind_sites_gr <- GRanges(seqnames = bind_sites$TFBS_chr, ranges = IRanges(start = bind_sites$TFBS_start, end = bind_sites$TFBS_end), strand = bind_sites$TFBS_strand)
  189. overlapped_genes <- unique(allpromoters[queryHits(findOverlaps(allpromoters, bind_sites_gr)),]$gene_id)
  190. if (length(overlapped_genes) > 0) {
  191. overlapped_genes <- gene_annotation[overlapped_genes,]
  192. overlapped_genes <- cbind(overlapped_genes, motif_info[i,])
  193. # overlapped_genes$motif_id <- motif_info[i,]$motif_id
  194. # overlapped_genes$name <- motif_info[i,]$name
  195. # overlapped_genes$sig_change <- motif_info[i,]$sig_change
  196. genes_vs_TF_overlapping <- rbind(genes_vs_TF_overlapping, overlapped_genes)
  197. }
  198. }
  199. write.csv(genes_vs_TF_overlapping, paste0(prefix, "TF_target_genes.csv"), row.names = F, quote = F)
  200. # only pick the DTF that are expressed
  201. message("Total num DTF: ", length(unique(genes_vs_TF_overlapping$motif_id)))
  202. message("Expressed DTF: ", length(unique(genes_vs_TF_overlapping[genes_vs_TF_overlapping[[express_colname]] == "Yes",]$motif_id)))
  203. genes_vs_TF_overlapping <- genes_vs_TF_overlapping[genes_vs_TF_overlapping[[express_colname]] == "Yes",]
  204. # Overlap TF targets with DEGs
  205. TF_genes <- genes_vs_TF_overlapping %>%
  206. dplyr::select(ensembl_id, symbol, gene_type, motif_id, name, sig_change) %>%
  207. group_by(ensembl_id, symbol, gene_type) %>%
  208. summarise(motif_id = paste(motif_id, collapse = ";"), name = paste(name, collapse = ";"),sig_change = paste(sig_change, collapse = ";"))
  209. TF_degs <- left_join(TF_genes[TF_genes$ensembl_id %in% intersect(TF_genes$ensembl_id, del_vs_wt_final_degs$ensembl_id),], del_vs_wt_final_degs[, which(str_detect(colnames(del_vs_wt_final_degs), "ensembl_id|padj|log2FC"))], by="ensembl_id")
  210. write.csv(TF_genes, paste0(prefix, "TF_genes.csv"), row.names = F, quote = F)
  211. write.csv(TF_degs, paste0(prefix, "TF_degs.csv"), row.names = F, quote = F)
  212. return (TF_degs)
  213. }
  214. ```
  215. ## all motif expression information (whether a motif is expressed in iN or NSC)
  216. ```{r}
  217. all_motifs_expression_info <- readxl::read_excel("../POGZ_final/TF_footprinting/all_motifs_whether_expressed.xlsx")
  218. ```
  219. ## iN DTF target genes
  220. ```{r}
  221. del_vs_wt_final_degs <- read.csv("../POGZ_paper/results/del_vs_wt_overlapped_GM_MGH.csv")
  222. ```
  223. ### Get differential binding GM TFs target genes
  224. ```{r}
  225. DTFB_GM_path <- "/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_GM.DEL_vs_WT.conservative"
  226. DTFB_GM <- iN_GM_DEL_vs_WT[iN_GM_DEL_vs_WT$sig_change != "NA",]
  227. DTFB_GM <- left_join(DTFB_GM, all_motifs_expression_info[, -c(which(colnames(all_motifs_expression_info) == "name"))], by = "motif_id")
  228. writexl::write_xlsx(DTFB_GM, "TF_footprint/iN_GM_DTF.xlsx")
  229. DTFB_GM_DEGs <- get_TF_target_genes(DTFB_GM, express_colname = "iN_expression", allpromoters, gene_annotation, DTFB_GM_path, del_vs_wt_final_degs, "TF_footprint/iN_GM_")
  230. ```
  231. ### Get differential binding MGH TFs target genes
  232. ```{r}
  233. DTFB_MGH_path <- "/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_MGH.DEL_vs_WT.conservative"
  234. DTFB_MGH <- iN_MGH_DEL_vs_WT[iN_MGH_DEL_vs_WT$sig_change != "NA",]
  235. DTFB_MGH <- left_join(DTFB_MGH, all_motifs_expression_info[, -c(which(colnames(all_motifs_expression_info) == "name"))], by = "motif_id")
  236. writexl::write_xlsx(DTFB_MGH, "TF_footprint/iN_MGH_DTF.xlsx")
  237. DTFB_MGH_DEGs <- get_TF_target_genes(DTFB_MGH, express_colname = "iN_expression", allpromoters, gene_annotation, DTFB_MGH_path, del_vs_wt_final_degs, "TF_footprint/iN_MGH_")
  238. ```
  239. ### Get overlapped TF targets DEGs across background
  240. ```{r}
  241. del_vs_wt_GM <- read.csv("../POGZ_paper/results/DEL_vs_WT_GM__simple_model_sva/DEL_vs_WT_threshold_0.5_sv.csv", row.names = 1)
  242. del_vs_wt_MGH <- read.csv("../POGZ_paper/results/DEL_vs_WT_MGH__simple_model_sva/DEL_vs_WT_threshold_0.5_sv.csv", row.names = 1)
  243. analyzed_genes <- intersect(del_vs_wt_GM$ensembl_id, del_vs_wt_MGH$ensembl_id)
  244. DTFB_GM <- readxl::read_excel("TF_footprint/iN_GM_DTF.xlsx")
  245. DTFB_MGH <- readxl::read_excel("TF_footprint/iN_MGH_DTF.xlsx")
  246. DTFB_GM_genes <- read.csv("TF_footprint/iN_GM_TF_genes.csv")
  247. DTFB_MGH_genes <- read.csv("TF_footprint/iN_MGH_TF_genes.csv")
  248. DTFB_GM_DEGs <- read.csv("TF_footprint/iN_GM_TF_degs.csv")
  249. DTFB_GM_DEGs$deg_regulation <- ifelse(DTFB_GM_DEGs$log2FC_GM>0, "up", "down")
  250. DTFB_MGH_DEGs <- read.csv("TF_footprint/iN_MGH_TF_degs.csv")
  251. overlapped_tf_degs <- intersect(DTFB_MGH_DEGs$ensembl_id, DTFB_GM_DEGs$ensembl_id)
  252. overlapped_tf_degs_info <- left_join(DTFB_GM_DEGs[, c("ensembl_id","symbol","gene_type","motif_id","name","sig_change", "deg_regulation")], DTFB_MGH_DEGs[, c("ensembl_id","symbol","gene_type","motif_id","name","sig_change")], by = c("ensembl_id"="ensembl_id", "symbol"="symbol", "gene_type"="gene_type"), suffix = c(".GM", ".MGH"))
  253. overlapped_tf_degs_info <- overlapped_tf_degs_info[complete.cases(overlapped_tf_degs_info),]
  254. write.csv(overlapped_tf_degs_info, "TF_footprint/iN_GM_MGH_overlapped_tf_degs_info.csv", row.names = F)
  255. dtf_target_genes_gm <- length(intersect(DTFB_GM_genes$ensembl_id, analyzed_genes))
  256. dtf_target_genes_mgh <- length(intersect(DTFB_MGH_genes$ensembl_id, analyzed_genes))
  257. overlap_dtf_targets <- length(intersect(intersect(DTFB_GM_genes$ensembl_id, analyzed_genes), intersect(DTFB_MGH_genes$ensembl_id, analyzed_genes)))
  258. fisher_test <- fisher.test(matrix(c(overlap_dtf_targets, dtf_target_genes_gm-overlap_dtf_targets, dtf_target_genes_mgh-overlap_dtf_targets, length(analyzed_genes)-dtf_target_genes_gm-dtf_target_genes_mgh+overlap_dtf_targets), nrow = 2, ncol = 2), alternative = "greater")
  259. message("Number of GM DTF: ", nrow(DTFB_GM),
  260. "\nNumber of GM DTF that are expressed: ", sum(DTFB_GM$iN_expression == "Yes"),
  261. "\nNumber of MGH DTF: ", nrow(DTFB_MGH),
  262. "\nNumber of MGH DTF that are expressed: ", sum(DTFB_MGH$iN_expression == "Yes"))
  263. message("Number of DTF target genes in GM: ", length(intersect(DTFB_GM_genes$ensembl_id, analyzed_genes)),
  264. "\nNumber of DTF target genes in MGH: ", length(intersect(DTFB_MGH_genes$ensembl_id, analyzed_genes)),
  265. "\nNumber of DTF target genes in both GM and MGH: ", length(intersect(DTFB_GM_genes$ensembl_id,intersect(DTFB_MGH_genes$ensembl_id, analyzed_genes))),
  266. "\nNum overlap DTF target genes in GM vs MGH ", overlap_dtf_targets,
  267. " (fisher test pvalue = ", fisher_test$p.value, ")",
  268. "\nNumber of DTF target DEGs in GM: ", nrow(DTFB_GM_DEGs), " up = ", sum(DTFB_GM_DEGs$log2FC_GM>0), " down = ", sum(DTFB_GM_DEGs$log2FC_GM<0),
  269. "\nNumber of DTF target DEGs in MGH: ", nrow(DTFB_MGH_DEGs)," up = ", sum(DTFB_MGH_DEGs$log2FC_GM>0), " down = ", sum(DTFB_MGH_DEGs$log2FC_GM<0),
  270. "\nNumber of overlapped DTF target DEGs: ", nrow(overlapped_tf_degs_info), " up = ", sum(overlapped_tf_degs_info$deg_regulation=="up"), " down = ", sum(overlapped_tf_degs_info$deg_regulation=="down"))
  271. ```
  272. ## iN comp DTF target genes
  273. ```{r}
  274. del_vs_wt_final_degs <- read.csv("../POGZ_iN/results/8330_del1_del2_vs_8330_WT_threshold_0.5.csv")
  275. del_vs_wt_final_degs$log2FC <- del_vs_wt_final_degs$log2FoldChange
  276. del_vs_wt_final_degs <- del_vs_wt_final_degs[del_vs_wt_final_degs$padj<0.1,]
  277. ```
  278. ### Get differential binding GM TFs target genes
  279. ```{r}
  280. iN_GM_del1del2_vs_WT <- identify_differential_TF(iN_bindetect_results$iN_GM_del1del2_vs_WT)
  281. DTFB_path <- "/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_GM8330_Sep2020.DEL1DEL2_vs_WT.conservative_with_pogz_motifs"
  282. DTFB_comp <- iN_GM_del1del2_vs_WT[iN_GM_del1del2_vs_WT$sig_change != "NA",]
  283. DTFB_comp <- left_join(DTFB_comp, all_motifs_expression_info[, -c(which(colnames(all_motifs_expression_info) == "name"))], by = "motif_id")
  284. DTFB_DEGs <- get_TF_target_genes(DTFB_comp, express_colname = "iN_comp_het_expression", allpromoters, gene_annotation, DTFB_path, del_vs_wt_final_degs, "TF_footprint/iN_comp_")
  285. ```
  286. ## NSC DTF target genes
  287. ```{r}
  288. del_vs_wt_final_degs <- read.csv("../POGZ_paper/results/NSC_del_vs_wt_overlapped_GM_MGH.csv")
  289. ```
  290. ### Get differential binding GM TFs target genes
  291. ```{r}
  292. DTFB_GM_path <- "/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.NSC_GM.DEL_vs_WT.conservative"
  293. DTFB_GM <- NSC_GM_DEL_vs_WT[NSC_GM_DEL_vs_WT$sig_change != "NA",]
  294. DTFB_GM <- left_join(DTFB_GM, all_motifs_expression_info[, -c(which(colnames(all_motifs_expression_info) == "name"))], by = "motif_id")
  295. writexl::write_xlsx(DTFB_GM, "TF_footprint/NSC_GM_DTF.xlsx")
  296. DTFB_GM_DEGs <- get_TF_target_genes(DTFB_GM, express_colname = "NSC_expression", allpromoters, gene_annotation, DTFB_GM_path, del_vs_wt_final_degs, "TF_footprint/NSC_GM_")
  297. ```
  298. ### Get differential binding MGH TFs target genes
  299. ```{r}
  300. DTFB_MGH_path <- "/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.NSC_MGH.DEL_vs_WT.conservative"
  301. DTFB_MGH <- NSC_MGH_DEL_vs_WT[NSC_MGH_DEL_vs_WT$sig_change != "NA",]
  302. DTFB_MGH <- left_join(DTFB_MGH, all_motifs_expression_info[, -c(which(colnames(all_motifs_expression_info) == "name"))], by = "motif_id")
  303. writexl::write_xlsx(DTFB_MGH, "TF_footprint/NSC_MGH_DTF.xlsx")
  304. DTFB_MGH_DEGs <- get_TF_target_genes(DTFB_MGH, express_colname = "NSC_expression", allpromoters, gene_annotation, DTFB_MGH_path, del_vs_wt_final_degs, "TF_footprint/NSC_MGH_")
  305. ```
  306. ### Get overlapped TF targets DEGs across background
  307. ```{r}
  308. del_vs_wt_GM <- read.table("../NSC_03_2020/meta_analysis/POGZ_8330del1_2.metaAnalysis.txt", header = T)
  309. del_vs_wt_MGH <- read.table("../NSC_03_2020/meta_analysis/POGZ_MGHdel1_2.metaAnalysis.txt", header = T)
  310. analyzed_genes <- intersect(del_vs_wt_GM$ensemblid, del_vs_wt_MGH$ensemblid)
  311. DTFB_GM <- readxl::read_excel("TF_footprint/NSC_GM_DTF.xlsx")
  312. DTFB_MGH <- readxl::read_excel("TF_footprint/NSC_MGH_DTF.xlsx")
  313. DTFB_GM_genes <- read.csv("TF_footprint/NSC_GM_TF_genes.csv")
  314. DTFB_MGH_genes <- read.csv("TF_footprint/NSC_MGH_TF_genes.csv")
  315. DTFB_GM_DEGs <- read.csv("TF_footprint/NSC_GM_TF_degs.csv")
  316. DTFB_GM_DEGs$deg_regulation <- ifelse(DTFB_GM_DEGs$log2FC_GM>0, "up", "down")
  317. DTFB_MGH_DEGs <- read.csv("TF_footprint/NSC_MGH_TF_degs.csv")
  318. DTFB_MGH_DEGs$deg_regulation <- ifelse(DTFB_MGH_DEGs$log2FC_GM>0, "up", "down")
  319. overlapped_tf_degs <- intersect(DTFB_MGH_DEGs$ensembl_id, DTFB_GM_DEGs$ensembl_id)
  320. overlapped_tf_degs_info <- left_join(DTFB_GM_DEGs[, c("ensembl_id","symbol","gene_type","motif_id","name","sig_change", "deg_regulation")], DTFB_MGH_DEGs[, c("ensembl_id","symbol","gene_type","motif_id","name","sig_change")], by = c("ensembl_id"="ensembl_id", "symbol"="symbol", "gene_type"="gene_type"), suffix = c(".GM", ".MGH"))
  321. overlapped_tf_degs_info <- overlapped_tf_degs_info[complete.cases(overlapped_tf_degs_info),]
  322. write.csv(overlapped_tf_degs_info, "TF_footprint/NSC_GM_MGH_overlapped_tf_degs_info.csv", row.names = F)
  323. dtf_target_genes_gm <- length(intersect(DTFB_GM_genes$ensembl_id, analyzed_genes))
  324. dtf_target_genes_mgh <- length(intersect(DTFB_MGH_genes$ensembl_id, analyzed_genes))
  325. overlap_dtf_targets <- length(intersect(intersect(DTFB_GM_genes$ensembl_id, analyzed_genes), intersect(DTFB_MGH_genes$ensembl_id, analyzed_genes)))
  326. fisher_test <- fisher.test(matrix(c(overlap_dtf_targets, dtf_target_genes_gm-overlap_dtf_targets, dtf_target_genes_mgh-overlap_dtf_targets, length(analyzed_genes)-dtf_target_genes_gm-dtf_target_genes_mgh+overlap_dtf_targets), nrow = 2, ncol = 2), alternative = "greater")
  327. message("Number of GM DTF: ", nrow(DTFB_GM),
  328. "\nNumber of GM DTF that are expressed: ", sum(DTFB_GM$NSC_expression == "Yes"),
  329. "\nNumber of MGH DTF: ", nrow(DTFB_MGH),
  330. "\nNumber of MGH DTF that are expressed: ", sum(DTFB_MGH$NSC_expression == "Yes"))
  331. message("Number of DTF target genes in GM: ", length(intersect(DTFB_GM_genes$ensembl_id, analyzed_genes)),
  332. "\nNumber of DTF target genes in MGH: ", length(intersect(DTFB_MGH_genes$ensembl_id, analyzed_genes)),
  333. "\nNumber of DTF target genes in both GM and MGH: ", length(intersect(DTFB_GM_genes$ensembl_id,intersect(DTFB_MGH_genes$ensembl_id, analyzed_genes))),
  334. "\n Num overlap DTF target genes in GM vs MGH ", overlap_dtf_targets,
  335. " (fisher test pvalue = ", fisher_test$p.value, ")",
  336. "\nNumber of DTF target DEGs in GM: ", nrow(DTFB_GM_DEGs), " up = ", sum(DTFB_GM_DEGs$log2FC_GM>0), " down = ", sum(DTFB_GM_DEGs$log2FC_GM<0),
  337. "\nNumber of DTF target DEGs in MGH: ", nrow(DTFB_MGH_DEGs)," up = ", sum(DTFB_MGH_DEGs$log2FC_GM>0), " down = ", sum(DTFB_MGH_DEGs$log2FC_GM<0),
  338. "\nNumber of overlapped DTF target DEGs: ", nrow(overlapped_tf_degs_info), " up = ", sum(overlapped_tf_degs_info$deg_regulation=="up"), " down = ", sum(overlapped_tf_degs_info$deg_regulation=="down"))
  339. ```
  340. ## NSC comp DTF target genes
  341. ```{r}
  342. del_vs_wt_final_degs <- read.csv("../POGZ_NSC/results/8330_del1_del2_vs_8330_WT_threshold_0.5.csv")
  343. del_vs_wt_final_degs$log2FC <- del_vs_wt_final_degs$log2FoldChange
  344. del_vs_wt_final_degs <- del_vs_wt_final_degs[del_vs_wt_final_degs$padj<0.1,]
  345. ```
  346. ### Get differential binding GM TFs target genes
  347. ```{r}
  348. NSC_GM_del1del2_vs_WT <- identify_differential_TF(NSC_bindetect_results$NSC_GM_del1del2_vs_WT)
  349. DTFB_path <- "/Volumes/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.NSC_GM8330_Aug2020.DEL1DEL2_vs_WT.conservative_with_pogz_motifs"
  350. DTFB_comp <- NSC_GM_del1del2_vs_WT[NSC_GM_del1del2_vs_WT$sig_change != "NA",]
  351. DTFB_comp <- left_join(DTFB_comp, all_motifs_expression_info[, -c(which(colnames(all_motifs_expression_info) == "name"))], by = "motif_id")
  352. DTFB_DEGs <- get_TF_target_genes(DTFB_comp, express_colname = "NSC_comp_het_expression", allpromoters, gene_annotation, DTFB_path, del_vs_wt_final_degs, "TF_footprint/NSC_comp_")
  353. ```
  354. ## Check whether promoter targets and DEGs are significant overlapped
  355. ### iN intersect with symbol
  356. ```{r}
  357. del_vs_wt_GM <- read.csv("../POGZ_paper/results/DEL_vs_WT_GM__simple_model_sva/DEL_vs_WT_threshold_0.5_sv.csv", row.names = 1)
  358. del_vs_wt_MGH <- read.csv("../POGZ_paper/results/DEL_vs_WT_MGH__simple_model_sva/DEL_vs_WT_threshold_0.5_sv.csv", row.names = 1)
  359. analyzed_genes <- intersect(toupper(del_vs_wt_GM$symbol), toupper(del_vs_wt_MGH$symbol))
  360. del_vs_wt_final_degs <- read.csv("../POGZ_paper/results/del_vs_wt_overlapped_GM_MGH.csv")
  361. final_degs <- toupper(del_vs_wt_final_degs$symbol)
  362. DTFB_GM_genes <- read.csv("TF_footprint/iN_GM_TF_genes.csv")
  363. DTFB_MGH_genes <- read.csv("TF_footprint/iN_MGH_TF_genes.csv")
  364. DTFB_GM_DEGs <- read.csv("TF_footprint/iN_GM_TF_degs.csv")
  365. DTFB_MGH_DEGs <- read.csv("TF_footprint/iN_MGH_TF_degs.csv")
  366. # iN_GM
  367. target_genes <- intersect(toupper(DTFB_GM_genes$symbol), analyzed_genes)
  368. target_degs <- intersect(target_genes, final_degs)
  369. targets_vs_degs <- fisher.test(matrix(c(length(target_degs), length(target_genes)-length(target_degs), length(final_degs)-length(target_degs), length(analyzed_genes)-length(final_degs)-length(target_genes)+length(target_degs)), nrow=2),alternative = "greater")
  370. message("target genes = ", length(target_genes), " target degs = ", length(target_degs))
  371. print(targets_vs_degs)
  372. require(VennDiagram)
  373. venn.diagram(list("promoter_targets" = target_genes, "DEGs" = final_degs), main = "iN_GM_promoter_targets vs DEGs", sub = paste0("p.value = ", format(targets_vs_degs$p.value, digits=3)), filename = "TF_footprint/annotation_analysis/iN_GM_promoter_targes_vs_degs.png")
  374. # iN_MGH
  375. target_genes <- intersect(toupper(DTFB_MGH_genes$symbol), analyzed_genes)
  376. target_degs <- intersect(target_genes, final_degs)
  377. targets_vs_degs <- fisher.test(matrix(c(length(target_degs), length(target_genes)-length(target_degs), length(final_degs)-length(target_degs), length(analyzed_genes)-length(final_degs)-length(target_genes)+length(target_degs)), nrow=2),alternative = "greater")
  378. message("target genes = ", length(target_genes), " target degs = ", length(target_degs))
  379. print(targets_vs_degs)
  380. venn.diagram(list("promoter_targets" = target_genes, "DEGs" = final_degs), main = "iN_MGH_promoter_targets vs DEGs", sub = paste0("p.value = ", format(targets_vs_degs$p.value, digits=3)), filename = "TF_footprint/annotation_analysis/iN_MGH_promoter_targes_vs_degs.png")
  381. # iN GM and MGH overlapped DTFP
  382. target_genes <- intersect(toupper(DTFB_GM_genes$symbol), intersect(toupper(DTFB_MGH_genes$symbol), analyzed_genes))
  383. target_degs <- intersect(target_genes, final_degs)
  384. targets_vs_degs <- fisher.test(matrix(c(length(target_degs), length(target_genes)-length(target_degs), length(final_degs)-length(target_degs), length(analyzed_genes)-length(final_degs)-length(target_genes)+length(target_degs)), nrow=2),alternative = "greater")
  385. message("target genes = ", length(target_genes), " target degs = ", length(target_degs))
  386. print(targets_vs_degs)
  387. venn.diagram(list("promoter_targets" = target_genes, "DEGs" = final_degs), main = "iN_GM_and_MGH_overlapped promoter_targets vs DEGs", sub = paste0("p.value = ", format(targets_vs_degs$p.value, digits=3)), filename = "TF_footprint/annotation_analysis/iN_GM_MGH_overlapped_promoter_targes_vs_degs.png")
  388. ```
  389. ### NSC intersect with symbol
  390. ```{r}
  391. del_vs_wt_GM <- read.table("../NSC_03_2020/meta_analysis/POGZ_8330del1_2.metaAnalysis.txt", header = T)
  392. del_vs_wt_MGH <- read.table("../NSC_03_2020/meta_analysis/POGZ_MGHdel1_2.metaAnalysis.txt", header = T)
  393. analyzed_genes <- intersect(toupper(del_vs_wt_GM$symbol), toupper(del_vs_wt_MGH$symbol))
  394. del_vs_wt_final_degs <- read.csv("../POGZ_paper/results/NSC_del_vs_wt_overlapped_GM_MGH.csv")
  395. final_degs <- toupper(del_vs_wt_final_degs$symbol)
  396. DTFB_GM_genes <- read.csv("TF_footprint/NSC_GM_TF_genes.csv")
  397. DTFB_MGH_genes <- read.csv("TF_footprint/NSC_MGH_TF_genes.csv")
  398. DTFB_GM_DEGs <- read.csv("TF_footprint/NSC_GM_TF_degs.csv")
  399. DTFB_MGH_DEGs <- read.csv("TF_footprint/NSC_MGH_TF_degs.csv")
  400. # NSC_GM
  401. target_genes <- intersect(toupper(DTFB_GM_genes$symbol), analyzed_genes)
  402. target_degs <- intersect(target_genes, final_degs)
  403. targets_vs_degs <- fisher.test(matrix(c(length(target_degs), length(target_genes)-length(target_degs), length(final_degs)-length(target_degs), length(analyzed_genes)-length(final_degs)-length(target_genes)+length(target_degs)), nrow=2),alternative = "greater")
  404. message("target genes = ", length(target_genes), " target degs = ", length(target_degs))
  405. print(targets_vs_degs)
  406. require(VennDiagram)
  407. venn.diagram(list("promoter_targets" = target_genes, "DEGs" = final_degs), main = "NSC_GM_promoter_targets vs DEGs", sub = paste0("p.value = ", format(targets_vs_degs$p.value, digits=3)), filename = "TF_footprint/annotation_analysis/NSC_GM_promoter_targes_vs_degs.png")
  408. # NSC_MGH
  409. target_genes <- intersect(toupper(DTFB_MGH_genes$symbol), analyzed_genes)
  410. target_degs <- intersect(target_genes, final_degs)
  411. targets_vs_degs <- fisher.test(matrix(c(length(target_degs), length(target_genes)-length(target_degs), length(final_degs)-length(target_degs), length(analyzed_genes)-length(final_degs)-length(target_genes)+length(target_degs)), nrow=2),alternative = "greater")
  412. message("target genes = ", length(target_genes), " target degs = ", length(target_degs))
  413. print(targets_vs_degs)
  414. venn.diagram(list("promoter_targets" = target_genes, "DEGs" = final_degs), main = "NSC_MGH_promoter_targets vs DEGs", sub = paste0("p.value = ", format(targets_vs_degs$p.value, digits=3)), filename = "TF_footprint/annotation_analysis/NSC_MGH_promoter_targes_vs_degs.png")
  415. # NSC GM and MGH overlapped DTFP
  416. target_genes <- intersect(toupper(DTFB_GM_genes$symbol), intersect(toupper(DTFB_MGH_genes$symbol), analyzed_genes))
  417. target_degs <- intersect(target_genes, final_degs)
  418. targets_vs_degs <- fisher.test(matrix(c(length(target_degs), length(target_genes)-length(target_degs), length(final_degs)-length(target_degs), length(analyzed_genes)-length(final_degs)-length(target_genes)+length(target_degs)), nrow=2),alternative = "greater")
  419. message("target genes = ", length(target_genes), " target degs = ", length(target_degs))
  420. print(targets_vs_degs)
  421. venn.diagram(list("promoter_targets" = target_genes, "DEGs" = final_degs), main = "NSC_GM_and_MGH_overlapped promoter_targets vs DEGs", sub = paste0("p.value = ", format(targets_vs_degs$p.value, digits=3)), filename = "TF_footprint/annotation_analysis/NSC_GM_MGH_overlapped_promoter_targes_vs_degs.png")
  422. ```
  423. ## Check if POGZ a DTF
  424. ```{r}
  425. DTF_lst <- list(iN_GM_DTF = readxl::read_excel("TF_footprint/iN_GM_DTF.xlsx"),
  426. iN_MGH_DTF = readxl::read_excel("TF_footprint/iN_MGH_DTF.xlsx"),
  427. NSC_GM_DTF = readxl::read_excel("TF_footprint/NSC_GM_DTF.xlsx"),
  428. NSC_MGH_DTF = readxl::read_excel("TF_footprint/NSC_MGH_DTF.xlsx"),
  429. iN_comp_het_DTF <- readxl::read_excel("TF_footprint/"))
  430. lapply(1:length(DTF_lst), function(i) {message(names(DTF_lst)[i], ": ", DTF_lst[[i]][str_detect(DTF_lst[[i]]$name, "POGZ|pogz"),]$name)})
  431. ```
  432. ## Run enrichment analysis on DTFP from NSC and iN
  433. ```{r}
  434. source("../../MyTools/RNAseq.analysis/R/enrichment.R")
  435. load("../../MyTools/enrichment_analysis/data/pathway_db/pathway_db.Rdata")
  436. iN_del_vs_wt_GM <- read.csv("../POGZ_paper/results/DEL_vs_WT_GM__simple_model_sva/DEL_vs_WT_threshold_0.5_sv.csv", row.names = 1)
  437. rownames(iN_del_vs_wt_GM) <- iN_del_vs_wt_GM$ensembl_id
  438. iN_del_vs_wt_MGH <- read.csv("../POGZ_paper/results/DEL_vs_WT_MGH__simple_model_sva/DEL_vs_WT_threshold_0.5_sv.csv", row.names = 1)
  439. NSC_del_vs_wt_GM <- read.table("../NSC_03_2020/meta_analysis/POGZ_8330del1_2.metaAnalysis.txt", sep = "\t", header = T)
  440. NSC_del_vs_wt_MGH <- read.table("../NSC_03_2020/meta_analysis/POGZ_MGHdel1_2.metaAnalysis.txt", sep = "\t", header = T)
  441. iN_DTFB_GM_DEGs <- read.csv("TF_footprint/iN_GM_TF_degs.csv")
  442. iN_DTFB_MGH_DEGs <- read.csv("TF_footprint/iN_MGH_TF_degs.csv")
  443. NSC_DTFB_GM_DEGs <- read.csv("TF_footprint/NSC_GM_TF_degs.csv")
  444. NSC_DTFB_MGH_DEGs <- read.csv("TF_footprint/NSC_MGH_TF_degs.csv")
  445. iN_DTFB_GM_DEGs_sig_terms <- run_enrichment_on_genelist(list(iN_DTFB_GM_DEGs=iN_DTFB_GM_DEGs$symbol), iN_del_vs_wt_GM$symbol, outfolder = "TF_footprint/enrichment_analysis/iN_DTFB_GM_DEGs", outplotfolder = "TF_footprint/enrichment_analysis/iN_DTFB_GM_DEGs/plots", skip_enrichment_analysis=F, fdr_threshold=0.1)
  446. iN_DTFB_MGH_DEGs_sig_terms <- run_enrichment_on_genelist(list(iN_DTFB_MGH_DEGs=iN_DTFB_MGH_DEGs$symbol), iN_del_vs_wt_MGH$symbol, outfolder = "TF_footprint/enrichment_analysis/iN_DTFB_MGH_DEGs", outplotfolder = "TF_footprint/enrichment_analysis/iN_DTFB_MGH_DEGs/plots", skip_enrichment_analysis=F, fdr_threshold=0.1)
  447. iN_GM_MGH_overlapped_DTFB_DEGs_sig_terms <- run_enrichment_on_genelist(list(iN_GM_MGH_overlapped_DTFB_DEGs=intersect(iN_DTFB_GM_DEGs$symbol, iN_DTFB_MGH_DEGs$symbol)), intersect(iN_del_vs_wt_GM$symbol,iN_del_vs_wt_MGH$symbol), outfolder = "TF_footprint/enrichment_analysis/iN_GM_MGH_overlapped_DTFB_DEGs", outplotfolder = "TF_footprint/enrichment_analysis/iN_GM_MGH_overlapped_DTFB_DEGs/plots", skip_enrichment_analysis=F, fdr_threshold=0.1)
  448. NSC_DTFB_GM_DEGs_sig_terms <- run_enrichment_on_genelist(list(NSC_DTFB_GM_DEGs=NSC_DTFB_GM_DEGs$symbol), NSC_del_vs_wt_MGH$symbol, gene_to_remove = "POGZ", outfolder = "TF_footprint/enrichment_analysis/NSC_DTFB_GM_DEGs", outplotfolder = "TF_footprint/enrichment_analysis/NSC_DTFB_GM_DEGs/plots", skip_enrichment_analysis=F, fdr_threshold=0.1)
  449. NSC_DTFB_MGH_DEGs_sig_terms <- run_enrichment_on_genelist(list(NSC_DTFB_MGH_DEGs=NSC_DTFB_MGH_DEGs$symbol), NSC_del_vs_wt_MGH$symbol, gene_to_remove = "POGZ", outfolder = "TF_footprint/enrichment_analysis/NSC_DTFB_MGH_DEGs", outplotfolder = "TF_footprint/enrichment_analysis/NSC_DTFB_MGH_DEGs/plots", skip_enrichment_analysis=F, fdr_threshold=0.1)
  450. NSC_GM_MGH_overlapped_DTFB_DEGs_sig_terms <- run_enrichment_on_genelist(list(NSC_GM_MGH_overlapped_DTFB_DEGs=intersect(NSC_DTFB_GM_DEGs$symbol,NSC_DTFB_MGH_DEGs$symbol)), intersect(NSC_del_vs_wt_GM$symbol,NSC_del_vs_wt_MGH$symbol), gene_to_remove = "POGZ", outfolder = "TF_footprint/enrichment_analysis/NSC_GM_MGH_overlapped_DTFB_DEGs", outplotfolder = "TF_footprint/enrichment_analysis/NSC_GM_MGH_overlapped_DTFB_DEGs/plots", skip_enrichment_analysis=F, fdr_threshold=0.1)
  451. sig_terms_lst <- list(iN_DTFB_GM_DEGs_sig_terms = iN_DTFB_GM_DEGs_sig_terms,
  452. iN_DTFB_MGH_DEGs_sig_terms =iN_DTFB_MGH_DEGs_sig_terms,
  453. iN_GM_MGH_overlapped_DTFB_DEGs_sig_terms = iN_GM_MGH_overlapped_DTFB_DEGs_sig_terms,
  454. NSC_DTFB_GM_DEGs_sig_terms = NSC_DTFB_GM_DEGs_sig_terms,
  455. NSC_DTFB_MGH_DEGs_sig_terms = NSC_DTFB_MGH_DEGs_sig_terms,
  456. NSC_GM_MGH_overlapped_DTFB_DEGs_sig_terms = NSC_GM_MGH_overlapped_DTFB_DEGs_sig_terms)
  457. for (datset in names(sig_terms_lst)) {
  458. sig_terms <- sig_terms_lst[[datset]]
  459. if (nrow(sig_terms) == 0) {
  460. next
  461. }
  462. sig_terms_top10 <- slice_max(sig_terms, order_by = logBH, n = 10)
  463. sig_terms_top10$name <- str_wrap(sig_terms_top10$name, width = 50)
  464. sig_terms_top10$name <- factor(sig_terms_top10$name, levels = sig_terms_top10[order(sig_terms_top10$logBH),]$name)
  465. ggplot(sig_terms_top10, aes(x = name, y = logBH)) +
  466. geom_col(fill = "grey60") +
  467. coord_flip() +
  468. geom_text(aes(label = significant_genelist), hjust = 1) +
  469. labs(x = "", title = paste0("Top 10 sig terms for ", str_remove(datset, "_sig_terms"))) +
  470. theme(axis.text.y = element_text(size = 12), plot.title.position = "plot")
  471. ggsave(file.path("TF_footprint/enrichment_analysis", paste0("top10_sig_terms_", str_remove(datset, "_sig_terms"), ".pdf")), height = 7, width = 6)
  472. }
  473. ```
  474. <!-- ## Get differential binding TFs target genes version2 -->
  475. <!-- ### Get DTF for GM and MGH, find the DTF results folder path and write them to a text file -->
  476. <!-- ```{r} -->
  477. <!-- # Get DTF -->
  478. <!-- iN_bindetect_results <- readRDS("TF_footprint/iN_bindetect_results.rds") -->
  479. <!-- iN_GM_DEL_vs_WT <- identify_differential_TF(iN_bindetect_results$iN_GM_DEL_vs_WT) -->
  480. <!-- iN_GM_DTF <- iN_GM_DEL_vs_WT[iN_GM_DEL_vs_WT$sig_change != "NA",] -->
  481. <!-- iN_MGH_DEL_vs_WT <- identify_differential_TF(iN_bindetect_results$iN_MGH_DEL_vs_WT) -->
  482. <!-- iN_MGH_DTF <- iN_MGH_DEL_vs_WT[iN_MGH_DEL_vs_WT$sig_change != "NA",] -->
  483. <!-- DTFB_GM_path <- "/data/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_GM.DEL_vs_WT.conservative" -->
  484. <!-- DTFB_MGH_path <- "/data/talkowski/Samples/POGZ/ATAC/TF_footprint/DTFB.iN_MGH.DEL_vs_WT.conservative" -->
  485. <!-- get_TF_folders <- function(motif_info, DTFB_path, output) { -->
  486. <!-- # get motif directory name -->
  487. <!-- TF_folder <- paste(motif_info$name, motif_info$motif_id, sep = "_") -->
  488. <!-- TF_folder <- str_remove(TF_folder, "::") -->
  489. <!-- TF_folder <- str_remove_all(TF_folder, "\\(|\\)") -->
  490. <!-- TF_folder <- file.path(DTFB_path, TF_folder) -->
  491. <!-- write.table(TF_folder, output, quote = F, row.names = F, col.names = F, sep = "\t") -->
  492. <!-- } -->
  493. <!-- get_TF_folders(iN_GM_DTF, DTFB_GM_path, output = "/Volumes/talkowski/Samples/POGZ/ATAC/region_annotation/DTF_annotation/data/iN_GM_DTF.txt") -->
  494. <!-- get_TF_folders(iN_MGH_DTF, DTFB_MGH_path, output = "/Volumes/talkowski/Samples/POGZ/ATAC/region_annotation/DTF_annotation/data/iN_MGH_DTF.txt") -->
  495. <!-- # Annotate DTF bind sites with Ensembl regulatory features and promters-1500to500bp at /data/talkowski/Samples/POGZ/ATAC/region_annotation/DTF_annotation -->
  496. <!-- ``` -->
  497. <!-- ### Downstream analysis on the bind sites are predicted bound within at least one condition (take a bit long time) -->
  498. <!-- ```{r eval=FALSE} -->
  499. <!-- stat_summary <- data.frame() -->
  500. <!-- promoter_overlapped_bind_sites_all_DTFs <- data.frame() -->
  501. <!-- enhancer_overlapped_bind_sites_all_DTFs <- data.frame() -->
  502. <!-- DTFs <- read.table("/Volumes/talkowski/Samples/POGZ/ATAC/region_annotation/DTF_annotation/data/iN_DTF.txt", col.names = "folder") -->
  503. <!-- for (DTF in DTFs$folder) { -->
  504. <!-- print(DTF) -->
  505. <!-- bind_site_file <- str_replace(file.path(DTF, paste0(basename(DTF), "_overview.txt")), "/data", "/Volumes") -->
  506. <!-- original_bind_sites <- read.table(bind_site_file, sep = "\t", header = T) -->
  507. <!-- DTF_stat <- data.frame(motif = basename(DTF), total_bind_sites = nrow(original_bind_sites)) -->
  508. <!-- prefix <- str_remove(basename(dirname(DTF)),"DEL_vs_WT.conservative") -->
  509. <!-- annotated_file <- list.files("/Volumes/talkowski/Samples/POGZ/ATAC/region_annotation/DTF_annotation/results_iN", paste0(prefix, basename(DTF), ".sorted.bed"), full.names = T) -->
  510. <!-- bind_sites <- read.table(annotated_file, sep = "\t") -->
  511. <!-- DTF_stat$num_annotated_sites <- nrow(unique(bind_sites[, c(1:3,6)])) -->
  512. <!-- # the bind sites are predicted bound within at least one condition -->
  513. <!-- bind_sites <- bind_sites[(bind_sites$V19 + bind_sites$V20) > 0,] -->
  514. <!-- DTF_stat$num_bound_sites <- nrow(unique(bind_sites[, c(1:3,6)])) -->
  515. <!-- bind_sites$activity <- "" -->
  516. <!-- bind_sites[bind_sites$V30 != ".",]$activity <- str_remove(sapply(str_split(bind_sites[bind_sites$V30 != ".",]$V30,";"),`[[`, 1),"activity=") -->
  517. <!-- bind_sites$regulatory_feature_id <- "" -->
  518. <!-- bind_sites[bind_sites$V30 != ".",]$regulatory_feature_id <- str_remove(sapply(str_split(bind_sites[bind_sites$V30 != ".",]$V30,";"),`[[`, 7),"regulatory_feature_stable_id=") -->
  519. <!-- # the bind sites that are annotated as promoters -->
  520. <!-- # remove the false positive which the cell specify annotation activity=NA -->
  521. <!-- promoter_overlapped_bind_sites <- unique(bind_sites[str_detect(bind_sites$V24,"promoter$|promoter2000bp") & bind_sites$activity != "NA",c(1:6, 17:21,24,which(colnames(bind_sites) %in% c("activity","regulatory_feature_id")))]) -->
  522. <!-- DTF_stat$num_overlapped_promoters <- nrow(unique(promoter_overlapped_bind_sites[,c(1:11)])) -->
  523. <!-- # the bind sites that are annotated as enhancers -->
  524. <!-- enhancer_overlapped_bind_sites <- unique(bind_sites[bind_sites$V24 == "enhancer" & bind_sites$activity != "NA",c(1:6, 17:21,24,which(colnames(bind_sites) %in% c("activity","regulatory_feature_id")))]) -->
  525. <!-- DTF_stat$num_overlapped_enhancers <- nrow(unique(enhancer_overlapped_bind_sites[,c(1:11)])) -->
  526. <!-- colnames(promoter_overlapped_bind_sites) <- c("chr", "start", "end", "motif", "motif_score", "strand", "DEL_score", "WT_score", "DEL_bound", "WT_bound", "DEL_vs_WT_log2fc", "annotation", "activity", "regulatory_feature_id") -->
  527. <!-- colnames(enhancer_overlapped_bind_sites) <- c("chr", "start", "end", "motif", "motif_score", "strand", "DEL_score", "WT_score", "DEL_bound", "WT_bound", "DEL_vs_WT_log2fc", "annotation", "activity", "regulatory_feature_id") -->
  528. <!-- # add background info -->
  529. <!-- background <- str_remove(str_remove(basename(dirname(DTF)), ".DEL_vs_WT.conservative"), "DTFB.") -->
  530. <!-- promoter_overlapped_bind_sites$background <- background -->
  531. <!-- enhancer_overlapped_bind_sites$background <- background -->
  532. <!-- DTF_stat$background <- background -->
  533. <!-- promoter_overlapped_bind_sites_all_DTFs <- rbind(promoter_overlapped_bind_sites_all_DTFs, promoter_overlapped_bind_sites) -->
  534. <!-- enhancer_overlapped_bind_sites_all_DTFs <- rbind(enhancer_overlapped_bind_sites_all_DTFs, enhancer_overlapped_bind_sites) -->
  535. <!-- stat_summary <- rbind(stat_summary, DTF_stat) -->
  536. <!-- } -->
  537. <!-- writexl::write_xlsx(stat_summary, "TF_footprint/annotation_analysis/DTF_annotation_stat_summary.xlsx") -->
  538. <!-- writexl::write_xlsx(promoter_overlapped_bind_sites_all_DTFs, "TF_footprint/annotation_analysis/promoter_overlapped_bind_sites_all_DTFs_with_annotation.xlsx") -->
  539. <!-- writexl::write_xlsx(enhancer_overlapped_bind_sites_all_DTFs, "TF_footprint/annotation_analysis/enhancer_overlapped_bind_sites_all_DTFs_with_annotation.xlsx") -->
  540. <!-- writexl::write_xlsx(unique(promoter_overlapped_bind_sites_all_DTFs[,c(1:11,15)]), "TF_footprint/annotation_analysis/promoter_overlapped_bind_sites_all_DTFs.xlsx") -->
  541. <!-- writexl::write_xlsx(unique(enhancer_overlapped_bind_sites_all_DTFs[,c(1:11,15)]), "TF_footprint/annotation_analysis/enhancer_overlapped_bind_sites_all_DTFs.xlsx") -->
  542. <!-- ``` -->
  543. <!-- ### Plot overall stat -->
  544. <!-- ```{r} -->
  545. <!-- stat_summary <- readxl::read_excel("TF_footprint/annotation_analysis/DTF_annotation_stat_summary.xlsx") -->
  546. <!-- stat_summary_long <- tidyr::pivot_longer(stat_summary, names_to = "category", values_to = "Number", cols = total_bind_sites:num_overlapped_enhancers) -->
  547. <!-- ggplot(stat_summary_long, aes(x = category, y = Number)) + -->
  548. <!-- geom_boxplot() + -->
  549. <!-- labs(y = "Total number of bind sites", x = "") + -->
  550. <!-- facet_wrap(~background) + -->
  551. <!-- theme(axis.text.x = element_text(angle = 45, hjust=1)) -->
  552. <!-- stat_summary_long_tbl <- stat_summary_long %>% group_by(background, category) %>% summarise(num_motifs = n(), mean_num_bind_sites=round(mean(Number)), total_num_bind_sites=sum(Number)) -->
  553. <!-- stat_summary_tbl <- tidyr::pivot_wider(stat_summary_long_tbl, names_from = category, values_from = c("mean_num_bind_sites", "total_num_bind_sites")) -->
  554. <!-- writexl::write_xlsx(stat_summary_tbl, "TF_footprint/annotation_analysis/stat_summary_tbl.xlsx") -->
  555. <!-- ``` -->
  556. <!-- ### find promoter target genes -->
  557. <!-- ```{r} -->
  558. <!-- require(ensembldb) -->
  559. <!-- edb <- EnsDb("data/Homo_sapiens.GRCh38.92.sqlite") -->
  560. <!-- allpromoters <- promoters(edb, upstream = 1500, downstream = 500) -->
  561. <!-- gene_annotation <- readRDS("../iN_05_2021/results/gene_annotation.rds") -->
  562. <!-- gene_annotation$symbol <- toupper(gene_annotation$symbol) -->
  563. <!-- del_vs_wt_final_degs <- read.csv("../POGZ_paper/results/del_vs_wt_overlapped_GM_MGH.csv") -->
  564. <!-- del_vs_wt_final_degs$symbol <- toupper(del_vs_wt_final_degs$symbol) -->
  565. <!-- overlapped_bind_sites <- readxl::read_excel("TF_footprint/annotation_analysis/promoter_overlapped_bind_sites_all_DTFs.xlsx") -->
  566. <!-- identify_promoter_target_genes <- function(overlapped_bind_sites, background, promoter_regions, gene_annotation, final_degs) { -->
  567. <!-- bind_sites <- overlapped_bind_sites[overlapped_bind_sites$background == background,] -->
  568. <!-- message("number of bind sites: ", nrow(bind_sites)) -->
  569. <!-- log2fc_quantile <- quantile(bind_sites$DEL_vs_WT_log2fc, prob = seq(0,1, by = 0.05)) -->
  570. <!-- print(log2fc_quantile) -->
  571. <!-- bind_sites <- bind_sites[bind_sites$DEL_vs_WT_log2fc < log2fc_quantile[["10%"]] | bind_sites$DEL_vs_WT_log2fc > log2fc_quantile[["90%"]],] -->
  572. <!-- message("number of bind sites in top quantitle: ", nrow(bind_sites)) -->
  573. <!-- bind_sites_gr <- GRanges(seqnames = bind_sites$chr, ranges = IRanges(start = bind_sites$start, end = bind_sites$end), strand = bind_sites$strand) -->
  574. <!-- bind_sites_vs_promoters <- bind_sites[queryHits(findOverlaps(bind_sites_gr, allpromoters)),] -->
  575. <!-- bind_sites_vs_promoters$target_gene_id <- allpromoters[subjectHits(findOverlaps(bind_sites_gr, allpromoters)),]$gene_id -->
  576. <!-- bind_sites_vs_promoters <- left_join(bind_sites_vs_promoters, gene_annotation[, c("ensembl_id", "symbol", "gene_type")], by = c("target_gene_id" = "ensembl_id")) -->
  577. <!-- bind_sites_vs_promoters <- left_join(bind_sites_vs_promoters, final_degs[, c("ensembl_id", "padj", "log2FoldChange")], by = c("target_gene_id" = "ensembl_id")) -->
  578. <!-- writexl::write_xlsx(bind_sites_vs_promoters, file.path("TF_footprint/annotation_analysis", paste0(background, "_bind_sites_vs_promoters.xlsx"))) -->
  579. <!-- return (bind_sites_vs_promoters) -->
  580. <!-- } -->
  581. <!-- iN_GM_promoter_targets <- identify_promoter_target_genes(overlapped_bind_sites, "iN_GM", allpromoters, gene_annotation, del_vs_wt_final_degs) -->
  582. <!-- iN_MGH_promoter_targets <- identify_promoter_target_genes(overlapped_bind_sites, "iN_MGH", allpromoters, gene_annotation, del_vs_wt_final_degs) -->
  583. <!-- ``` -->
  584. <!-- ### Run enrichment analysis for promoter target DEGs -->
  585. <!-- ```{r} -->
  586. <!-- source("../../MyTools/RNAseq.analysis/R/enrichment.R") -->
  587. <!-- outfolder <- "TF_footprint/annotation_analysis/promoter_targets_enrichment_analysis" -->
  588. <!-- if (!dir.exists(outfolder)) { -->
  589. <!-- dir.create(outfolder, recursive = T) -->
  590. <!-- } -->
  591. <!-- iN_gene_table <- data.frame(ensembl_id = intersect(del_vs_wt_GM$ensembl_id, del_vs_wt_MGH$ensembl_id)) -->
  592. <!-- iN_gene_table$symbol <- gene_annotation[iN_gene_table$ensembl_id,]$symbol -->
  593. <!-- iN_gene_table$gene_type <- gene_annotation[iN_gene_table$ensembl_id,]$gene_type -->
  594. <!-- # set padj and log2FoldChange for promoter target degs -->
  595. <!-- iN_GM_promoter_targets_DEGs <- iN_gene_table -->
  596. <!-- iN_GM_promoter_targets_DEGs <- left_join(iN_GM_promoter_targets_DEGs, del_vs_wt_final_degs[del_vs_wt_final_degs$symbol %in% iN_GM_promoter_targets$symbol,c("ensembl_id", "padj", "log2FoldChange")], by = "ensembl_id") -->
  597. <!-- iN_GM_promoter_targets_DEGs$padj[is.na(iN_GM_promoter_targets_DEGs$padj)] <- 1 -->
  598. <!-- iN_GM_promoter_targets_DEGs$log2FoldChange[is.na(iN_GM_promoter_targets_DEGs$log2FoldChange)] <- 0 -->
  599. <!-- # set padj and log2FoldChange for promoter target degs -->
  600. <!-- iN_MGH_promoter_targets_DEGs <- iN_gene_table -->
  601. <!-- iN_MGH_promoter_targets_DEGs <- left_join(iN_MGH_promoter_targets_DEGs, del_vs_wt_final_degs[del_vs_wt_final_degs$symbol %in% iN_MGH_promoter_targets$symbol,c("ensembl_id", "padj", "log2FoldChange")], by = "ensembl_id") -->
  602. <!-- iN_MGH_promoter_targets_DEGs$padj[is.na(iN_MGH_promoter_targets_DEGs$padj)] <- 1 -->
  603. <!-- iN_MGH_promoter_targets_DEGs$log2FoldChange[is.na(iN_MGH_promoter_targets_DEGs$log2FoldChange)] <- 0 -->
  604. <!-- promoter_targets <- list(iN_GM_promoter_targets_DEGs = iN_GM_promoter_targets_DEGs, -->
  605. <!-- iN_MGH_promoter_targets_DEGs = iN_MGH_promoter_targets_DEGs) -->
  606. <!-- thresholds <- as.list(rep(0.1, length(promoter_targets))) -->
  607. <!-- names(thresholds) <- names(promoter_targets) -->
  608. <!-- protein_coding_option <- "yes" -->
  609. <!-- option <- "all_fdr" -->
  610. <!-- gene_lst_to_remove <- c(all_genes = "XXX") -->
  611. <!-- load("../../MyTools/enrichment_analysis/data/pathway_db/pathway_db.Rdata") -->
  612. <!-- top_enrichment_terms <- run_enrichment(promoter_targets, thresholds, protein_coding_option, option, gene_lst_to_remove, no = 20, outfolder = outfolder, outplotfolder = file.path(outfolder, "plots")) -->
  613. <!-- saveRDS(top_enrichment_terms, file.path(outfolder, "top_enrichment_terms.rds")) -->
  614. <!-- enrichment_summary(top_enrichment_terms,input_names = names(promoter_targets), fdr = 0.1, output = file.path(outfolder, "sig_enrichment_terms.xlsx")) -->
  615. <!-- ``` -->
  616. <!-- ### plot significant terms for promoter target DEGs -->
  617. <!-- ```{r} -->
  618. <!-- sig_enrichment_terms <- readxl::read_excel("TF_footprint/annotation_analysis/promoter_targets_enrichment_analysis/sig_enrichment_terms.xlsx") -->
  619. <!-- iN_GM_sig <- sig_enrichment_terms[sig_enrichment_terms$module == "iN_GM_promoter_targets_DEGs",] -->
  620. <!-- iN_GM_sig$name <- make.unique(iN_GM_sig$name) -->
  621. <!-- iN_GM_sig <- iN_GM_sig[order(iN_GM_sig$DB,iN_GM_sig$logBH),] -->
  622. <!-- iN_GM_sig$name <- factor(iN_GM_sig$name, levels = iN_GM_sig$name) -->
  623. <!-- ggplot(iN_GM_sig, aes(x = name, y = logBH, fill = DB)) + -->
  624. <!-- geom_col(position = "dodge") + -->
  625. <!-- geom_text(aes(label=paste0(up_sig,"/",down_sig)), position = position_stack(vjust = .5)) + -->
  626. <!-- coord_flip() + -->
  627. <!-- theme(axis.title.x = element_blank(), axis.text.x = element_text(size = 6)) -->
  628. <!-- ggsave("TF_footprint/annotation_analysis/promoter_targets_enrichment_analysis/iN_GM_sig_terms.pdf",height = 10, width = 10) -->
  629. <!-- iN_MGH_sig <- sig_enrichment_terms[sig_enrichment_terms$module == "iN_MGH_promoter_targets_DEGs",] -->
  630. <!-- iN_MGH_sig$name <- make.unique(iN_MGH_sig$name) -->
  631. <!-- iN_MGH_sig <- iN_MGH_sig[order(iN_MGH_sig$DB,iN_MGH_sig$logBH),] -->
  632. <!-- iN_MGH_sig$name <- factor(iN_MGH_sig$name, levels = iN_MGH_sig$name) -->
  633. <!-- ggplot(iN_MGH_sig, aes(x = name, y = logBH, fill = DB)) + -->
  634. <!-- geom_col(position = "dodge") + -->
  635. <!-- geom_text(aes(label=paste0(up_sig,"/",down_sig)), position = position_stack(vjust = .5), size = 3) + -->
  636. <!-- coord_flip() + -->
  637. <!-- theme(axis.title.x = element_blank(), axis.text.x = element_text(size = 6)) -->
  638. <!-- ggsave("TF_footprint/annotation_analysis/promoter_targets_enrichment_analysis/iN_MGH_sig_terms.pdf", height = 10, width = 10) -->
  639. <!-- ``` -->
  640. <!-- ### Make a table for DTF promoter target degs and their associate DTF -->
  641. <!-- ```{r} -->
  642. <!-- iN_GM_promoter_targets <- readxl::read_excel("TF_footprint/annotation_analysis/iN_GM_bind_sites_vs_promoters.xlsx") -->
  643. <!-- iN_GM_promoter_targets_DEGs <- unique(iN_GM_promoter_targets[!is.na(iN_GM_promoter_targets$padj),]) -->
  644. <!-- iN_GM_promoter_targets_DEGs <- iN_GM_promoter_targets_DEGs[order(iN_GM_promoter_targets_DEGs$symbol),] -->
  645. <!-- writexl::write_xlsx(iN_GM_promoter_targets_DEGs, "TF_footprint/annotation_analysis/iN_GM_promoter_targes_degs_with_DTF.xlsx") -->
  646. <!-- iN_MGH_promoter_targets <- readxl::read_excel("TF_footprint/annotation_analysis/iN_MGH_bind_sites_vs_promoters.xlsx") -->
  647. <!-- iN_MGH_promoter_targets_DEGs <- unique(iN_MGH_promoter_targets[!is.na(iN_MGH_promoter_targets$padj),]) -->
  648. <!-- iN_MGH_promoter_targets_DEGs <- iN_MGH_promoter_targets_DEGs[order(iN_MGH_promoter_targets_DEGs$symbol),] -->
  649. <!-- writexl::write_xlsx(iN_MGH_promoter_targets_DEGs, "TF_footprint/annotation_analysis/iN_MGH_promoter_targets_degs_with_DTF.xlsx") -->
  650. <!-- ``` -->
  651. <!-- ### Find promoter target DEGs enrichment terms that are overlapped in GM vs MGH -->
  652. <!-- ```{r} -->
  653. <!-- sig_enrichment_terms <- readxl::read_excel("TF_footprint/annotation_analysis_iN/promoter_targets_enrichment_analysis/sig_enrichment_terms.xlsx") -->
  654. <!-- db_names <- unique(sig_enrichment_terms$DB) -->
  655. <!-- overlapped_terms_tbl <- data.frame() -->
  656. <!-- for (db_name in db_names) { -->
  657. <!-- GM_sig_terms <- sig_enrichment_terms[sig_enrichment_terms$module == "iN_GM_promoter_targets_DEGs" & sig_enrichment_terms$DB == db_name,] -->
  658. <!-- MGH_sig_terms <- sig_enrichment_terms[sig_enrichment_terms$module == "iN_MGH_promoter_targets_DEGs" & sig_enrichment_terms$DB == db_name,] -->
  659. <!-- overlapped_terms <- intersect(GM_sig_terms$name, MGH_sig_terms$name) -->
  660. <!-- if (length(overlapped_terms) > 0) { -->
  661. <!-- overlapped_terms_tbl <- rbind(overlapped_terms_tbl, data.frame(DB = db_name, name = overlapped_terms, -->
  662. <!-- up_sig_GM = GM_sig_terms[GM_sig_terms$name %in% overlapped_terms,]$up_sig, -->
  663. <!-- down_sig_GM = GM_sig_terms[GM_sig_terms$name %in% overlapped_terms,]$down_sig, -->
  664. <!-- up_sig_MGH = MGH_sig_terms[MGH_sig_terms$name %in% overlapped_terms,]$up_sig, -->
  665. <!-- down_sig_MGH = MGH_sig_terms[MGH_sig_terms$name %in% overlapped_terms,]$down_sig)) -->
  666. <!-- } -->
  667. <!-- } -->
  668. <!-- writexl::write_xlsx(overlapped_terms_tbl, "TF_footprint/annotation_analysis_iN/promoter_targets_enrichment_analysis/sig_enrichment_terms_shared_in_GM_MGH.xlsx") -->
  669. <!-- ``` -->
  670. <!-- ### find enhancer target genes/ontology on GREAT -->
  671. <!-- ```{r} -->
  672. <!-- identify_enhancer_target_regions <- function(overlapped_bind_sites, background) { -->
  673. <!-- bind_sites <- overlapped_bind_sites[overlapped_bind_sites$background == background,] -->
  674. <!-- message("number of bind sites: ", nrow(bind_sites)) -->
  675. <!-- log2fc_quantile <- quantile(bind_sites$DEL_vs_WT_log2fc, prob = seq(0,1, by = 0.05)) -->
  676. <!-- print(log2fc_quantile) -->
  677. <!-- bind_sites <- bind_sites[bind_sites$DEL_vs_WT_log2fc < log2fc_quantile[["10%"]] | bind_sites$DEL_vs_WT_log2fc > log2fc_quantile[["90%"]],] -->
  678. <!-- message("number of bind sites in top quantitle: ", nrow(bind_sites)) -->
  679. <!-- bind_sites$chr <- str_c("chr", bind_sites$chr) -->
  680. <!-- bind_sites$start <- bind_sites$start-1 -->
  681. <!-- bind_sites$score <- round(bind_sites$motif_score) -->
  682. <!-- bind_sites$name <- paste(bind_sites$chr, bind_sites$start, bind_sites$end, bind_sites$motif, sep = "_") -->
  683. <!-- write.table(unique(bind_sites[, c("chr", "start", "end", "name", "score", "strand")]), file.path("TF_footprint/annotation_analysis/enhancer_analysis", paste0(background, "_enhancer_overlapped_bind_sites.bed")), sep = "\t", quote = F, col.names = F, row.names = F) -->
  684. <!-- return(bind_sites) -->
  685. <!-- } -->
  686. <!-- overlapped_bind_sites <- readxl::read_excel("TF_footprint/annotation_analysis/enhancer_overlapped_bind_sites_all_DTFs.xlsx") -->
  687. <!-- iN_GM_enhancer_targets <- identify_enhancer_target_regions(overlapped_bind_sites, "iN_GM") -->
  688. <!-- iN_MGH_enhancer_targets <- identify_enhancer_target_regions(overlapped_bind_sites, "iN_MGH") -->
  689. <!-- # upload bed files to GREAT and export region-gene association table -->
  690. <!-- ``` -->
  691. <!-- ### Read region-gene association table, get enhancer target genes -->
  692. <!-- ```{r} -->
  693. <!-- iN_GM_enhancer_target_genes <- read.table("TF_footprint/annotation_analysis/enhancer_analysis/iN_GM_enhancer_targets.txt", sep = "\t", col.names = c("region", "gene")) -->
  694. <!-- iN_GM_enhancer_target_gene_symbols <- unique(unlist(lapply(str_split(iN_GM_enhancer_target_genes[iN_GM_enhancer_target_genes$gene != "NONE", ]$gene,","), str_remove_all, "\\s+|\\(.*\\)"))) -->
  695. <!-- iN_MGH_enhancer_target_genes <- read.table("TF_footprint/annotation_analysis/enhancer_analysis/iN_MGH_enhancer_targets.txt", sep = "\t", col.names = c("region", "gene")) -->
  696. <!-- iN_MGH_enhancer_target_gene_symbols <- unique(unlist(lapply(str_split(iN_MGH_enhancer_target_genes[iN_MGH_enhancer_target_genes$gene != "NONE", ]$gene,","), str_remove_all, "\\s+|\\(.*\\)"))) -->
  697. <!-- ``` -->
  698. <!-- ### Check whether enhancer targets and DEGs are significant overlapped -->
  699. <!-- ```{r} -->
  700. <!-- del_vs_wt_GM <- read.csv("../POGZ_paper/results/DEL_vs_WT_GM__simple_model_sva/DEL_vs_WT_threshold_0.5_sv.csv", row.names = 1) -->
  701. <!-- del_vs_wt_MGH <- read.csv("../POGZ_paper/results/DEL_vs_WT_MGH__simple_model_sva/DEL_vs_WT_threshold_0.5_sv.csv", row.names = 1) -->
  702. <!-- analyzed_genes <- intersect(toupper(del_vs_wt_GM$symbol), toupper(del_vs_wt_MGH$symbol)) -->
  703. <!-- del_vs_wt_final_degs <- read.csv("../POGZ_paper/results/del_vs_wt_overlapped_GM_MGH.csv") -->
  704. <!-- del_vs_wt_final_degs$symbol <- toupper(del_vs_wt_final_degs$symbol) -->
  705. <!-- final_degs <- del_vs_wt_final_degs$symbol -->
  706. <!-- # iN_GM -->
  707. <!-- target_genes <- intersect(iN_GM_enhancer_target_gene_symbols, analyzed_genes) -->
  708. <!-- target_degs <- intersect(target_genes, final_degs) -->
  709. <!-- targets_vs_degs <- fisher.test(matrix(c(length(target_degs), length(target_genes)-length(target_degs), length(final_degs)-length(target_degs), length(analyzed_genes)-length(final_degs)-length(target_genes)+length(target_degs)), nrow=2),alternative = "greater") -->
  710. <!-- require(VennDiagram) -->
  711. <!-- venn.diagram(list("enhancer_targets" = target_genes, "DEGs" = final_degs), main = "iN_GM_enhancer_targets vs DEGs", sub = paste0("p.value = ", format(targets_vs_degs$p.value, digits=3)), filename = "TF_footprint/annotation_analysis/iN_GM_enhancer_targes_vs_degs.png") -->
  712. <!-- # iN_MGH -->
  713. <!-- target_genes <- intersect(iN_MGH_enhancer_target_gene_symbols, analyzed_genes) -->
  714. <!-- target_degs <- intersect(target_genes, final_degs) -->
  715. <!-- targets_vs_degs <- fisher.test(matrix(c(length(target_degs), length(target_genes)-length(target_degs), length(final_degs)-length(target_degs), length(analyzed_genes)-length(final_degs)-length(target_genes)+length(target_degs)), nrow=2),alternative = "greater") -->
  716. <!-- venn.diagram(list("enhancer_targets" = target_genes, "DEGs" = final_degs), main = "iN_MGH_enhancer_targets vs DEGs", sub = paste0("p.value = ", format(targets_vs_degs$p.value, digits=3)), filename = "TF_footprint/annotation_analysis/iN_MGH_enhancer_targes_vs_degs.png") -->
  717. <!-- ``` -->
  718. <!-- ### Run enrichment analysis for enhancer target DEGs -->
  719. <!-- ```{r} -->
  720. <!-- source("../../MyTools/RNAseq.analysis/R/enrichment.R") -->
  721. <!-- outfolder <- "TF_footprint/annotation_analysis/enhancer_targets_enrichment_analysis" -->
  722. <!-- if (!dir.exists(outfolder)) { -->
  723. <!-- dir.create(outfolder, recursive = T) -->
  724. <!-- } -->
  725. <!-- gene_annotation <- readRDS("../iN_05_2021/results/gene_annotation.rds") -->
  726. <!-- gene_annotation$symbol <- toupper(gene_annotation$symbol) -->
  727. <!-- iN_gene_table <- data.frame(ensembl_id = intersect(del_vs_wt_GM$ensembl_id, del_vs_wt_MGH$ensembl_id)) -->
  728. <!-- iN_gene_table$symbol <- gene_annotation[iN_gene_table$ensembl_id,]$symbol -->
  729. <!-- iN_gene_table$gene_type <- gene_annotation[iN_gene_table$ensembl_id,]$gene_type -->
  730. <!-- # set padj and log2FoldChange for enhancer target genes MGH -->
  731. <!-- iN_GM_enhancer_targets <- iN_gene_table -->
  732. <!-- iN_GM_enhancer_targets$padj <- 1 -->
  733. <!-- iN_GM_enhancer_targets[iN_GM_enhancer_targets$symbol %in% iN_GM_enhancer_target_gene_symbols,]$padj <- 0 -->
  734. <!-- iN_GM_enhancer_targets$log2FoldChange <- 1 -->
  735. <!-- # set padj and log2FoldChange for enhancer target genes MGH -->
  736. <!-- iN_MGH_enhancer_targets <- iN_gene_table -->
  737. <!-- iN_MGH_enhancer_targets$padj <- 1 -->
  738. <!-- iN_MGH_enhancer_targets[iN_MGH_enhancer_targets$symbol %in% iN_MGH_enhancer_target_gene_symbols,]$padj <- 0 -->
  739. <!-- iN_MGH_enhancer_targets$log2FoldChange <- 1 -->
  740. <!-- # set padj and log2FoldChange for enhancer target degs -->
  741. <!-- iN_GM_enhancer_targets_DEGs <- iN_gene_table -->
  742. <!-- iN_GM_enhancer_targets_DEGs <- left_join(iN_GM_enhancer_targets_DEGs, del_vs_wt_final_degs[del_vs_wt_final_degs$symbol %in% iN_GM_enhancer_target_gene_symbols,c("ensembl_id", "padj", "log2FoldChange")], by = "ensembl_id") -->
  743. <!-- iN_GM_enhancer_targets_DEGs$padj[is.na(iN_GM_enhancer_targets_DEGs$padj)] <- 1 -->
  744. <!-- iN_GM_enhancer_targets_DEGs$log2FoldChange[is.na(iN_GM_enhancer_targets_DEGs$log2FoldChange)] <- 0 -->
  745. <!-- # set padj and log2FoldChange for enhancer target degs -->
  746. <!-- iN_MGH_enhancer_targets_DEGs <- iN_gene_table -->
  747. <!-- iN_MGH_enhancer_targets_DEGs <- left_join(iN_MGH_enhancer_targets_DEGs, del_vs_wt_final_degs[del_vs_wt_final_degs$symbol %in% iN_MGH_enhancer_target_gene_symbols,c("ensembl_id", "padj", "log2FoldChange")], by = "ensembl_id") -->
  748. <!-- iN_MGH_enhancer_targets_DEGs$padj[is.na(iN_MGH_enhancer_targets_DEGs$padj)] <- 1 -->
  749. <!-- iN_MGH_enhancer_targets_DEGs$log2FoldChange[is.na(iN_MGH_enhancer_targets_DEGs$log2FoldChange)] <- 0 -->
  750. <!-- enhancer_targets <- list(iN_GM_enhancer_targets = iN_GM_enhancer_targets, -->
  751. <!-- iN_MGH_enhancer_targets = iN_MGH_enhancer_targets, -->
  752. <!-- iN_GM_enhancer_targets_DEGs = iN_GM_enhancer_targets_DEGs, -->
  753. <!-- iN_MGH_enhancer_targets_DEGs = iN_MGH_enhancer_targets_DEGs) -->
  754. <!-- thresholds <- as.list(rep(0.1, length(enhancer_targets))) -->
  755. <!-- names(thresholds) <- names(enhancer_targets) -->
  756. <!-- protein_coding_option <- "yes" -->
  757. <!-- option <- "all_fdr" -->
  758. <!-- gene_lst_to_remove <- c(all_genes = "XXX") -->
  759. <!-- load("../../MyTools/enrichment_analysis/data/pathway_db/pathway_db.Rdata") -->
  760. <!-- top_enrichment_terms <- run_enrichment(enhancer_targets, thresholds, protein_coding_option, option, gene_lst_to_remove, no = 20, outfolder = outfolder, outplotfolder = file.path(outfolder, "plots")) -->
  761. <!-- saveRDS(top_enrichment_terms, file.path(outfolder, "top_enrichment_terms.rds")) -->
  762. <!-- enrichment_summary(top_enrichment_terms[str_detect(names(top_enrichment_terms), "_DEGs")],input_names = c("iN_GM_enhancer_targets_DEGs","iN_MGH_enhancer_targets_DEGs"), fdr = 0.1, output = file.path(outfolder, "enhancer_DEGs_sig_enrichment_terms.xlsx")) -->
  763. <!-- enrichment_summary(top_enrichment_terms[!str_detect(names(top_enrichment_terms), "_DEGs")],input_names = c("iN_GM_enhancer_targets","iN_MGH_enhancer_targets"), fdr = 0.1, output = file.path(outfolder, "enhaner_genes_sig_enrichment_terms.xlsx")) -->
  764. <!-- ``` -->

tf_binding.Rmd at commit 29381f6, no license · at the source

Overview

Authors: Mariana Moyses-Oliveira1,2,3, Yating Liu1,3,4, Serkan Erdin1,3,4, Dadi Gao1,2, Riya Bhavsar1,3,4, Kiana Mohajeri1,2,3,4,5, Kathryn O’Keefe1, Philip M Boone1,2,4,6, Gabriela Xavier1,2,3, Calwing Liao1,3,4,7, Aiqun Li8,9,10,11,12, Rachita Yadav1,2,3,4, Monica Salani1, Diane Lucente1, Benjamin Currall1, Celine EF de Esch1, Derek JC Tai1,2,3,4, Douglas Ruderfer13,14, Kristen J Brennand8,9,10,11,12,15, James F Gusella1,4,5,16,17, Michael E Talkowski1,2,3,4,5
17 affiliations
  1. Center for Genomic Medicine, Massachusetts General Hospital, Boston, MA, USA
  2. Department of Neurology, Massachusetts General Hospital and Harvard Medical School, Boston, MA, USA
  3. Stanley Center for Psychiatric Research, Broad Institute of MIT and Harvard, Cambridge, MA, USA
  4. Program in Medical and Population Genetics, Broad Institute of MIT and Harvard, Cambridge, MA, USA
  5. Program in Biological and Biomedical Sciences, Harvard Medical School, Boston, MA, USA
  6. Division of Genetics and Genomics, Boston Children’s Hospital, Boston, MA, USA
  7. Analytic and Translational Genetics Unit, Department of Medicine, Massachusetts General Hospital, Boston, MA, USA
  8. Department of Genetics and Genomic Sciences, Icahn School of Medicine at Mount Sinai, New York, NY, USA
  9. Nash Family Department of Neuroscience, Icahn School of Medicine at Mount Sinai, New York, NY, USA
  10. Mount Sinai Center for Transformative Disease Modeling, Icahn School of Medicine at Mount Sinai, New York, NY, USA
  11. Friedman Brain Institute, Icahn School of Medicine at Mount Sinai, New York, NY, USA
  12. Icahn Institute for Data Science and Genomic Technology, Icahn School of Medicine at Mount Sinai, New York, NY, USA
  13. Division of Genetic Medicine, Department of Medicine, Vanderbilt Genetics Institute, Vanderbilt University Medical Center, Medical Center Dr., Nashville, TN 1211, USA
  14. Department of Biomedical Informatics and Department of Psychiatry and Behavioral Sciences, Vanderbilt University Medical Center, Medical Center Dr., Nashville, TN 1211, USA
  15. Department of Psychiatry, Yale University New Haven, New Haven, CT, USA
  16. Department of Genetics, Blavatnik Institute, Harvard Medical School, Boston, MA, USA
  17. Harvard Stem Cell Institute, Harvard University, Cambridge, MA, USA
Institutions: Broad Institute (United States); Massachusetts General Hospital (United States); Stanley Center for Psychiatric Research (United States); Massachusetts Institute of Technology (United States); Harvard University (United States); Boston Children's Hospital (United States); Icahn School of Medicine at Mount Sinai (United States); Vanderbilt University Medical Center (United States); Yale University (United States); Harvard Stem Cell Institute (United States)
Journal: HGG advances, volume 7, issue 4, article 100652
Dates: received 11 March 2026; accepted 9 July 2026; published online 10 July 2026; in print July 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1016/j.xhgg.2026.100652 · PMID 42433021 · PMCID PMC13429924 · OpenAlex W7167903738
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: human (organism), autism (population), cellular / molecular (subfield)
Methods: Statistics, Preprocessing, Evoked potentials, Single-unit activity, calcium imaging, Spectral & time-frequency
Keywords: autism spectrum disorder, neurodevelopment, chromatin regulator, synaptic function, POGZ
Topic: CRISPR and Genetic Engineering (Molecular Biology, Biochemistry, Genetics and Molecular Biology), according to OpenAlex
Funding: NIMH NIH HHS (R01 MH115957, R01 MH123155, RM1 MH132648); National Institutes of Health (R01HD096326, R01MH115957, R01MH123155, U01HG011755, RM1MH132648); Autism Speaks; Simons Foundation Autism Research Initiative (#1009802, #573206); NINDS NIH HHS (K08 NS117891, R00 NS118109); NHGRI NIH HHS (U01 HG011755); Massachusetts General Hospital; NICHD NIH HHS (R01 HD096326)
Citations: not cited yet (Europe PMC); 72 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repositories

Its files are read in the Code ↔ Paper reader above, with 17 matches between paragraphs and lines of code.

Zenodo 3564813

License: CC-BY-4.0
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Size: 3 files
Software Heritage: not checked
Found in: the text, “Web resources”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (10 files), Matplotlib (8 files), pandas (5 files), SAMtools (5 files), SciPy (4 files), BEDTools (3 files), pysam (2 files)
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
147 files

talkowski-lab/POGZ

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 29381f6e1324f375ed9a8a75f09dee9231ab0d85, 22 May 2026
Languages: R (16), Shell (7)
Size: 28 files, 23 scripts
Software Heritage: not archived
Found in: “Data and code availability”
Holds: README, 3 notebooks
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: tidyverse (9 files), DESeq2 (5 files), ggplot2 (5 files), pheatmap (4 files), WGCNA (4 files), ggpubr (2 files), reshape2 (2 files), data.table (1 file), edgeR (1 file), STAR (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
24 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 164 scripts, each with its path and the digest of its content;
  • 17 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1016/j.xhgg.2026.100652.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 21 authors, 5 keywords, 8 funders, 72 references.

Cite

This paper

Moyses-Oliveira, M., Liu, Y., Erdin, S., Gao, D., Bhavsar, R., Mohajeri, K., O’Keefe, K., Boone, P. M., Xavier, G., Liao, C., Li, A., Yadav, R., Salani, M., Lucente, D., Currall, B., de Esch, C. E., Tai, D. J., Ruderfer, D., Brennand, K. J., . . . Talkowski, M. E. (2026). CRISPR-engineered deletion of POGZ alters transcription factor binding at promoters of genes involved in synaptic signaling. HGG advances, 7(4), 100652. https://doi.org/10.1016/j.xhgg.2026.100652

BibTeX

@article{moysesoliveira2026crispr,
author = {Moyses-Oliveira, Mariana and Liu, Yating and Erdin, Serkan and Gao, Dadi and Bhavsar, Riya and Mohajeri, Kiana and O’Keefe, Kathryn and Boone, Philip M and Xavier, Gabriela and Liao, Calwing and Li, Aiqun and Yadav, Rachita and Salani, Monica and Lucente, Diane and Currall, Benjamin and de Esch, Celine EF and Tai, Derek JC and Ruderfer, Douglas and Brennand, Kristen J and Gusella, James F and Talkowski, Michael E},
title = {{CRISPR-engineered deletion of POGZ alters transcription factor binding at promoters of genes involved in synaptic signaling}},
journal = {HGG advances},
year = {2026},
month = jul,
volume = {7},
number = {4},
pages = {100652},
publisher = {Elsevier},
issn = {2666-2477},
doi = {10.1016/j.xhgg.2026.100652},
url = {https://doi.org/10.1016/j.xhgg.2026.100652},
pmid = {42433021},
pmcid = {PMC13429924}
}

RIS

TY - JOUR
AU - Moyses-Oliveira, Mariana
AU - Liu, Yating
AU - Erdin, Serkan
AU - Gao, Dadi
AU - Bhavsar, Riya
AU - Mohajeri, Kiana
AU - O’Keefe, Kathryn
AU - Boone, Philip M
AU - Xavier, Gabriela
AU - Liao, Calwing
AU - Li, Aiqun
AU - Yadav, Rachita
AU - Salani, Monica
AU - Lucente, Diane
AU - Currall, Benjamin
AU - de Esch, Celine EF
AU - Tai, Derek JC
AU - Ruderfer, Douglas
AU - Brennand, Kristen J
AU - Gusella, James F
AU - Talkowski, Michael E
TI - CRISPR-engineered deletion of POGZ alters transcription factor binding at promoters of genes involved in synaptic signaling
T2 - HGG advances
J2 - HGG Adv
PY - 2026
DA - 2026/07/10
VL - 7
IS - 4
SP - 100652
SN - 2666-2477
PB - Elsevier
DO - 10.1016/j.xhgg.2026.100652
UR - https://doi.org/10.1016/j.xhgg.2026.100652
LA - en
ER -

CSL-JSON

{
"id": "10.1016/j.xhgg.2026.100652",
"type": "article-journal",
"title": "CRISPR-engineered deletion of POGZ alters transcription factor binding at promoters of genes involved in synaptic signaling",
"container-title": "HGG advances",
"author": [
{
"family": "Moyses-Oliveira",
"given": "Mariana"
},
{
"family": "Liu",
"given": "Yating"
},
{
"family": "Erdin",
"given": "Serkan"
},
{
"family": "Gao",
"given": "Dadi"
},
{
"family": "Bhavsar",
"given": "Riya"
},
{
"family": "Mohajeri",
"given": "Kiana"
},
{
"family": "O’Keefe",
"given": "Kathryn"
},
{
"family": "Boone",
"given": "Philip M"
},
{
"family": "Xavier",
"given": "Gabriela"
},
{
"family": "Liao",
"given": "Calwing"
},
{
"family": "Li",
"given": "Aiqun"
},
{
"family": "Yadav",
"given": "Rachita"
},
{
"family": "Salani",
"given": "Monica"
},
{
"family": "Lucente",
"given": "Diane"
},
{
"family": "Currall",
"given": "Benjamin"
},
{
"family": "de Esch",
"given": "Celine EF"
},
{
"family": "Tai",
"given": "Derek JC"
},
{
"family": "Ruderfer",
"given": "Douglas"
},
{
"family": "Brennand",
"given": "Kristen J"
},
{
"family": "Gusella",
"given": "James F"
},
{
"family": "Talkowski",
"given": "Michael E"
}
],
"container-title-short": "HGG Adv",
"volume": "7",
"issue": "4",
"page": "100652",
"DOI": "10.1016/j.xhgg.2026.100652",
"PMID": "42433021",
"PMCID": "PMC13429924",
"ISSN": "2666-2477",
"publisher": "Elsevier",
"URL": "https://doi.org/10.1016/j.xhgg.2026.100652",
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
10
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1038/s41586-025-10047-5 [code]
Developmental convergence and divergence in human stem cell models of autism.
Journal: Nature
In common: pysam, WGCNA, edgeR, 8 other tools, autism, 13 references
[2] doi:10.1038/s41467-026-76675-1 [code]
Long-read proteogenomic atlas of human neuronal differentiation reveals isoform diversity informing neurodevelopmental risk mechanisms.
Journal: Nature communications
In common: STAR, pysam, WGCNA, 14 other tools, autism, 4 references
[3] doi:10.1186/s13073-021-00982-z [code]
Combinatorial patterns of gene expression changes contribute to variable expressivity of the developmental delay-associated 16p12.1 deletion.
Journal: Genome medicine
In common: STAR, WGCNA, BEDTools, 8 other tools, autism, 11 references
[4] doi:10.1016/j.xgen.2023.100399 [code]
Multiple genes in a single GWAS risk locus synergistically mediate aberrant synaptic development and function in human neurons.
Journal: Cell genomics
In common: STAR, pysam, edgeR, 12 other tools, cellular / molecular, 8 references
[5] doi:10.1016/j.xgen.2022.100250 [code]
Protein interaction studies in human induced neurons indicate convergent biology underlying autism spectrum disorders.
Journal: Cell genomics
In common: WGCNA, edgeR, SAMtools, 10 other tools, autism, cellular / molecular, 9 references
[6] doi:10.1038/s41467-023-41033-y [code]
Divergent single cell transcriptome and epigenome alterations in ALS and FTD patients with C9orf72 mutation.
Journal: Nature communications
In common: STAR, pysam, BEDTools, 13 other tools, cellular / molecular, 6 references
[7] doi:10.1016/j.isci.2023.106701 [code]
Using brain cell-type-specific protein interactomes to interpret neurodevelopmental genetic signals in schizophrenia.
Journal: iScience
In common: WGCNA, edgeR, SAMtools, 9 other tools, cellular / molecular, 7 references
[8] doi:10.1186/s13073-021-00980-1 [code]
Comprehensive multi-omics integration identifies differentially active enhancers during human brain development with clinical relevance.
Journal: Genome medicine
In common: pysam, BEDTools, edgeR, 11 other tools, 5 references
[9] doi:10.1371/journal.pbio.3002607 [code]
Brain high-throughput multi-omics data reveal molecular heterogeneity in Alzheimer's disease.
Journal: PLoS biology
In common: STAR, pysam, edgeR, 11 other tools, 5 references
[10] doi:10.1038/s41593-025-02050-w [code]
TDP-43 loss induces cryptic polyadenylation in ALS/FTD.
Journal: Nature neuroscience
In common: STAR, pysam, BEDTools, 11 other tools, cellular / molecular, 4 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1016/j.xhgg.2026.100652.svg)](https://openscicode.org/badge/doi/10.1016/j.xhgg.2026.100652)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1016/j.xhgg.2026.100652.svg
   :target: https://openscicode.org/badge/doi/10.1016/j.xhgg.2026.100652
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1016/j.xhgg.2026.100652"><img src="https://openscicode.org/badge/doi/10.1016/j.xhgg.2026.100652.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.