Mercurial > repos > mingchen0919 > aurora_fastqc_site
annotate 03_per_tile_sequence_quality.Rmd @ 8:94762f1cb779 draft
planemo upload commit 76f9ca75d5b1c0c0fad6c10876d9dfeba7d5ecff-dirty
| author | mingchen0919 |
|---|---|
| date | Mon, 30 Apr 2018 16:15:39 -0400 |
| parents | b9c9d1dacda6 |
| children |
| rev | line source |
|---|---|
| 1 | 1 --- |
| 2 output: html_document | |
| 3 --- | |
| 4 | |
| 5 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} | |
|
8
94762f1cb779
planemo upload commit 76f9ca75d5b1c0c0fad6c10876d9dfeba7d5ecff-dirty
mingchen0919
parents:
3
diff
changeset
|
6 knitr::opts_knit$set(progress = FALSE) |
|
94762f1cb779
planemo upload commit 76f9ca75d5b1c0c0fad6c10876d9dfeba7d5ecff-dirty
mingchen0919
parents:
3
diff
changeset
|
7 knitr::opts_chunk$set(error = TRUE, echo = FALSE) |
| 1 | 8 ``` |
| 9 | |
| 3 | 10 ### Per tile sequence quality |
| 1 | 11 |
| 12 ```{r 'per tile sequence quality', fig.width=10} | |
| 13 ## check if 'per tile sequence quality' module exits or not | |
| 14 check_ptsq = grep('Per tile sequence quality', readLines(paste0(opt$X_d, '/read_1_fastqc/fastqc_data.txt'))) | |
| 15 if (length(check_ptsq) > 0) { | |
| 16 ## reads 1 | |
| 17 ptsq_1 = extract_data_module(paste0(opt$X_d, '/read_1_fastqc/fastqc_data.txt'), 'Per tile sequence quality') | |
| 18 ptsq_1$trim = 'before' | |
| 19 | |
| 20 ## reads 2 | |
| 21 ptsq_2 = extract_data_module(paste0(opt$X_d, '/read_2_fastqc/fastqc_data.txt'), 'Per tile sequence quality') | |
| 22 ptsq_2$trim = 'after' | |
| 23 | |
| 24 comb_ptsq = rbind(ptsq_1, ptsq_2) | |
| 25 comb_ptsq$trim = factor(levels = c('before', 'after'), comb_ptsq$trim) | |
| 26 comb_ptsq$Base = factor(levels = unique(comb_ptsq$Base), comb_ptsq$Base) | |
| 27 | |
| 28 # convert integers to charaters | |
| 3 | 29 # comb_ptsq$Tile = as.character(comb_ptsq$X.Tile) |
| 1 | 30 |
| 3 | 31 p = ggplot(data = comb_ptsq) + |
| 32 geom_raster(mapping = aes(x = Base, y = X.Tile, fill = Mean)) + | |
| 1 | 33 facet_grid(. ~ trim) + |
| 3 | 34 scale_x_discrete(name = "Position in read (bp)") + |
| 35 scale_y_continuous(name = "") + | |
| 36 scale_fill_gradient(low = "blue", high = "red") + | |
| 37 theme(axis.text.x = element_text(size = 5, angle = 90), | |
| 38 axis.text.y = element_text(size = 5), | |
| 39 panel.background = element_rect(fill = NA)) | |
| 1 | 40 ggplotly(p) |
| 41 } else { | |
| 42 print('No "per tile sequence quality" data') | |
| 43 } | |
| 3 | 44 ``` |
