annotate 10_adapter_content.Rmd @ 1:92e3de11b9f8 draft

remove fastqc_report.Rmd
author mingchen0919
date Tue, 27 Feb 2018 10:40:20 -0500
parents b7c115edd970
children c64267b9f754
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
1 ---
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
2 output: html_document
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
3 ---
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
4
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
5 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
6 knitr::opts_chunk$set(
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
7 echo = as.logical(opt$X_e),
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
8 error = TRUE,
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
9 eval = TRUE
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
10 )
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
11 ```
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
12
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
13 # Adapter Content
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
14
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
15 ```{r 'Adapter Content', fig.width=10}
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
16 ## reads 1
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
17 ac_1 = extract_data_module(paste0(opt$X_d, '/read_1_fastqc/fastqc_data.txt'), 'Adapter Content')
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
18 ac_1$id = 1:length(ac_1$X.Position)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
19
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
20 melt_ac_1 = melt(ac_1, id=c('X.Position', 'id'))
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
21 melt_ac_1$trim = 'before'
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
22
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
23 ## reads 2
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
24 ac_2 = extract_data_module(paste0(opt$X_d, '/read_2_fastqc/fastqc_data.txt'), 'Adapter Content')
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
25 ac_2$id = 1:length(ac_2$X.Position)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
26
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
27 melt_ac_2 = melt(ac_2, id=c('X.Position', 'id'))
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
28 melt_ac_2$trim = 'after'
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
29
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
30 comb_ac = rbind(melt_ac_1, melt_ac_2)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
31 comb_ac$trim = factor(levels = c('before', 'after'), comb_ac$trim)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
32
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
33 p = ggplot(data = comb_ac, aes(x = id, y = value, color = variable)) +
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
34 geom_line() +
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
35 facet_grid(. ~ trim) +
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
36 xlim(min(comb_ac$id), max(comb_ac$id)) +
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
37 ylim(0, 1) +
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
38 xlab('Position in read (bp)') +
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
39 ylab('')
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
40 ggplotly(p)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
41 ```