OSCR

Allele-specific chromatin architecture shapes imprinted domains and coordinates a distal enhancer and antisense transcription at the mouse Mest-Copg2 domain.

Code ↔ Paper

8 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.

The 8 matches · 3 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
  1. [1] § Methods › Capture Hi-C analysis ↔ Figure1/BB_CHiC_GRCm39_Figure1.sh, lines 49–89 · score 0.85 · hicup2juicer, SNPsplit, usemid, digested, v0, g2
  2. [2] § Results › Methylation-sensitive CTCF at ICRs shapes allelic architecture ↔ Figure4/BB_CHiC_GRCm39_contactanalysisChromHMM_FIgure4.R, lines 1127–1186 · score 0.61 · Cdkn1c, Kcnq1ot1, imprinted genes, Peg10, Peg3, Snrpn
  3. [3] § Results › Methylation-sensitive CTCF at ICRs shapes allelic architecture ↔ Figure2/BB_CHiC_GRCm39_Figure2.sh, the whole file · a weak match · score 0.60 · sDMRs, gDMRs, Methylated alleles, unmethylated, domain
  4. [4] § Results › Methylation-sensitive CTCF at ICRs shapes allelic architecture ↔ Figure2/BB_CHiC_GRCm39_Figure2.sh, the whole file · a weak match · score 0.54 · sDMRs, gDMRs, Coolpuppy, Density, unmethylated, cortex
  5. [5] § Results › Methylation-sensitive CTCF at ICRs shapes allelic architecture ↔ Figure4/BB_CHiC_GRCm39_contactanalysisChromHMM_FIgure4.R, lines 1348–1395 · score 0.54 · Kcnq1ot1, Peg12, Usp29, Kcnk9, Peg13, Sgce
  6. [6] § Results › Imprinted domains exhibit allele-specific chromatin architectures ↔ Figure4/BB_CHiC_GRCm39_contactanalysisChromHMM_FIgure4.R, lines 1127–1186 · score 0.54 · Kcnq1ot1, Peg12, Usp29, Kcnk9, Peg13, Sgce
  7. [7] § Methods › Capture Hi-C analysis ↔ FigureSupp10/BB_CHiC_GRCm39_FigureSupp10.sh, the whole file · a weak match · score 0.52 · Juicer pre, strain, g2, g1, tool, hic
  8. [8] § Methods › Capture Hi-C analysis ↔ Figure1/BB_CHiC_GRCm39_Figure1.sh, lines 49–89 · score 0.51 · Juicer pre, g2, g1, tool, filtered, hic

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R · 1,400 lines · 53 KB · no license · 3 matches

  1. library(dplyr)
  2. library(ggplot2)
  3. library(scales)
  4. library(tidyverse)
  5. library(valr)
  6. library(palr)
  7. library(GenomicRanges)
  8. #personalized theme
  9. my_theme = theme(
  10. text = element_text(size = 10),
  11. axis.title.x = element_text(size = 12),
  12. axis.title.y = element_text(size = 12),
  13. axis.text = element_text(size = 10, colour = 'black'),
  14. axis.text.x = element_text(vjust = 0.5, size = 10, angle=90),
  15. legend.title=element_text(size=0),
  16. legend.text=element_text(size=12),
  17. legend.position = "top",
  18. #legend.position = "none",
  19. plot.title = element_text(lineheight=.8, face="bold", size = 16),
  20. panel.border = element_blank(),
  21. panel.background = element_rect(fill = 'white'),
  22. panel.grid.minor = element_blank(),
  23. panel.grid.major = element_blank(),
  24. axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
  25. axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'))
  26. #==============================
  27. func.paircounts.mat <- function(viewpoint) {
  28. #mat positive region
  29. mat_chr_pos <- mat_chr_reg %>%
  30. filter(mat_chr_reg$V3 > viewpoint-2500 & mat_chr_reg$V3 < viewpoint+2500)
  31. #mat negative region
  32. mat_chr_neg <- mat_chr_reg %>%
  33. filter(mat_chr_reg$V5 > viewpoint-2500 & mat_chr_reg$V5 < viewpoint+2500)
  34. #mat merge both regions
  35. mat_chr_pos2 <- as.data.frame(mat_chr_pos$V1)
  36. mat_chr_pos2$V2 <- mat_chr_pos$V5
  37. colnames(mat_chr_pos2) <- c("V1","V2")
  38. mat_chr_neg2 <- as.data.frame(mat_chr_neg$V1)
  39. mat_chr_neg2$V2 <- mat_chr_neg$V3
  40. colnames(mat_chr_neg2) <- c("V1","V2")
  41. mat_chr_plot <- rbind(mat_chr_neg2,mat_chr_pos2)
  42. mat_chr_plot$chr <- chrnumb
  43. mat_chr_plot$allele <- "mat"
  44. #remove proximal contacts
  45. mat_chr_plot <- mat_chr_plot %>% filter(V2 < viewpoint-50000 | V2 > viewpoint+50000)
  46. return(mat_chr_plot)
  47. }
  48. func.paircounts.pat <- function(viewpoint) {
  49. #pat positive region
  50. pat_chr_pos <- pat_chr_reg %>%
  51. filter(pat_chr_reg$V3 > viewpoint-2500 & pat_chr_reg$V3 < viewpoint+2500)
  52. #pat negative region
  53. pat_chr_neg <- pat_chr_reg %>%
  54. filter(pat_chr_reg$V5 > viewpoint-2500 & pat_chr_reg$V5 < viewpoint+2500)
  55. #pat merge both regions
  56. pat_chr_pos2 <- as.data.frame(pat_chr_pos$V1)
  57. pat_chr_pos2$V2 <- pat_chr_pos$V5
  58. colnames(pat_chr_pos2) <- c("V1","V2")
  59. pat_chr_neg2 <- as.data.frame(pat_chr_neg$V1)
  60. pat_chr_neg2$V2 <- pat_chr_neg$V3
  61. colnames(pat_chr_neg2) <- c("V1","V2")
  62. pat_chr_plot <- rbind(pat_chr_neg2,pat_chr_pos2)
  63. pat_chr_plot$chr <- chrnumb
  64. pat_chr_plot$allele <- "pat"
  65. #remove proximal contacts
  66. pat_chr_plot <- pat_chr_plot %>% filter(V2 < viewpoint-50000 | V2 > viewpoint+50000)
  67. return(pat_chr_plot)
  68. }
  69. #==============================
  70. func.activebed <- function(active) {
  71. #contacts from active TSS
  72. bed1 <- as.data.frame(active$chr)
  73. bed1 <- cbind(bed1, active$start)
  74. bed1 <- cbind(bed1, active$V2)
  75. bed1 <- cbind(bed1, active$V1)
  76. colnames(bed1) <- c("chrom","start","end","name")
  77. bed1$chrom <- sub("^", "chr", bed1$chrom)
  78. return(bed1)
  79. }
  80. func.inactivebed <- function(inactive) {
  81. #contacts from inactive TSS
  82. bed2 <- as.data.frame(inactive$chr)
  83. bed2 <- cbind(bed2, inactive$start)
  84. bed2 <- cbind(bed2, inactive$V2)
  85. bed2 <- cbind(bed2, inactive$V1)
  86. colnames(bed2) <- c("chrom","start","end","name")
  87. bed2$chrom <- sub("^", "chr", bed2$chrom)
  88. return(bed2)
  89. }
  90. func.biallele1bed <- function(biallele1) {
  91. #contacts from biallelic TSS
  92. bed3 <- as.data.frame(biallele1$chr)
  93. bed3 <- cbind(bed3, biallele1$start)
  94. bed3 <- cbind(bed3, biallele1$V2)
  95. bed3 <- cbind(bed3, biallele1$V1)
  96. colnames(bed3) <- c("chrom","start","end","name")
  97. bed3$chrom <- sub("^", "chr", bed3$chrom)
  98. return(bed3)
  99. }
  100. func.biallele2bed <- function(biallele2) {
  101. #contacts from biallelic TSS
  102. bed4 <- as.data.frame(biallele2$chr)
  103. bed4 <- cbind(bed4, biallele2$start)
  104. bed4 <- cbind(bed4, biallele2$V2)
  105. bed4 <- cbind(bed4, biallele2$V1)
  106. colnames(bed4) <- c("chrom","start","end","name")
  107. bed4$chrom <- sub("^", "chr", bed4$chrom)
  108. return(bed4)
  109. }
  110. #==============================
  111. cumm.biallele1bed <- NULL
  112. cumm.biallele2bed <- NULL
  113. #==============================
  114. ## this script may not be very straightforward
  115. ## basically, you are grabbing contact information from each expressed gene allele and grouping them according to their expression pattern
  116. ## note: total contact numbers in medium files are normalized to equalize mat and pat numbers
  117. #==============================
  118. #===Region1 file analysis
  119. mat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Mat_prejuicer_Q30_reg1.medium", header = FALSE, sep = '\t')
  120. mat_chr_reg <- mat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  121. colnames(mat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  122. pat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Pat_prejuicer_Q30_reg1.medium", header = FALSE, sep = '\t')
  123. pat_chr_reg <- pat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  124. colnames(pat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  125. #==============================
  126. #Sgce pat TSS
  127. gene <- "Sgce"
  128. viewpoint <- 4747180
  129. chrnumb <- 6
  130. exp <- "pat"
  131. noexp <- "mat"
  132. #counting all the contacts from the viewpoint 5kb bin
  133. mat_chr_plot <- func.paircounts.mat(viewpoint)
  134. pat_chr_plot <- func.paircounts.pat(viewpoint)
  135. #which allele is transcriptionally active?
  136. if (exp == "pat"){
  137. active <- pat_chr_plot
  138. inactive <- mat_chr_plot
  139. } else if (exp == "mat"){
  140. active <- mat_chr_plot
  141. inactive <- pat_chr_plot
  142. }
  143. #add viewpoint
  144. active$start <- viewpoint
  145. inactive$start <- viewpoint
  146. #generating bed
  147. activebed <- func.activebed(active)
  148. inactivebed <- func.inactivebed(inactive)
  149. activebed$IG <- gene
  150. inactivebed$IG <- gene
  151. #cummulative
  152. cumm.activebed <- activebed
  153. cumm.inactivebed <- inactivebed
  154. #==============================
  155. #Peg10 pat TSS
  156. gene <- "Peg10"
  157. viewpoint <- 4747306
  158. chrnumb <- 6
  159. exp <- "pat"
  160. noexp <- "mat"
  161. #counting all the contacts from the viewpoint 5kb bin
  162. mat_chr_plot <- func.paircounts.mat(viewpoint)
  163. pat_chr_plot <- func.paircounts.pat(viewpoint)
  164. #which allele is transcriptionally active?
  165. if (exp == "pat"){
  166. active <- pat_chr_plot
  167. inactive <- mat_chr_plot
  168. } else if (exp == "mat"){
  169. active <- mat_chr_plot
  170. inactive <- pat_chr_plot
  171. }
  172. #add viewpoint
  173. active$start <- viewpoint
  174. inactive$start <- viewpoint
  175. #generating bed
  176. activebed <- func.activebed(active)
  177. inactivebed <- func.inactivebed(inactive)
  178. activebed$IG <- gene
  179. inactivebed$IG <- gene
  180. #cummulative
  181. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  182. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  183. #==============================
  184. biallelicbed <- read.table("Features/EXP022_CN_BiallelicRNAseq_capture.bed", header=FALSE, sep="\t", stringsAsFactors=FALSE)
  185. filter_gr <- GRanges(seqnames=6, ranges=IRanges(start=3330467 + 1, end=8138330))
  186. query_gr <- GRanges(seqnames=biallelicbed[[1]],
  187. ranges=IRanges(start=biallelicbed[[2]] + 1, end=biallelicbed[[3]]))
  188. hits <- findOverlaps(query_gr, filter_gr, type = "within")
  189. filtered_query <- biallelicbed[queryHits(hits), ]
  190. biallelicregion <- filtered_query
  191. biallelicregion$viewpoint[biallelicregion$V6 == "-"] <- biallelicregion$V3[biallelicregion$V6 == "-"]
  192. biallelicregion$viewpoint[biallelicregion$V6 == "+"] <- biallelicregion$V2[biallelicregion$V6 == "+"]
  193. biallelicregion <- biallelicregion[,c("V4","V1","viewpoint")]
  194. colnames(biallelicregion) <- c("gene","chrnumb","viewpoint")
  195. i=1
  196. for (i in seq_len(nrow(biallelicregion))) {
  197. gene <- biallelicregion$gene[i]
  198. viewpoint <- biallelicregion$viewpoint[i]
  199. chrnumb <- biallelicregion$chrnumb[i]
  200. exp <- "bi"
  201. mat_chr_plot <- func.paircounts.mat(viewpoint)
  202. pat_chr_plot <- func.paircounts.pat(viewpoint)
  203. if (exp == "bi"){
  204. biallele1 <- pat_chr_plot
  205. biallele2 <- mat_chr_plot
  206. }
  207. biallele1$start <- viewpoint
  208. biallele2$start <- viewpoint
  209. biallele1bed <- func.biallele1bed(biallele1)
  210. biallele2bed <- func.biallele2bed(biallele2)
  211. biallele1bed$IG <- gene
  212. biallele2bed$IG <- gene
  213. cumm.biallele1bed <- rbind(unique(cumm.biallele1bed),biallele1bed)
  214. cumm.biallele2bed <- rbind(unique(cumm.biallele2bed),biallele2bed)
  215. }
  216. #==============================
  217. #==============================
  218. #===Region2 file analysis
  219. mat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Mat_prejuicer_Q30_reg2.medium", header = FALSE, sep = '\t')
  220. mat_chr_reg <- mat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  221. colnames(mat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  222. pat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Pat_prejuicer_Q30_reg2.medium", header = FALSE, sep = '\t')
  223. pat_chr_reg <- pat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  224. colnames(pat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  225. #==============================
  226. #Mest pat TSS
  227. gene <- "Mest"
  228. viewpoint <- 30737996
  229. chrnumb <- 6
  230. exp <- "pat"
  231. noexp <- "mat"
  232. #counting all the contacts from the viewpoint 5kb bin
  233. mat_chr_plot <- func.paircounts.mat(viewpoint)
  234. pat_chr_plot <- func.paircounts.pat(viewpoint)
  235. #which allele is transcriptionally active?
  236. if (exp == "pat"){
  237. active <- pat_chr_plot
  238. inactive <- mat_chr_plot
  239. } else if (exp == "mat"){
  240. active <- mat_chr_plot
  241. inactive <- pat_chr_plot
  242. }
  243. #add viewpoint
  244. active$start <- viewpoint
  245. inactive$start <- viewpoint
  246. #generating bed
  247. activebed <- func.activebed(active)
  248. inactivebed <- func.inactivebed(inactive)
  249. activebed$IG <- gene
  250. inactivebed$IG <- gene
  251. #cummulative
  252. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  253. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  254. #==============================
  255. #Copg2 TSS
  256. gene <- "Copg2"
  257. viewpoint <- 30873712
  258. chrnumb <- 6
  259. exp <- "mat"
  260. noexp <- "pat"
  261. #counting all the contacts from the viewpoint 5kb bin
  262. mat_chr_plot <- func.paircounts.mat(viewpoint)
  263. pat_chr_plot <- func.paircounts.pat(viewpoint)
  264. #which allele is transcriptionally active?
  265. if (exp == "pat"){
  266. active <- pat_chr_plot
  267. inactive <- mat_chr_plot
  268. } else if (exp == "mat"){
  269. active <- mat_chr_plot
  270. inactive <- pat_chr_plot
  271. }
  272. #add viewpoint
  273. active$start <- viewpoint
  274. inactive$start <- viewpoint
  275. #generating bed
  276. activebed <- func.activebed(active)
  277. inactivebed <- func.inactivebed(inactive)
  278. activebed$IG <- gene
  279. inactivebed$IG <- gene
  280. #cummulative
  281. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  282. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  283. #==============================
  284. biallelicbed <- read.table("Features/EXP022_CN_BiallelicRNAseq_capture.bed", header=FALSE, sep="\t", stringsAsFactors=FALSE)
  285. filter_gr <- GRanges(seqnames=6, ranges=IRanges(start=30068177+1, end=31232042))
  286. query_gr <- GRanges(seqnames=biallelicbed[[1]],
  287. ranges=IRanges(start=biallelicbed[[2]] + 1, end=biallelicbed[[3]]))
  288. hits <- findOverlaps(query_gr, filter_gr, type = "within")
  289. filtered_query <- biallelicbed[queryHits(hits), ]
  290. biallelicregion <- filtered_query
  291. biallelicregion$viewpoint[biallelicregion$V6 == "-"] <- biallelicregion$V3[biallelicregion$V6 == "-"]
  292. biallelicregion$viewpoint[biallelicregion$V6 == "+"] <- biallelicregion$V2[biallelicregion$V6 == "+"]
  293. biallelicregion <- biallelicregion[,c("V4","V1","viewpoint")]
  294. colnames(biallelicregion) <- c("gene","chrnumb","viewpoint")
  295. i=1
  296. for (i in seq_len(nrow(biallelicregion))) {
  297. gene <- biallelicregion$gene[i]
  298. viewpoint <- biallelicregion$viewpoint[i]
  299. chrnumb <- biallelicregion$chrnumb[i]
  300. exp <- "bi"
  301. mat_chr_plot <- func.paircounts.mat(viewpoint)
  302. pat_chr_plot <- func.paircounts.pat(viewpoint)
  303. if (exp == "bi"){
  304. biallele1 <- pat_chr_plot
  305. biallele2 <- mat_chr_plot
  306. }
  307. biallele1$start <- viewpoint
  308. biallele2$start <- viewpoint
  309. biallele1bed <- func.biallele1bed(biallele1)
  310. biallele2bed <- func.biallele2bed(biallele2)
  311. biallele1bed$IG <- gene
  312. biallele2bed$IG <- gene
  313. cumm.biallele1bed <- rbind(unique(cumm.biallele1bed),biallele1bed)
  314. cumm.biallele2bed <- rbind(unique(cumm.biallele2bed),biallele2bed)
  315. }
  316. #==============================
  317. #==============================
  318. #===Region3 pairs file analysis
  319. mat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Mat_prejuicer_Q30_reg3.medium", header = FALSE, sep = '\t')
  320. mat_chr_reg <- mat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  321. colnames(mat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  322. pat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Pat_prejuicer_Q30_reg3.medium", header = FALSE, sep = '\t')
  323. pat_chr_reg <- pat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  324. colnames(pat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  325. #==============================
  326. #==============================
  327. #Peg3 TSS
  328. gene <- "Peg3"
  329. viewpoint <- 6733443
  330. chrnumb <- 7
  331. exp <- "pat"
  332. noexp <- "mat"
  333. #counting all the contacts from the viewpoint 5kb bin
  334. mat_chr_plot <- func.paircounts.mat(viewpoint)
  335. pat_chr_plot <- func.paircounts.pat(viewpoint)
  336. #which allele is transcriptionally active?
  337. if (exp == "pat"){
  338. active <- pat_chr_plot
  339. inactive <- mat_chr_plot
  340. } else if (exp == "mat"){
  341. active <- mat_chr_plot
  342. inactive <- pat_chr_plot
  343. }
  344. #add viewpoint
  345. active$start <- viewpoint
  346. inactive$start <- viewpoint
  347. #generating bed
  348. activebed <- func.activebed(active)
  349. inactivebed <- func.inactivebed(inactive)
  350. activebed$IG <- gene
  351. inactivebed$IG <- gene
  352. #cummulative
  353. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  354. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  355. #==============================
  356. #Usp29 TSS
  357. gene <- "Usp29"
  358. viewpoint <- 6733560
  359. chrnumb <- 7
  360. exp <- "pat"
  361. noexp <- "mat"
  362. #counting all the contacts from the viewpoint 5kb bin
  363. mat_chr_plot <- func.paircounts.mat(viewpoint)
  364. pat_chr_plot <- func.paircounts.pat(viewpoint)
  365. #which allele is transcriptionally active?
  366. if (exp == "pat"){
  367. active <- pat_chr_plot
  368. inactive <- mat_chr_plot
  369. } else if (exp == "mat"){
  370. active <- mat_chr_plot
  371. inactive <- pat_chr_plot
  372. }
  373. #add viewpoint
  374. active$start <- viewpoint
  375. inactive$start <- viewpoint
  376. #generating bed
  377. activebed <- func.activebed(active)
  378. inactivebed <- func.inactivebed(inactive)
  379. activebed$IG <- gene
  380. inactivebed$IG <- gene
  381. #cummulative
  382. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  383. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  384. #==============================
  385. biallelicbed <- read.table("Features/EXP022_CN_BiallelicRNAseq_capture.bed", header=FALSE, sep="\t", stringsAsFactors=FALSE)
  386. filter_gr <- GRanges(seqnames=7, ranges=IRanges(start=6118501 + 1, end=7334692))
  387. query_gr <- GRanges(seqnames=biallelicbed[[1]],
  388. ranges=IRanges(start=biallelicbed[[2]] + 1, end=biallelicbed[[3]]))
  389. hits <- findOverlaps(query_gr, filter_gr, type = "within")
  390. filtered_query <- biallelicbed[queryHits(hits), ]
  391. biallelicregion <- filtered_query
  392. biallelicregion$viewpoint[biallelicregion$V6 == "-"] <- biallelicregion$V3[biallelicregion$V6 == "-"]
  393. biallelicregion$viewpoint[biallelicregion$V6 == "+"] <- biallelicregion$V2[biallelicregion$V6 == "+"]
  394. biallelicregion <- biallelicregion[,c("V4","V1","viewpoint")]
  395. colnames(biallelicregion) <- c("gene","chrnumb","viewpoint")
  396. i=1
  397. for (i in seq_len(nrow(biallelicregion))) {
  398. gene <- biallelicregion$gene[i]
  399. viewpoint <- biallelicregion$viewpoint[i]
  400. chrnumb <- biallelicregion$chrnumb[i]
  401. exp <- "bi"
  402. mat_chr_plot <- func.paircounts.mat(viewpoint)
  403. pat_chr_plot <- func.paircounts.pat(viewpoint)
  404. if (exp == "bi"){
  405. biallele1 <- pat_chr_plot
  406. biallele2 <- mat_chr_plot
  407. }
  408. biallele1$start <- viewpoint
  409. biallele2$start <- viewpoint
  410. biallele1bed <- func.biallele1bed(biallele1)
  411. biallele2bed <- func.biallele2bed(biallele2)
  412. biallele1bed$IG <- gene
  413. biallele2bed$IG <- gene
  414. cumm.biallele1bed <- rbind(unique(cumm.biallele1bed),biallele1bed)
  415. cumm.biallele2bed <- rbind(unique(cumm.biallele2bed),biallele2bed)
  416. }
  417. #==============================
  418. #==============================
  419. #===Region4 file analysis
  420. mat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Mat_prejuicer_Q30_reg4.medium", header = FALSE, sep = '\t')
  421. mat_chr_reg <- mat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  422. colnames(mat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  423. pat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Pat_prejuicer_Q30_reg4.medium", header = FALSE, sep = '\t')
  424. pat_chr_reg <- pat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  425. colnames(pat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  426. #==============================
  427. #==============================
  428. #Ube3a TSS
  429. gene <- "Ube3a"
  430. viewpoint <- 58878498
  431. chrnumb <- 7
  432. exp <- "mat"
  433. noexp <- "pat"
  434. #counting all the contacts from the viewpoint 5kb bin
  435. mat_chr_plot <- func.paircounts.mat(viewpoint)
  436. pat_chr_plot <- func.paircounts.pat(viewpoint)
  437. #which allele is transcriptionally active?
  438. if (exp == "pat"){
  439. active <- pat_chr_plot
  440. inactive <- mat_chr_plot
  441. } else if (exp == "mat"){
  442. active <- mat_chr_plot
  443. inactive <- pat_chr_plot
  444. }
  445. #add viewpoint
  446. active$start <- viewpoint
  447. inactive$start <- viewpoint
  448. #generating bed
  449. activebed <- func.activebed(active)
  450. inactivebed <- func.inactivebed(inactive)
  451. activebed$IG <- gene
  452. inactivebed$IG <- gene
  453. #cummulative
  454. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  455. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  456. #==============================
  457. #Snrpn TSS
  458. gene <- "Snrpn"
  459. viewpoint <- 59789967
  460. chrnumb <- 7
  461. exp <- "pat"
  462. noexp <- "mat"
  463. #counting all the contacts from the viewpoint 5kb bin
  464. mat_chr_plot <- func.paircounts.mat(viewpoint)
  465. pat_chr_plot <- func.paircounts.pat(viewpoint)
  466. #which allele is transcriptionally active?
  467. if (exp == "pat"){
  468. active <- pat_chr_plot
  469. inactive <- mat_chr_plot
  470. } else if (exp == "mat"){
  471. active <- mat_chr_plot
  472. inactive <- pat_chr_plot
  473. }
  474. #add viewpoint
  475. active$start <- viewpoint
  476. inactive$start <- viewpoint
  477. #generating bed
  478. activebed <- func.activebed(active)
  479. inactivebed <- func.inactivebed(inactive)
  480. activebed$IG <- gene
  481. inactivebed$IG <- gene
  482. #cummulative
  483. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  484. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  485. #==============================
  486. #A230006K03Rik TSS
  487. gene <- "A230006K03Rik"
  488. viewpoint <- 60961397
  489. chrnumb <- 7
  490. exp <- "pat"
  491. noexp <- "mat"
  492. #counting all the contacts from the viewpoint 5kb bin
  493. mat_chr_plot <- func.paircounts.mat(viewpoint)
  494. pat_chr_plot <- func.paircounts.pat(viewpoint)
  495. #which allele is transcriptionally active?
  496. if (exp == "pat"){
  497. active <- pat_chr_plot
  498. inactive <- mat_chr_plot
  499. } else if (exp == "mat"){
  500. active <- mat_chr_plot
  501. inactive <- pat_chr_plot
  502. }
  503. #add viewpoint
  504. active$start <- viewpoint
  505. inactive$start <- viewpoint
  506. #generating bed
  507. activebed <- func.activebed(active)
  508. inactivebed <- func.inactivebed(inactive)
  509. activebed$IG <- gene
  510. inactivebed$IG <- gene
  511. #cummulative
  512. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  513. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  514. #==============================
  515. #B230209E15Rik TSS
  516. gene <- "B230209E15Rik"
  517. viewpoint <- 61265075
  518. chrnumb <- 7
  519. exp <- "pat"
  520. noexp <- "mat"
  521. #counting all the contacts from the viewpoint 5kb bin
  522. mat_chr_plot <- func.paircounts.mat(viewpoint)
  523. pat_chr_plot <- func.paircounts.pat(viewpoint)
  524. #which allele is transcriptionally active?
  525. if (exp == "pat"){
  526. active <- pat_chr_plot
  527. inactive <- mat_chr_plot
  528. } else if (exp == "mat"){
  529. active <- mat_chr_plot
  530. inactive <- pat_chr_plot
  531. }
  532. #add viewpoint
  533. active$start <- viewpoint
  534. inactive$start <- viewpoint
  535. #generating bed
  536. activebed <- func.activebed(active)
  537. inactivebed <- func.inactivebed(inactive)
  538. activebed$IG <- gene
  539. inactivebed$IG <- gene
  540. #cummulative
  541. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  542. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  543. #==============================
  544. #A330076H08Rik TSS
  545. gene <- "A330076H08Rik"
  546. viewpoint <- 61632103
  547. chrnumb <- 7
  548. exp <- "pat"
  549. noexp <- "mat"
  550. #counting all the contacts from the viewpoint 5kb bin
  551. mat_chr_plot <- func.paircounts.mat(viewpoint)
  552. pat_chr_plot <- func.paircounts.pat(viewpoint)
  553. #which allele is transcriptionally active?
  554. if (exp == "pat"){
  555. active <- pat_chr_plot
  556. inactive <- mat_chr_plot
  557. } else if (exp == "mat"){
  558. active <- mat_chr_plot
  559. inactive <- pat_chr_plot
  560. }
  561. #add viewpoint
  562. active$start <- viewpoint
  563. inactive$start <- viewpoint
  564. #generating bed
  565. activebed <- func.activebed(active)
  566. inactivebed <- func.inactivebed(inactive)
  567. activebed$IG <- gene
  568. inactivebed$IG <- gene
  569. #cummulative
  570. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  571. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  572. #==============================
  573. #Ndn TSS
  574. gene <- "Ndn"
  575. viewpoint <- 61998025
  576. chrnumb <- 7
  577. exp <- "pat"
  578. noexp <- "mat"
  579. #counting all the contacts from the viewpoint 5kb bin
  580. mat_chr_plot <- func.paircounts.mat(viewpoint)
  581. pat_chr_plot <- func.paircounts.pat(viewpoint)
  582. #which allele is transcriptionally active?
  583. if (exp == "pat"){
  584. active <- pat_chr_plot
  585. inactive <- mat_chr_plot
  586. } else if (exp == "mat"){
  587. active <- mat_chr_plot
  588. inactive <- pat_chr_plot
  589. }
  590. #add viewpoint
  591. active$start <- viewpoint
  592. inactive$start <- viewpoint
  593. #generating bed
  594. activebed <- func.activebed(active)
  595. inactivebed <- func.inactivebed(inactive)
  596. activebed$IG <- gene
  597. inactivebed$IG <- gene
  598. #cummulative
  599. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  600. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  601. #==============================
  602. #Magel2 TSS
  603. gene <- "Magel2"
  604. viewpoint <- 62026727
  605. chrnumb <- 7
  606. exp <- "pat"
  607. noexp <- "mat"
  608. #counting all the contacts from the viewpoint 5kb bin
  609. mat_chr_plot <- func.paircounts.mat(viewpoint)
  610. pat_chr_plot <- func.paircounts.pat(viewpoint)
  611. #which allele is transcriptionally active?
  612. if (exp == "pat"){
  613. active <- pat_chr_plot
  614. inactive <- mat_chr_plot
  615. } else if (exp == "mat"){
  616. active <- mat_chr_plot
  617. inactive <- pat_chr_plot
  618. }
  619. #add viewpoint
  620. active$start <- viewpoint
  621. inactive$start <- viewpoint
  622. #generating bed
  623. activebed <- func.activebed(active)
  624. inactivebed <- func.inactivebed(inactive)
  625. activebed$IG <- gene
  626. inactivebed$IG <- gene
  627. #cummulative
  628. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  629. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  630. #==============================
  631. #Mkrn3 TSS
  632. gene <- "Mkrn3"
  633. viewpoint <- 62069901
  634. chrnumb <- 7
  635. exp <- "pat"
  636. noexp <- "mat"
  637. #counting all the contacts from the viewpoint 5kb bin
  638. mat_chr_plot <- func.paircounts.mat(viewpoint)
  639. pat_chr_plot <- func.paircounts.pat(viewpoint)
  640. #which allele is transcriptionally active?
  641. if (exp == "pat"){
  642. active <- pat_chr_plot
  643. inactive <- mat_chr_plot
  644. } else if (exp == "mat"){
  645. active <- mat_chr_plot
  646. inactive <- pat_chr_plot
  647. }
  648. #add viewpoint
  649. active$start <- viewpoint
  650. inactive$start <- viewpoint
  651. #generating bed
  652. activebed <- func.activebed(active)
  653. inactivebed <- func.inactivebed(inactive)
  654. activebed$IG <- gene
  655. inactivebed$IG <- gene
  656. #cummulative
  657. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  658. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  659. #==============================
  660. #Peg12 TSS
  661. gene <- "Peg12"
  662. viewpoint <- 62114258
  663. chrnumb <- 7
  664. exp <- "pat"
  665. noexp <- "mat"
  666. #counting all the contacts from the viewpoint 5kb bin
  667. mat_chr_plot <- func.paircounts.mat(viewpoint)
  668. pat_chr_plot <- func.paircounts.pat(viewpoint)
  669. #which allele is transcriptionally active?
  670. if (exp == "pat"){
  671. active <- pat_chr_plot
  672. inactive <- mat_chr_plot
  673. } else if (exp == "mat"){
  674. active <- mat_chr_plot
  675. inactive <- pat_chr_plot
  676. }
  677. #add viewpoint
  678. active$start <- viewpoint
  679. inactive$start <- viewpoint
  680. #generating bed
  681. activebed <- func.activebed(active)
  682. inactivebed <- func.inactivebed(inactive)
  683. activebed$IG <- gene
  684. inactivebed$IG <- gene
  685. #cummulative
  686. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  687. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  688. #==============================
  689. biallelicbed <- read.table("Features/EXP022_CN_BiallelicRNAseq_capture.bed", header=FALSE, sep="\t", stringsAsFactors=FALSE)
  690. filter_gr <- GRanges(seqnames=7, ranges=IRanges(start=55345629 + 1, end=62207321))
  691. query_gr <- GRanges(seqnames=biallelicbed[[1]],
  692. ranges=IRanges(start=biallelicbed[[2]] + 1, end=biallelicbed[[3]]))
  693. hits <- findOverlaps(query_gr, filter_gr, type = "within")
  694. filtered_query <- biallelicbed[queryHits(hits), ]
  695. biallelicregion <- filtered_query
  696. biallelicregion$viewpoint[biallelicregion$V6 == "-"] <- biallelicregion$V3[biallelicregion$V6 == "-"]
  697. biallelicregion$viewpoint[biallelicregion$V6 == "+"] <- biallelicregion$V2[biallelicregion$V6 == "+"]
  698. biallelicregion <- biallelicregion[,c("V4","V1","viewpoint")]
  699. colnames(biallelicregion) <- c("gene","chrnumb","viewpoint")
  700. i=1
  701. for (i in seq_len(nrow(biallelicregion))) {
  702. gene <- biallelicregion$gene[i]
  703. viewpoint <- biallelicregion$viewpoint[i]
  704. chrnumb <- biallelicregion$chrnumb[i]
  705. exp <- "bi"
  706. mat_chr_plot <- func.paircounts.mat(viewpoint)
  707. pat_chr_plot <- func.paircounts.pat(viewpoint)
  708. if (exp == "bi"){
  709. biallele1 <- pat_chr_plot
  710. biallele2 <- mat_chr_plot
  711. }
  712. biallele1$start <- viewpoint
  713. biallele2$start <- viewpoint
  714. biallele1bed <- func.biallele1bed(biallele1)
  715. biallele2bed <- func.biallele2bed(biallele2)
  716. biallele1bed$IG <- gene
  717. biallele2bed$IG <- gene
  718. cumm.biallele1bed <- rbind(unique(cumm.biallele1bed),biallele1bed)
  719. cumm.biallele2bed <- rbind(unique(cumm.biallele2bed),biallele2bed)
  720. }
  721. #==============================
  722. #==============================
  723. #===Region5 file analysis
  724. mat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Mat_prejuicer_Q30_reg5a.medium", header = FALSE, sep = '\t')
  725. mat_chr_reg <- mat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  726. colnames(mat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  727. pat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Pat_prejuicer_Q30_reg5a.medium", header = FALSE, sep = '\t')
  728. pat_chr_reg <- pat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  729. colnames(pat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  730. #==============================
  731. #H19 TSS not expressed in neurons
  732. #==============================
  733. #Igf2 TSS not expressed in neurons
  734. #==============================
  735. biallelicbed <- read.table("Features/EXP022_CN_BiallelicRNAseq_capture.bed", header=FALSE, sep="\t", stringsAsFactors=FALSE)
  736. filter_gr <- GRanges(seqnames=7, ranges=IRanges(start=141663846 + 1, end=142264758))
  737. query_gr <- GRanges(seqnames=biallelicbed[[1]],
  738. ranges=IRanges(start=biallelicbed[[2]] + 1, end=biallelicbed[[3]]))
  739. hits <- findOverlaps(query_gr, filter_gr, type = "within")
  740. filtered_query <- biallelicbed[queryHits(hits), ]
  741. biallelicregion <- filtered_query
  742. biallelicregion$viewpoint[biallelicregion$V6 == "-"] <- biallelicregion$V3[biallelicregion$V6 == "-"]
  743. biallelicregion$viewpoint[biallelicregion$V6 == "+"] <- biallelicregion$V2[biallelicregion$V6 == "+"]
  744. biallelicregion <- biallelicregion[,c("V4","V1","viewpoint")]
  745. colnames(biallelicregion) <- c("gene","chrnumb","viewpoint")
  746. i=1
  747. for (i in seq_len(nrow(biallelicregion))) {
  748. gene <- biallelicregion$gene[i]
  749. viewpoint <- biallelicregion$viewpoint[i]
  750. chrnumb <- biallelicregion$chrnumb[i]
  751. exp <- "bi"
  752. mat_chr_plot <- func.paircounts.mat(viewpoint)
  753. pat_chr_plot <- func.paircounts.pat(viewpoint)
  754. if (exp == "bi"){
  755. biallele1 <- pat_chr_plot
  756. biallele2 <- mat_chr_plot
  757. }
  758. biallele1$start <- viewpoint
  759. biallele2$start <- viewpoint
  760. biallele1bed <- func.biallele1bed(biallele1)
  761. biallele2bed <- func.biallele2bed(biallele2)
  762. biallele1bed$IG <- gene
  763. biallele2bed$IG <- gene
  764. cumm.biallele1bed <- rbind(unique(cumm.biallele1bed),biallele1bed)
  765. cumm.biallele2bed <- rbind(unique(cumm.biallele2bed),biallele2bed)
  766. }
  767. #==============================
  768. #===Region5-2
  769. mat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Mat_prejuicer_Q30_reg5b.medium", header = FALSE, sep = '\t')
  770. mat_chr_reg <- mat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  771. colnames(mat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  772. pat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Pat_prejuicer_Q30_reg5b.medium", header = FALSE, sep = '\t')
  773. pat_chr_reg <- pat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  774. colnames(pat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  775. #=============================
  776. #Kcnq1ot1 TSS
  777. gene <- "Kcnq1ot1"
  778. viewpoint <- 142850286
  779. chrnumb <- 7
  780. exp <- "pat"
  781. noexp <- "mat"
  782. #counting all the contacts from the viewpoint 5kb bin
  783. mat_chr_plot <- func.paircounts.mat(viewpoint)
  784. pat_chr_plot <- func.paircounts.pat(viewpoint)
  785. #which allele is transcriptionally active?
  786. if (exp == "pat"){
  787. active <- pat_chr_plot
  788. inactive <- mat_chr_plot
  789. } else if (exp == "mat"){
  790. active <- mat_chr_plot
  791. inactive <- pat_chr_plot
  792. }
  793. #add viewpoint
  794. active$start <- viewpoint
  795. inactive$start <- viewpoint
  796. #generating bed
  797. activebed <- func.activebed(active)
  798. inactivebed <- func.inactivebed(inactive)
  799. activebed$IG <- gene
  800. inactivebed$IG <- gene
  801. #cummulative
  802. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  803. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  804. #=============================
  805. #Cdkn1c TSS
  806. gene <- "Cdkn1c"
  807. viewpoint <- 143014735
  808. chrnumb <- 7
  809. exp <- "mat"
  810. noexp <- "pat"
  811. #counting all the contacts from the viewpoint 5kb bin
  812. mat_chr_plot <- func.paircounts.mat(viewpoint)
  813. pat_chr_plot <- func.paircounts.pat(viewpoint)
  814. #which allele is transcriptionally active?
  815. if (exp == "pat"){
  816. active <- pat_chr_plot
  817. inactive <- mat_chr_plot
  818. } else if (exp == "mat"){
  819. active <- mat_chr_plot
  820. inactive <- pat_chr_plot
  821. }
  822. #add viewpoint
  823. active$start <- viewpoint
  824. inactive$start <- viewpoint
  825. #generating bed
  826. activebed <- func.activebed(active)
  827. inactivebed <- func.inactivebed(inactive)
  828. activebed$IG <- gene
  829. inactivebed$IG <- gene
  830. #cummulative
  831. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  832. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  833. #=============================
  834. biallelicbed <- read.table("Features/EXP022_CN_BiallelicRNAseq_capture.bed", header=FALSE, sep="\t", stringsAsFactors=FALSE)
  835. filter_gr <- GRanges(seqnames=7, ranges=IRanges(start=142266803 + 1, end=144176724))
  836. query_gr <- GRanges(seqnames=biallelicbed[[1]],
  837. ranges=IRanges(start=biallelicbed[[2]] + 1, end=biallelicbed[[3]]))
  838. hits <- findOverlaps(query_gr, filter_gr, type = "within")
  839. filtered_query <- biallelicbed[queryHits(hits), ]
  840. biallelicregion <- filtered_query
  841. biallelicregion$viewpoint[biallelicregion$V6 == "-"] <- biallelicregion$V3[biallelicregion$V6 == "-"]
  842. biallelicregion$viewpoint[biallelicregion$V6 == "+"] <- biallelicregion$V2[biallelicregion$V6 == "+"]
  843. biallelicregion <- biallelicregion[,c("V4","V1","viewpoint")]
  844. colnames(biallelicregion) <- c("gene","chrnumb","viewpoint")
  845. i=1
  846. for (i in seq_len(nrow(biallelicregion))) {
  847. gene <- biallelicregion$gene[i]
  848. viewpoint <- biallelicregion$viewpoint[i]
  849. chrnumb <- biallelicregion$chrnumb[i]
  850. exp <- "bi"
  851. mat_chr_plot <- func.paircounts.mat(viewpoint)
  852. pat_chr_plot <- func.paircounts.pat(viewpoint)
  853. if (exp == "bi"){
  854. biallele1 <- pat_chr_plot
  855. biallele2 <- mat_chr_plot
  856. }
  857. biallele1$start <- viewpoint
  858. biallele2$start <- viewpoint
  859. biallele1bed <- func.biallele1bed(biallele1)
  860. biallele2bed <- func.biallele2bed(biallele2)
  861. biallele1bed$IG <- gene
  862. biallele2bed$IG <- gene
  863. cumm.biallele1bed <- rbind(unique(cumm.biallele1bed),biallele1bed)
  864. cumm.biallele2bed <- rbind(unique(cumm.biallele2bed),biallele2bed)
  865. }
  866. #==============================
  867. #==============================
  868. #===Region6 pairs file analysis
  869. mat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Mat_prejuicer_Q30_reg6.medium", header = FALSE, sep = '\t')
  870. mat_chr_reg <- mat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  871. colnames(mat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  872. pat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Pat_prejuicer_Q30_reg6.medium", header = FALSE, sep = '\t')
  873. pat_chr_reg <- pat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  874. colnames(pat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  875. #==============================
  876. #Dlk1 TSS
  877. #==============================
  878. #Meg3 TSS1
  879. gene <- "Meg3"
  880. viewpoint <- 109506879
  881. chrnumb <- 12
  882. exp <- "mat"
  883. noexp <- "pat"
  884. #counting all the contacts from the viewpoint 5kb bin
  885. mat_chr_plot <- func.paircounts.mat(viewpoint)
  886. pat_chr_plot <- func.paircounts.pat(viewpoint)
  887. #which allele is transcriptionally active?
  888. if (exp == "pat"){
  889. active <- pat_chr_plot
  890. inactive <- mat_chr_plot
  891. } else if (exp == "mat"){
  892. active <- mat_chr_plot
  893. inactive <- pat_chr_plot
  894. }
  895. #add viewpoint
  896. active$start <- viewpoint
  897. inactive$start <- viewpoint
  898. #generating bed
  899. activebed <- func.activebed(active)
  900. inactivebed <- func.inactivebed(inactive)
  901. activebed$IG <- gene
  902. inactivebed$IG <- gene
  903. #cummulative
  904. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  905. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  906. #==============================
  907. #Rtl1 TSS
  908. #==============================
  909. #Rian TSS polycistronic
  910. #==============================
  911. #Mirg TSS polycistronic
  912. #==============================
  913. #=============================
  914. biallelicbed <- read.table("Features/EXP022_CN_BiallelicRNAseq_capture.bed", header=FALSE, sep="\t", stringsAsFactors=FALSE)
  915. filter_gr <- GRanges(seqnames=12, ranges=IRanges(start=108178545 + 1, end=111651244))
  916. query_gr <- GRanges(seqnames=biallelicbed[[1]],
  917. ranges=IRanges(start=biallelicbed[[2]] + 1, end=biallelicbed[[3]]))
  918. hits <- findOverlaps(query_gr, filter_gr, type = "within")
  919. filtered_query <- biallelicbed[queryHits(hits), ]
  920. biallelicregion <- filtered_query
  921. biallelicregion$viewpoint[biallelicregion$V6 == "-"] <- biallelicregion$V3[biallelicregion$V6 == "-"]
  922. biallelicregion$viewpoint[biallelicregion$V6 == "+"] <- biallelicregion$V2[biallelicregion$V6 == "+"]
  923. biallelicregion <- biallelicregion[,c("V4","V1","viewpoint")]
  924. colnames(biallelicregion) <- c("gene","chrnumb","viewpoint")
  925. i=1
  926. for (i in seq_len(nrow(biallelicregion))) {
  927. gene <- biallelicregion$gene[i]
  928. viewpoint <- biallelicregion$viewpoint[i]
  929. chrnumb <- biallelicregion$chrnumb[i]
  930. exp <- "bi"
  931. mat_chr_plot <- func.paircounts.mat(viewpoint)
  932. pat_chr_plot <- func.paircounts.pat(viewpoint)
  933. if (exp == "bi"){
  934. biallele1 <- pat_chr_plot
  935. biallele2 <- mat_chr_plot
  936. }
  937. biallele1$start <- viewpoint
  938. biallele2$start <- viewpoint
  939. biallele1bed <- func.biallele1bed(biallele1)
  940. biallele2bed <- func.biallele2bed(biallele2)
  941. biallele1bed$IG <- gene
  942. biallele2bed$IG <- gene
  943. cumm.biallele1bed <- rbind(unique(cumm.biallele1bed),biallele1bed)
  944. cumm.biallele2bed <- rbind(unique(cumm.biallele2bed),biallele2bed)
  945. }
  946. #==============================
  947. #==============================
  948. #===Region7 pairs file analysis
  949. mat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Mat_prejuicer_Q30_reg7.medium", header = FALSE, sep = '\t')
  950. mat_chr_reg <- mat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  951. colnames(mat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  952. pat_chr_reg <- read.table("Prejuicer/EXP012.CHiC_Pat_prejuicer_Q30_reg7.medium", header = FALSE, sep = '\t')
  953. pat_chr_reg <- pat_chr_reg[c('V1','V3','V4','V7','V8','V2','V6')]
  954. colnames(pat_chr_reg) <- c('V1','V2','V3','V4','V5','V6','V7')
  955. #==============================
  956. #Kcnk9 TSS
  957. gene <- "Kcnk9"
  958. viewpoint <- 72422415
  959. chrnumb <- 15
  960. exp <- "mat"
  961. noexp <- "pat"
  962. #counting all the contacts from the viewpoint 5kb bin
  963. mat_chr_plot <- func.paircounts.mat(viewpoint)
  964. pat_chr_plot <- func.paircounts.pat(viewpoint)
  965. #which allele is transcriptionally active?
  966. if (exp == "pat"){
  967. active <- pat_chr_plot
  968. inactive <- mat_chr_plot
  969. } else if (exp == "mat"){
  970. active <- mat_chr_plot
  971. inactive <- pat_chr_plot
  972. }
  973. #add viewpoint
  974. active$start <- viewpoint
  975. inactive$start <- viewpoint
  976. #generating bed
  977. activebed <- func.activebed(active)
  978. inactivebed <- func.inactivebed(inactive)
  979. activebed$IG <- gene
  980. inactivebed$IG <- gene
  981. #cummulative
  982. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  983. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  984. #==============================
  985. #Peg13 TSS
  986. gene <- "Peg13"
  987. viewpoint <- 72682173
  988. chrnumb <- 15
  989. exp <- "pat"
  990. noexp <- "mat"
  991. #counting all the contacts from the viewpoint 5kb bin
  992. mat_chr_plot <- func.paircounts.mat(viewpoint)
  993. pat_chr_plot <- func.paircounts.pat(viewpoint)
  994. #which allele is transcriptionally active?
  995. if (exp == "pat"){
  996. active <- pat_chr_plot
  997. inactive <- mat_chr_plot
  998. } else if (exp == "mat"){
  999. active <- mat_chr_plot
  1000. inactive <- pat_chr_plot
  1001. }
  1002. #add viewpoint
  1003. active$start <- viewpoint
  1004. inactive$start <- viewpoint
  1005. #generating bed
  1006. activebed <- func.activebed(active)
  1007. inactivebed <- func.inactivebed(inactive)
  1008. activebed$IG <- gene
  1009. inactivebed$IG <- gene
  1010. #cummulative
  1011. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  1012. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  1013. #==============================
  1014. #Trappc9 TSS
  1015. gene <- "Trappc9"
  1016. viewpoint <- 72933053
  1017. chrnumb <- 15
  1018. exp <- "mat"
  1019. noexp <- "pat"
  1020. #counting all the contacts from the viewpoint 5kb bin
  1021. mat_chr_plot <- func.paircounts.mat(viewpoint)
  1022. pat_chr_plot <- func.paircounts.pat(viewpoint)
  1023. #which allele is transcriptionally active?
  1024. if (exp == "pat"){
  1025. active <- pat_chr_plot
  1026. inactive <- mat_chr_plot
  1027. } else if (exp == "mat"){
  1028. active <- mat_chr_plot
  1029. inactive <- pat_chr_plot
  1030. }
  1031. #add viewpoint
  1032. active$start <- viewpoint
  1033. inactive$start <- viewpoint
  1034. #generating bed
  1035. activebed <- func.activebed(active)
  1036. inactivebed <- func.inactivebed(inactive)
  1037. activebed$IG <- gene
  1038. inactivebed$IG <- gene
  1039. #cummulative
  1040. cumm.activebed <- rbind(unique(cumm.activebed),activebed)
  1041. cumm.inactivebed <- rbind(unique(cumm.inactivebed),inactivebed)
  1042. #==============================
  1043. biallelicbed <- read.table("Features/EXP022_CN_BiallelicRNAseq_capture.bed", header=FALSE, sep="\t", stringsAsFactors=FALSE)
  1044. filter_gr <- GRanges(seqnames=15, ranges=IRanges(start=71271582 + 1, end=73517436))
  1045. query_gr <- GRanges(seqnames=biallelicbed[[1]],
  1046. ranges=IRanges(start=biallelicbed[[2]] + 1, end=biallelicbed[[3]]))
  1047. hits <- findOverlaps(query_gr, filter_gr, type = "within")
  1048. filtered_query <- biallelicbed[queryHits(hits), ]
  1049. biallelicregion <- filtered_query
  1050. biallelicregion$viewpoint[biallelicregion$V6 == "-"] <- biallelicregion$V3[biallelicregion$V6 == "-"]
  1051. biallelicregion$viewpoint[biallelicregion$V6 == "+"] <- biallelicregion$V2[biallelicregion$V6 == "+"]
  1052. biallelicregion <- biallelicregion[,c("V4","V1","viewpoint")]
  1053. colnames(biallelicregion) <- c("gene","chrnumb","viewpoint")
  1054. i=1
  1055. for (i in seq_len(nrow(biallelicregion))) {
  1056. gene <- biallelicregion$gene[i]
  1057. viewpoint <- biallelicregion$viewpoint[i]
  1058. chrnumb <- biallelicregion$chrnumb[i]
  1059. exp <- "bi"
  1060. mat_chr_plot <- func.paircounts.mat(viewpoint)
  1061. pat_chr_plot <- func.paircounts.pat(viewpoint)
  1062. if (exp == "bi"){
  1063. biallele1 <- pat_chr_plot
  1064. biallele2 <- mat_chr_plot
  1065. }
  1066. biallele1$start <- viewpoint
  1067. biallele2$start <- viewpoint
  1068. biallele1bed <- func.biallele1bed(biallele1)
  1069. biallele2bed <- func.biallele2bed(biallele2)
  1070. biallele1bed$IG <- gene
  1071. biallele2bed$IG <- gene
  1072. cumm.biallele1bed <- rbind(unique(cumm.biallele1bed),biallele1bed)
  1073. cumm.biallele2bed <- rbind(unique(cumm.biallele2bed),biallele2bed)
  1074. }
  1075. #==============================
  1076. #==============================
  1077. #summary
  1078. cumm.activebed$TSS <- "active allele"
  1079. cumm.inactivebed$TSS <- "inactive allele"
  1080. cumm.biallele1bed$TSS <- "biallele1"
  1081. cumm.biallele2bed$TSS <- "biallele2"
  1082. cumm.all <- rbind(cumm.activebed, cumm.inactivebed,cumm.biallele1bed,cumm.biallele2bed)
  1083. #==============================
  1084. #==============================
  1085. unique(cumm.all$IG)
  1086. summary2 <- cumm.all %>% dplyr::count(TSS)
  1087. summary2$group <- c("mono","bi","bi","mono")
  1088. #==============================
  1089. pdf(file = "EXP012_NumberOfContactsFromTSS_Norm_all_Q30_12_bi-loop.pdf", width = 3.5, height = 3.5)
  1090. p <- ggplot(data=summary2, aes(x=group, y=n, fill=TSS)) +
  1091. geom_bar(stat="identity", position = "fill") +
  1092. scale_y_continuous(expand = c(0, 0)) +
  1093. labs(x = "Imprinted genes", y = "total # contacts from TSS") +
  1094. scale_fill_manual(values=c("chocolate3", "lightblue4","rosybrown3", "gray70")) +
  1095. my_theme + theme(legend.position = "right")
  1096. p
  1097. dev.off()
  1098. #==============================
  1099. cumm.all.filtered3 <- cumm.all %>% filter(TSS %in% c("biallele1","biallele2"))
  1100. summary3 <- cumm.all.filtered3 %>% dplyr::count(IG, TSS)
  1101. #==============================
  1102. pdf(file = "EXP012_NumberOfContactsFromTSS_Norm_individual_fill_Q30_12_bi-loop.pdf", width = 14, height = 3.5)
  1103. p <- ggplot(data=summary3, aes(x=IG, y=n, fill=TSS)) +
  1104. geom_bar(stat="identity", position = "fill") +
  1105. scale_y_continuous(expand = c(0, 0)) +
  1106. labs(x = "Imprinted genes", y = "total # contacts from TSS") +
  1107. scale_fill_manual(values=c("chocolate3", "lightblue4","rosybrown3", "gray70")) +
  1108. my_theme
  1109. p
  1110. dev.off()
  1111. #==============================
  1112. level_order <- c('Sgce','Peg10','Mest','Peg3','Usp29','Snrpn','A230006K03Rik','B230209E15Rik','A330076H08Rik','Ndn','Magel2','Mkrn3','Peg12','Kcnq1ot1','Cdkn1c','Meg3','Peg13',
  1113. 'Copg2','Ube3a','Kcnk9','Trappc9',
  1114. 'Ppp1r9a', 'Casd1', 'Tmem209', 'Zfp583', 'Clcn4','Gabrb3','Ctsd', 'Nap1l4','Cars1')
  1115. cumm.all.filtered <- cumm.all %>% filter(IG %in% level_order)
  1116. cumm.all.filtered <- unique(cumm.all.filtered)
  1117. unique(cumm.all.filtered$IG)
  1118. #==============================
  1119. summary <- cumm.all.filtered %>% dplyr::count(IG, TSS)
  1120. colnames(summary) <- c("IG","TSS","allcounts")
  1121. summary$type[summary$IG %in% c('Sgce','Peg10','Mest','Peg3','Usp29','Snrpn','A230006K03Rik','B230209E15Rik','A330076H08Rik','Ndn','Magel2','Mkrn3','Peg12', 'Kcnq1ot1','Cdkn1c','Meg3','Peg13')] <- "DMR"
  1122. summary$type[summary$IG %in% c('Copg2','Ube3a','Kcnk9','Trappc9')] <- "distal"
  1123. summary$type[summary$IG %in% c('Ppp1r9a', 'Casd1', 'Tmem209', 'Zfp583', 'Clcn4','Gabrb3', 'Ctsd','Nap1l4','Cars1')] <- "nonIG"
  1124. #==============================
  1125. # Basic barplot
  1126. pdf(file = "EXP012_NumberOfContactsFromTSS_Norm_individual_stack_Q30_12_bi-loop.pdf", width = 8, height = 3.5)
  1127. p <- ggplot(data=summary, aes(x=IG, y=allcounts, fill=TSS)) +
  1128. geom_bar(stat="identity") +
  1129. scale_y_continuous(expand = c(0, 0), limit = c(0,3500)) +
  1130. labs(x = "Imprinted genes", y = "total # contacts from TSS") +
  1131. scale_x_discrete(limits = level_order) +
  1132. scale_fill_manual(values=c("chocolate3", "lightblue4","rosybrown3", "gray70")) +
  1133. my_theme
  1134. p
  1135. dev.off()
  1136. pdf(file = "EXP012_NumberOfContactsFromTSS_Norm_individual_fill_Q30_12_bi-loop.pdf", width = 8, height = 3.5)
  1137. p <- ggplot(data=summary, aes(x=IG, y=allcounts, fill=TSS)) +
  1138. geom_bar(stat="identity", position = "fill") +
  1139. scale_y_continuous(expand = c(0, 0)) +
  1140. labs(x = "Imprinted genes", y = "total # contacts from TSS") +
  1141. scale_x_discrete(limits = level_order) +
  1142. scale_fill_manual(values=c("chocolate3", "lightblue4","rosybrown3", "gray70")) +
  1143. my_theme
  1144. p
  1145. dev.off()
  1146. #==============================
  1147. #==============================
  1148. cumm.all.filtered4 <- cumm.all
  1149. cumm.all.filtered4$type <- "nonIG"
  1150. cumm.all.filtered4$type[cumm.all.filtered4$IG %in% c('Sgce','Peg10','Mest','Peg3','Usp29','Snrpn','Peg12', 'Kcnq1ot1','Peg13')] <- "DMR"
  1151. cumm.all.filtered4$type[cumm.all.filtered4$IG %in% c('A230006K03Rik','B230209E15Rik','A330076H08Rik','Ndn','Magel2','Mkrn3','Cdkn1c','Meg3')] <- "DMR"
  1152. cumm.all.filtered4$type[cumm.all.filtered4$IG %in% c('Copg2','Ube3a','Kcnk9','Trappc9')] <- "distal"
  1153. summary4 <- cumm.all.filtered4 %>% dplyr::count(type,TSS)
  1154. pdf(file = "EXP012_NumberOfContactsFromTSS_Norm_groups_stack_Q30_12_bi-loop.pdf", width = 8, height = 3.5)
  1155. p <- ggplot(data=summary4, aes(x=type, y=n, fill=TSS)) +
  1156. geom_bar(stat="identity", position = "fill") +
  1157. scale_y_continuous(expand = c(0, 0)) +
  1158. labs(x = "Imprinted genes", y = "total # contacts from TSS") +
  1159. scale_fill_manual(values=c("chocolate3", "lightblue4","rosybrown3", "gray70")) +
  1160. my_theme + theme(legend.position = "right")
  1161. p
  1162. dev.off()
  1163. #==============================
  1164. #==============================
  1165. ### contact types classified by ChromHMM
  1166. #==============================
  1167. #==============================
  1168. unique(cumm.all$IG)
  1169. cumm.all.filtered <- cumm.all
  1170. cumm.all.filtered <- unique(cumm.all.filtered)
  1171. unique(cumm.all.filtered$IG)
  1172. #==============================
  1173. cumm.all.filtered$active[cumm.all.filtered$IG %in% c('Copg2','Ube3a','Kcnk9','Trappc9','Meg3','Cdkn1c') & cumm.all.filtered$TSS == "active allele"] <- "mat"
  1174. cumm.all.filtered$active[cumm.all.filtered$IG %in% c('Copg2','Ube3a','Kcnk9','Trappc9','Meg3','Cdkn1c') & cumm.all.filtered$TSS == "inactive allele"] <- "pat"
  1175. cumm.all.filtered$active[cumm.all.filtered$IG %in% c('Sgce','Peg10','Mest','Peg3','Usp29','Snrpn','A230006K03Rik','B230209E15Rik','A330076H08Rik','Ndn','Magel2','Mkrn3','Peg12', 'Kcnq1ot1','Peg13') & cumm.all.filtered$TSS == "active allele"] <- "pat"
  1176. cumm.all.filtered$active[cumm.all.filtered$IG %in% c('Sgce','Peg10','Mest','Peg3','Usp29','Snrpn','A230006K03Rik','B230209E15Rik','A330076H08Rik','Ndn','Magel2','Mkrn3','Peg12', 'Kcnq1ot1','Peg13') & cumm.all.filtered$TSS == "inactive allele"] <- "mat"
  1177. cumm.all.filtered$active[cumm.all.filtered$TSS == "biallele1"] <- "mat"
  1178. cumm.all.filtered$active[cumm.all.filtered$TSS == "biallele2"] <- "pat"
  1179. cumm.all.filtered <- unique(cumm.all.filtered)
  1180. cumm.all.filtered$start <- cumm.all.filtered$end
  1181. summary <- cumm.all.filtered %>% dplyr::count(IG, TSS, active)
  1182. colnames(summary) <- c("IG","TSS", "active","allcounts")
  1183. summary$type[summary$IG %in% c('Sgce','Peg10','Mest','Peg3','Usp29','Snrpn','A230006K03Rik','B230209E15Rik','A330076H08Rik','Ndn','Magel2','Mkrn3','Peg12', 'Kcnq1ot1','Cdkn1c','Meg3','Peg13')] <- "DMR"
  1184. summary$type[summary$IG %in% c('Copg2','Ube3a','Kcnk9','Trappc9')] <- "distal"
  1185. summary$type[summary$TSS %in% c("biallele1", "biallele2")] <- "nonIG"
  1186. #==============================
  1187. groups <- c("E1","E2","E3","E4","E5","E6","E7","E8","E9","E10","E11","E12")
  1188. #==============================
  1189. mat.ChromHMM <- read.table("/ChromHMM/Mat_12_segments.bed", header = FALSE, sep = '\t')
  1190. colnames(mat.ChromHMM) <- c("chrom","start","end","group")
  1191. mat.ChromHMM <- mat.ChromHMM[- grep("chr", mat.ChromHMM$chrom),]
  1192. pat.ChromHMM <- read.table("/ChromHMM/Pat_12_segments.bed", header = FALSE, sep = '\t')
  1193. colnames(pat.ChromHMM) <- c("chrom","start","end","group")
  1194. pat.ChromHMM <- pat.ChromHMM[- grep("chr", pat.ChromHMM$chrom),]
  1195. #==============================
  1196. #==============================
  1197. cumm.all.filtered$chrom <- str_replace_all(cumm.all.filtered$chrom,"chr","")
  1198. cumm.all.filtered.mat <- cumm.all.filtered[cumm.all.filtered$active == "mat",]
  1199. cumm.all.filtered.pat <- cumm.all.filtered[cumm.all.filtered$active == "pat",]
  1200. #==============================
  1201. for (group in groups){
  1202. assign(gsub(" ","",paste("summary.mat.counts.",group)), (bed_intersect(cumm.all.filtered.mat, mat.ChromHMM[mat.ChromHMM$group == group,]) %>% count(IG.x, TSS.x)))
  1203. }
  1204. for (group in groups){
  1205. assign(gsub(" ","",paste("summary.pat.counts.",group)), (bed_intersect(cumm.all.filtered.pat, pat.ChromHMM[pat.ChromHMM$group == group,]) %>% count(IG.x, TSS.x)))
  1206. }
  1207. #==============================
  1208. colnames(summary.mat.counts.E1) <- c("IG","TSS","E1")
  1209. colnames(summary.mat.counts.E2) <- c("IG","TSS","E2")
  1210. colnames(summary.mat.counts.E3) <- c("IG","TSS","E3")
  1211. colnames(summary.mat.counts.E4) <- c("IG","TSS","E4")
  1212. colnames(summary.mat.counts.E5) <- c("IG","TSS","E5")
  1213. colnames(summary.mat.counts.E6) <- c("IG","TSS","E6")
  1214. colnames(summary.mat.counts.E7) <- c("IG","TSS","E7")
  1215. colnames(summary.mat.counts.E8) <- c("IG","TSS","E8")
  1216. colnames(summary.mat.counts.E9) <- c("IG","TSS","E9")
  1217. colnames(summary.mat.counts.E10) <- c("IG","TSS","E10")
  1218. colnames(summary.mat.counts.E11) <- c("IG","TSS","E11")
  1219. colnames(summary.mat.counts.E12) <- c("IG","TSS","E12")
  1220. #==============================
  1221. colnames(summary.pat.counts.E1) <- c("IG","TSS","E1")
  1222. colnames(summary.pat.counts.E2) <- c("IG","TSS","E2")
  1223. colnames(summary.pat.counts.E3) <- c("IG","TSS","E3")
  1224. colnames(summary.pat.counts.E4) <- c("IG","TSS","E4")
  1225. colnames(summary.pat.counts.E5) <- c("IG","TSS","E5")
  1226. colnames(summary.pat.counts.E6) <- c("IG","TSS","E6")
  1227. colnames(summary.pat.counts.E7) <- c("IG","TSS","E7")
  1228. colnames(summary.pat.counts.E8) <- c("IG","TSS","E8")
  1229. colnames(summary.pat.counts.E9) <- c("IG","TSS","E9")
  1230. colnames(summary.pat.counts.E10) <- c("IG","TSS","E10")
  1231. colnames(summary.pat.counts.E11) <- c("IG","TSS","E11")
  1232. colnames(summary.pat.counts.E12) <- c("IG","TSS","E12")
  1233. #==============================
  1234. # normalize counts by genome % per each group
  1235. summary.mat.counts.E1$E1 <- summary.mat.counts.E1$E1/0.036
  1236. summary.mat.counts.E2$E2 <- summary.mat.counts.E2$E2/0.317
  1237. summary.mat.counts.E3$E3 <- summary.mat.counts.E3$E3/0.480
  1238. summary.mat.counts.E4$E4 <- summary.mat.counts.E4$E4/0.009
  1239. summary.mat.counts.E5$E5 <- summary.mat.counts.E5$E5/0.038
  1240. summary.mat.counts.E6$E6 <- summary.mat.counts.E6$E6/0.010
  1241. summary.mat.counts.E7$E7 <- summary.mat.counts.E7$E7/0.004
  1242. summary.mat.counts.E8$E8 <- summary.mat.counts.E8$E8/0.010
  1243. summary.mat.counts.E9$E9 <- summary.mat.counts.E9$E9/0.006
  1244. summary.mat.counts.E10$E10 <- summary.mat.counts.E10$E10/0.024
  1245. summary.mat.counts.E11$E11 <- summary.mat.counts.E11$E11/0.015
  1246. summary.mat.counts.E12$E12 <- summary.mat.counts.E12$E12/0.052
  1247. # normalize counts by genome % per each group
  1248. summary.pat.counts.E1$E1 <- summary.pat.counts.E1$E1/0.035
  1249. summary.pat.counts.E2$E2 <- summary.pat.counts.E2$E2/0.310
  1250. summary.pat.counts.E3$E3 <- summary.pat.counts.E3$E3/0.488
  1251. summary.pat.counts.E4$E4 <- summary.pat.counts.E4$E4/0.009
  1252. summary.pat.counts.E5$E5 <- summary.pat.counts.E5$E5/0.038
  1253. summary.pat.counts.E6$E6 <- summary.pat.counts.E6$E6/0.010
  1254. summary.pat.counts.E7$E7 <- summary.pat.counts.E7$E7/0.004
  1255. summary.pat.counts.E8$E8 <- summary.pat.counts.E8$E8/0.010
  1256. summary.pat.counts.E9$E9 <- summary.pat.counts.E9$E9/0.006
  1257. summary.pat.counts.E10$E10 <- summary.pat.counts.E10$E10/0.025
  1258. summary.pat.counts.E11$E11 <- summary.pat.counts.E11$E11/0.015
  1259. summary.pat.counts.E12$E12 <- summary.pat.counts.E12$E12/0.051
  1260. #==============================
  1261. summary.counts.E1 <- rbind(summary.pat.counts.E1, summary.mat.counts.E1)
  1262. summary.counts.E2 <- rbind(summary.pat.counts.E2, summary.mat.counts.E2)
  1263. summary.counts.E3 <- rbind(summary.pat.counts.E3, summary.mat.counts.E3)
  1264. summary.counts.E4 <- rbind(summary.pat.counts.E4, summary.mat.counts.E4)
  1265. summary.counts.E5 <- rbind(summary.pat.counts.E5, summary.mat.counts.E5)
  1266. summary.counts.E6 <- rbind(summary.pat.counts.E6, summary.mat.counts.E6)
  1267. summary.counts.E7 <- rbind(summary.pat.counts.E7, summary.mat.counts.E7)
  1268. summary.counts.E8 <- rbind(summary.pat.counts.E8, summary.mat.counts.E8)
  1269. summary.counts.E9 <- rbind(summary.pat.counts.E9, summary.mat.counts.E9)
  1270. summary.counts.E10 <- rbind(summary.pat.counts.E10, summary.mat.counts.E10)
  1271. summary.counts.E11 <- rbind(summary.pat.counts.E11, summary.mat.counts.E11)
  1272. summary.counts.E12 <- rbind(summary.pat.counts.E12, summary.mat.counts.E12)
  1273. #==============================
  1274. #==============================
  1275. allcounts <- summary
  1276. allcounts <- merge(allcounts, summary.counts.E1, by=c("IG","TSS"),all=TRUE)
  1277. allcounts <- merge(allcounts, summary.counts.E2, by=c("IG","TSS"),all=TRUE)
  1278. allcounts <- merge(allcounts, summary.counts.E3, by=c("IG","TSS"),all=TRUE)
  1279. allcounts <- merge(allcounts, summary.counts.E4, by=c("IG","TSS"),all=TRUE)
  1280. allcounts <- merge(allcounts, summary.counts.E5, by=c("IG","TSS"),all=TRUE)
  1281. allcounts <- merge(allcounts, summary.counts.E6, by=c("IG","TSS"),all=TRUE)
  1282. allcounts <- merge(allcounts, summary.counts.E7, by=c("IG","TSS"),all=TRUE)
  1283. allcounts <- merge(allcounts, summary.counts.E8, by=c("IG","TSS"),all=TRUE)
  1284. allcounts <- merge(allcounts, summary.counts.E9, by=c("IG","TSS"),all=TRUE)
  1285. allcounts <- merge(allcounts, summary.counts.E10, by=c("IG","TSS"),all=TRUE)
  1286. allcounts <- merge(allcounts, summary.counts.E11, by=c("IG","TSS"),all=TRUE)
  1287. allcounts <- merge(allcounts, summary.counts.E12, by=c("IG","TSS"),all=TRUE)
  1288. allcounts[is.na(allcounts)] <- 0
  1289. allcounts <- allcounts[,-4]
  1290. #==============================
  1291. allcounts <- allcounts %>% pivot_longer(cols = 5:16, names_to = "countstype", values_to = "n")
  1292. allcounts$group <- paste(allcounts$IG, allcounts$TSS)
  1293. allcounts$group2 <- paste(allcounts$TSS, allcounts$type)
  1294. sum(allcounts$n)
  1295. levelorder <- c("E2","E3","E8",
  1296. "E1","E4",
  1297. "E9","E11","E12",
  1298. "E5", "E6","E7","E10")
  1299. palette <- c("#000000","#666666","#333333",
  1300. "#993333","#FF6633",
  1301. "#FFFF99","#FFFFCC","#FFFF99",
  1302. "#99CC66","#66CC66","#339966","#336633")
  1303. unique(allcounts$group)
  1304. #==============================
  1305. pdf(file = "EXP012_NumberOfContactsFromTSS_Norm_diffcontacttypes_fill_Q30_12_bi-loop.pdf", width = 6.5, height = 5.5)
  1306. p <- ggplot(data=allcounts, aes(x=factor(group2, level=c("active allele DMR","inactive allele DMR","active allele distal","inactive allele distal","biallele1 nonIG","biallele2 nonIG")), y=n, fill=factor(countstype, level=levelorder))) +
  1307. geom_bar(stat="identity", position = "fill") +
  1308. scale_y_continuous(expand = c(0, 0)) +
  1309. labs(x = "Imprinted genes", y = "Normalized # contacts from TSS") +
  1310. scale_fill_manual(values=palette) +
  1311. my_theme + theme(legend.position = "right", legend.text=element_text(size=8))
  1312. p
  1313. dev.off()
  1314. #==============================
  1315. length(unique(allcounts$IG))
  1316. allcounts$n.ave[allcounts$IG %in% c('Copg2','Ube3a','Kcnk9','Trappc9')] <- 4
  1317. allcounts$n.ave[allcounts$IG %in% c('Sgce','Peg10','Mest','Peg3','Usp29','Snrpn','A230006K03Rik','B230209E15Rik','A330076H08Rik',
  1318. 'Ndn','Magel2','Mkrn3','Peg12', 'Kcnq1ot1','Cdkn1c','Meg3','Peg13')] <- 17
  1319. allcounts$n.ave[allcounts$type == "nonIG"] <- length(unique(allcounts$IG)) - 4 - 17
  1320. allcounts$n <- allcounts$n/allcounts$n.ave
  1321. #==============================
  1322. pdf(file = "EXP012_NumberOfContactsFromTSS_Norm_diffcontacttypes_Q30_12_bi-loop.pdf", width = 6.5, height = 5.5)
  1323. p <- ggplot(data=allcounts, aes(x=factor(group2, level=c("active allele DMR","inactive allele DMR","active allele distal","inactive allele distal","biallele1 nonIG","biallele2 nonIG")), y=n, fill=factor(countstype, level=levelorder))) +
  1324. geom_bar(stat="identity") +
  1325. scale_y_continuous(expand = c(0, 0)) +
  1326. labs(x = "Imprinted genes", y = "Normalized # contacts from TSS") +
  1327. scale_fill_manual(values=palette) +
  1328. my_theme + theme(legend.position = "right", legend.text=element_text(size=8))
  1329. p
  1330. dev.off()
  1331. #==============================

BB_CHiC_GRCm39_contactanalysisChromHMM_FIgure4.R at commit 016d4b2, no license · at the source

Overview

Authors: Bongmin Bae1, Katherine Gu1, Daniel Loftus1, Amanda J Whipple1
  1. Department of Molecular and Cellular Biology, Harvard University, Cambridge, MA USA
Institutions: Harvard University (United States)
Journal: Nature communications, volume 17, issue 1, article 9543
Dates: received 30 April 2026; accepted 31 July 2026; published online 8 August 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41467-026-76506-3 · PMID 42702594 · PMCID PMC13547231 · OpenAlex W7201952788
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: genetics / omics (modality), mouse (organism), cellular / molecular (subfield)
Methods: Spectral & time-frequency, Statistics, Connectivity, Evoked potentials
Keywords: Imprinting, DNA methylation
MeSH: Chromatin*, Enhancer Elements, Genetic*, Genomic Imprinting*, Alleles, Animals, CCCTC-Binding Factor, Cerebral Cortex, DNA Methylation, Female, Male, Mice, Mice, Inbred C57BL, Neurons, Promoter Regions, Genetic, Transcription, Genetic (* major topic)
Topic: Genetic Syndromes and Imprinting (Genetics, Biochemistry, Genetics and Molecular Biology), according to OpenAlex
Funding: U.S. Department of Health & Human Services | NIH | National Institute of General Medical Sciences (NIGMS) (F32GM156080, R35GM146921); American Heart Association (American Heart Association, Inc.) (26POST1543266); NEI NIH HHS (P30 EY012196); NIGMS NIH HHS (F32 GM156080, R35 GM146921)
Citations: not cited yet (Europe PMC); 54 references in the paper
Research resources: RRID:SCR_018673

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 8 matches between paragraphs and lines of code.

Whipple-Lab/capture-hic-imprinting

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 016d4b249d40783a8163af765a2a63d1bfbd1506, 1 June 2026
Languages: R (19), Shell (3)
Size: 23 files, 22 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: data.table (16 files), ggplot2 (11 files), reshape2 (8 files), tidyverse (3 files)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
23 files

Zenodo 21224497

License: CC-BY-4.0
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: the references
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: data.table (16 files), ggplot2 (11 files), reshape2 (8 files), tidyverse (3 files)
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
23 files
At the source:

Code availability statement

The paper has a code 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.1038/s41467-026-76506-3.

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;
  • 44 scripts, each with its path and the digest of its content;
  • 8 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

Data availability statement

The paper has a 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.1038/s41467-026-76506-3.

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, 4 authors, 2 keywords, 15 MeSH terms, 4 funders, 54 references, 1 RRID.

Cite

This paper

Bae, B., Gu, K., Loftus, D., & Whipple, A. J. (2026). Allele-specific chromatin architecture shapes imprinted domains and coordinates a distal enhancer and antisense transcription at the mouse Mest-Copg2 domain. Nature communications, 17(1), 9543. https://doi.org/10.1038/s41467-026-76506-3

BibTeX

@article{bae2026allele,
author = {Bae, Bongmin and Gu, Katherine and Loftus, Daniel and Whipple, Amanda J},
title = {{Allele-specific chromatin architecture shapes imprinted domains and coordinates a distal enhancer and antisense transcription at the mouse Mest-Copg2 domain}},
journal = {Nature communications},
year = {2026},
month = aug,
volume = {17},
number = {1},
pages = {9543},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/s41467-026-76506-3},
url = {https://doi.org/10.1038/s41467-026-76506-3},
pmid = {42702594},
pmcid = {PMC13547231}
}

RIS

TY - JOUR
AU - Bae, Bongmin
AU - Gu, Katherine
AU - Loftus, Daniel
AU - Whipple, Amanda J
TI - Allele-specific chromatin architecture shapes imprinted domains and coordinates a distal enhancer and antisense transcription at the mouse Mest-Copg2 domain
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/08/08
VL - 17
IS - 1
SP - 9543
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/s41467-026-76506-3
UR - https://doi.org/10.1038/s41467-026-76506-3
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-76506-3",
"type": "article-journal",
"title": "Allele-specific chromatin architecture shapes imprinted domains and coordinates a distal enhancer and antisense transcription at the mouse Mest-Copg2 domain",
"container-title": "Nature communications",
"author": [
{
"family": "Bae",
"given": "Bongmin"
},
{
"family": "Gu",
"given": "Katherine"
},
{
"family": "Loftus",
"given": "Daniel"
},
{
"family": "Whipple",
"given": "Amanda J"
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "9543",
"DOI": "10.1038/s41467-026-76506-3",
"PMID": "42702594",
"PMCID": "PMC13547231",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41467-026-76506-3",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
8
]
]
}
}

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.21203/rs.3.rs-9927928/v1 [code]
Genome-wide and allele-resolved maps of the radial architecture of the mouse genome
Journal: Research Square (preprint)
In common: reshape2, data.table, ggplot2, 1 other tool, genetics / omics, mouse, 2 references
[2] doi:10.1371/journal.pgen.1012081
ADNP regulates chromatin architecture and lineage fidelity during neural differentiation.
Journal: PLoS genetics
In common: mouse, 5 references
[3] doi:10.1093/bib/bbag096 [code]
scDIAGRAM: detecting chromatin compartments from individual single-cell Hi-C matrix without imputation or reference features.
Journal: Briefings in bioinformatics
In common: mouse, 5 references
[4] doi:10.1038/s41467-026-73325-4 [code]
A scalable Tn5-based method for genome-wide DNA methylation profiling in development and disease.
Journal: Nature communications
In common: reshape2, ggplot2, tidyverse, genetics / omics, 2 references
[5] doi:10.1016/j.stemcr.2026.102930 [code]
ZFHX4 is necessary for dopaminergic neuron differentiation and controls cell cycle by regulating LIN28A.
Journal: Stem cell reports
In common: reshape2, ggplot2, tidyverse, genetics / omics, cellular / molecular, 1 reference
[6] doi:10.1002/imt2.70163 [code]
Spatial multi-omics unveils sphingolipid metabolic reprogramming within the retinal pathological niche.
Journal: iMeta
In common: reshape2, data.table, ggplot2, 1 other tool, genetics / omics, mouse, cellular / molecular
[7] doi:10.1038/s12276-026-01801-4 [code]
Putative glioblastoma origin-like cells in the subventricular zone: isolation and characterization.
Journal: Experimental & molecular medicine
In common: reshape2, data.table, ggplot2, 1 other tool, genetics / omics, mouse, cellular / molecular
[8] doi:10.1371/journal.pcbi.1014573 [code]
Cell-type-specific m1A dynamics are associated with microglial phenotypic transition and neuronal metabolic adaptation during spinal cord injury.
Journal: PLoS computational biology
In common: reshape2, data.table, ggplot2, 1 other tool, genetics / omics, mouse, cellular / molecular
[9] doi:10.1172/jci.insight.207270 [code]
Progressive hypothalamic neuroinflammation in ovariectomized mice parallels aging-related transcriptomic changes in the female human hypothalamus.
Journal: JCI insight
In common: reshape2, data.table, ggplot2, 1 other tool, genetics / omics, mouse, cellular / molecular
[10] doi:10.1186/s13073-026-01704-z [code]
Gene expression profiling enables refined parcellation of cortical layers in the heterogeneous human cerebral cortex.
Journal: Genome medicine
In common: reshape2, data.table, ggplot2, 1 other tool, genetics / omics, mouse, cellular / molecular

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.

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: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

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