-
Notifications
You must be signed in to change notification settings - Fork 5
/
figure_4_a_max_example.Rmd
70 lines (51 loc) · 2 KB
/
figure_4_a_max_example.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
``` {r setup, echo=FALSE, message=FALSE, include=FALSE, error=FALSE}
library(xtable)
library(Gviz)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
library(TxDb.Dmelanogaster.UCSC.dm3.ensGene)
library(BSgenome.Dmelanogaster.UCSC.dm3)
library(rtracklayer)
options(knitr.figure_dir = "figure_4_a_max_example_output")
source("shared_code/knitr_common.r")
source("shared_code/samples.r")
source("shared_code/granges_common.r")
source("shared_code/gviz_common.r")
```
# Figure 4A: Max example region
``` {r header_child, child="child_docs/header_child.Rmd"}
```
## Overview
Examples of Max binding at a single region
``` {r load_standard_chip_data, include=FALSE}
max.bw <- data_path("bigwigs/dmel_s2_max_chipseq_01.bw")
```
``` {r ebox_motifs, include=FALSE}
ebox.gr <- cache("ebox.gr.rds", function() {
ebox.gr <- vmatchPattern("CANNTG", Dmelanogaster, max.mismatch=0, fixed=FALSE)
ebox.gr <- ebox.gr[strand(ebox.gr) == "+"]
mcols(ebox.gr)$feature <- "EBOX"
mcols(ebox.gr)$id <- substr(as.character(getSeq(Dmelanogaster, ebox.gr)), 3, 4)
ebox.gr
})
```
``` {r regions_table, results="asis"}
regions.df <- subset(read.csv("internal_data/example_regions.csv", stringsAsFactors=FALSE), figure == "5")
regions.gr <- with(regions.df, GRanges(ranges=IRanges(start=start, end=end),
seqnames=chr, name=name, factor=factor))
html_table(regions.df)
```
``` {r set_common_figure_options, include=FALSE}
knitr::opts_chunk$set(dev=c("png", "pdf"), fig.cap="", fig.width=9, fig.height=9)
```
## Max (Drosophila S2 cells)
``` {r max_examples, dev=c("png", "pdf"), fig.cap="", fig.width=9, fig.height=8, dpi=300}
max.gr <- subset(regions.gr, factor == "max")
max.nexus <- get_sample_cl("dmel_s2_max_chipnexus_01")
for(i in 1:length(max.gr)) {
max.i <- gviz_plot_no_exo(genome="dm3", max.gr[i], max.bw, max.nexus,
title=paste0("Max: ", mcols(max.gr)$name[i]),
motifs=ebox.gr)
}
```
``` {r session_info_child, child="child_docs/session_info_child.Rmd"}
```