annotate 10_adapter_content.Rmd @ 13:6faa68239cd7 draft

remove unnecessary dependencies
author mingchen0919
date Thu, 09 Nov 2017 09:25:14 -0500
parents 507eec497730
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
1 ---
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
2 title: 'Adapter Content'
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
3 output:
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
4 html_document:
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
5 number_sections: true
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
6 toc: true
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
7 theme: cosmo
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
8 highlight: tango
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
9 ---
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
10
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
12 knitr::opts_chunk$set(
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
13 echo = ECHO,
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
14 error = TRUE
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
15 )
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
16 ```
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
17
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
18 ### Adapter Content
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
19
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
20 ```{r 'Adapter Content', fig.width=10}
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
21 ## reads 1
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
22 ac_1 = extract_data_module('REPORT_DIR/reads_1_fastqc_data.txt', 'Adapter Content')
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
23 ac_1$id = 1:length(ac_1$X.Position)
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
24
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
25 melt_ac_1 = melt(ac_1, id=c('X.Position', 'id'))
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
26 melt_ac_1$trim = 'before'
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
27
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
28 ## reads 2
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
29 ac_2 = extract_data_module('REPORT_DIR/reads_2_fastqc_data.txt', 'Adapter Content')
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
30 ac_2$id = 1:length(ac_2$X.Position)
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
31
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
32 melt_ac_2 = melt(ac_2, id=c('X.Position', 'id'))
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
33 melt_ac_2$trim = 'after'
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
34
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
35 comb_ac = rbind(melt_ac_1, melt_ac_2)
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
36 comb_ac$trim = factor(levels = c('before', 'after'), comb_ac$trim)
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
37
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
38 p = ggplot(data = comb_ac, aes(x = id, y = value, color = variable)) +
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
39 geom_line() +
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
40 facet_grid(. ~ trim) +
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
41 xlim(min(comb_ac$id), max(comb_ac$id)) +
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
42 ylim(0, 1) +
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
43 xlab('Position in read (bp)') +
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
44 ylab('')
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
45 ggplotly(p)
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
46 ```