Mercurial > repos > mingchen0919 > rmarkdown_fastqc_site
comparison 09_sequence_duplication_levels.Rmd @ 11:507eec497730 draft
update fastqc site
| author | mingchen0919 |
|---|---|
| date | Tue, 07 Nov 2017 16:52:24 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 10:600c39b11913 | 11:507eec497730 |
|---|---|
| 1 --- | |
| 2 title: 'Sequence Duplication Levels' | |
| 3 output: | |
| 4 html_document: | |
| 5 number_sections: true | |
| 6 toc: true | |
| 7 theme: cosmo | |
| 8 highlight: tango | |
| 9 --- | |
| 10 | |
| 11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} | |
| 12 knitr::opts_chunk$set( | |
| 13 echo = ECHO, | |
| 14 error = TRUE | |
| 15 ) | |
| 16 ``` | |
| 17 | |
| 18 ### Sequence Duplication Levels | |
| 19 | |
| 20 ```{r 'Sequence Duplication Levels', fig.width=10} | |
| 21 ## reads 1 | |
| 22 sdl_1 = extract_data_module('REPORT_DIR/reads_1_fastqc_data.txt', 'Sequence Duplication Levels', header = FALSE, comment.char = '#') | |
| 23 names(sdl_1) = c('Duplication_Level', 'Percentage_of_deduplicated', 'Percentage_of_total') | |
| 24 sdl_1$id = 1:length(sdl_1$Duplication_Level) | |
| 25 | |
| 26 melt_sdl_1 = melt(sdl_1, id=c('Duplication_Level', 'id')) | |
| 27 melt_sdl_1$trim = 'before' | |
| 28 | |
| 29 | |
| 30 ## reads 2 | |
| 31 sdl_2 = extract_data_module('REPORT_DIR/reads_2_fastqc_data.txt', 'Sequence Duplication Levels', header = FALSE, comment.char = '#') | |
| 32 names(sdl_2) = c('Duplication_Level', 'Percentage_of_deduplicated', 'Percentage_of_total') | |
| 33 sdl_2$id = 1:length(sdl_2$Duplication_Level) | |
| 34 | |
| 35 melt_sdl_2 = melt(sdl_2, id=c('Duplication_Level', 'id')) | |
| 36 melt_sdl_2$trim = 'after' | |
| 37 | |
| 38 comb_sdl = rbind(melt_sdl_1, melt_sdl_2) | |
| 39 comb_sdl$trim = factor(levels = c('before', 'after'), comb_sdl$trim) | |
| 40 | |
| 41 p = ggplot(data = comb_sdl, aes(x = id, y = value, color = variable)) + | |
| 42 geom_line() + | |
| 43 scale_x_continuous(breaks = sdl_2$id, labels = sdl_2$Duplication_Level) + | |
| 44 facet_grid(. ~ trim) + | |
| 45 xlab('Sequence Duplication Level') + | |
| 46 ylab('') + | |
| 47 theme(axis.text.x = element_text(angle=45)) | |
| 48 ggplotly(p) | |
| 49 ``` |
