annotate 03_per_tile_sequence_quality.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 # Per tile sequence quality
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
14
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
15 ```{r 'per tile sequence quality', fig.width=10}
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
16 ## check if 'per tile sequence quality' module exits or not
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
17 check_ptsq = grep('Per tile sequence quality', readLines(paste0(opt$X_d, '/read_1_fastqc/fastqc_data.txt')))
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
18 if (length(check_ptsq) > 0) {
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
19 ## reads 1
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
20 ptsq_1 = extract_data_module(paste0(opt$X_d, '/read_1_fastqc/fastqc_data.txt'), 'Per tile sequence quality')
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
21 ptsq_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 ptsq_2 = extract_data_module(paste0(opt$X_d, '/read_2_fastqc/fastqc_data.txt'), 'Per tile sequence quality')
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
25 ptsq_2$trim = 'after'
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
26
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
27 comb_ptsq = rbind(ptsq_1, ptsq_2)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
28 comb_ptsq$trim = factor(levels = c('before', 'after'), comb_ptsq$trim)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
29 comb_ptsq$Base = factor(levels = unique(comb_ptsq$Base), comb_ptsq$Base)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
30
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
31 # convert integers to charaters
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
32 comb_ptsq$Tile = as.character(comb_ptsq$X.Tile)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
33
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
34 p = ggplot(data = comb_ptsq, aes(x = Base, y = Tile, fill = Mean)) +
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
35 geom_raster() +
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
36 facet_grid(. ~ trim) +
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
37 xlab('Position in read (bp)') +
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
38 ylab('') +
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
39 theme(axis.text.x = element_text(angle=45))
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
40 ggplotly(p)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
41 } else {
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
42 print('No "per tile sequence quality" data')
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
43 }
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
44 ```