annotate 03_per_tile_sequence_quality.Rmd @ 11:507eec497730 draft

update fastqc site
author mingchen0919
date Tue, 07 Nov 2017 16:52:24 -0500
parents
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: 'Per Tile Sequence Quality'
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 ### Per tile sequence quality
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
19
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
20 ```{r 'per tile sequence quality', fig.width=10}
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
21 ## check if 'per tile sequence quality' module exits or not
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
22 check_ptsq = grep('Per tile sequence quality', readLines('REPORT_DIR/reads_1_fastqc_data.txt'))
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
23 if (length(check_ptsq) > 0) {
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
24 ## reads 1
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
25 ptsq_1 = extract_data_module('REPORT_DIR/reads_1_fastqc_data.txt', 'Per tile sequence quality')
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
26 ptsq_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 ptsq_2 = extract_data_module('REPORT_DIR/reads_2_fastqc_data.txt', 'Per tile sequence quality')
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
30 ptsq_2$trim = 'after'
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
31
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
32 comb_ptsq = rbind(ptsq_1, ptsq_2)
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
33 comb_ptsq$trim = factor(levels = c('before', 'after'), comb_ptsq$trim)
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
34 comb_ptsq$Base = factor(levels = unique(comb_ptsq$Base), comb_ptsq$Base)
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
35
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
36 # convert integers to charaters
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
37 comb_ptsq$Tile = as.character(comb_ptsq$X.Tile)
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
38
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
39 p = ggplot(data = comb_ptsq, aes(x = Base, y = Tile, fill = Mean)) +
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
40 geom_raster() +
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
41 facet_grid(. ~ trim) +
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
42 xlab('Position in read (bp)') +
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
43 ylab('') +
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
44 theme(axis.text.x = element_text(angle=45))
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
45 ggplotly(p)
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
46 } else {
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
47 print('No "per tile sequence quality" data')
507eec497730 update fastqc site
mingchen0919
parents:
diff changeset
48 }