Mercurial > repos > mingchen0919 > rmarkdown_fastqc_site
annotate 01_evaluation_overview.Rmd @ 12:68ea2ebbf866 draft
add boxplot for per base sequence quality
author | mingchen0919 |
---|---|
date | Thu, 09 Nov 2017 09:23:43 -0500 |
parents | 507eec497730 |
children |
rev | line source |
---|---|
0
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
1 --- |
11 | 2 title: 'Short reads evaluation with [FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/)' |
3 output: | |
4 html_document: | |
5 number_sections: true | |
6 toc: true | |
7 theme: cosmo | |
8 highlight: tango | |
0
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
9 --- |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
10 |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} |
11 | 12 knitr::opts_chunk$set( |
13 echo = ECHO, | |
14 error = TRUE | |
15 ) | |
0
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
16 ``` |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
17 |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
18 |
11 | 19 # Fastqc Evaluation |
20 | |
21 ## Evaluation of reads before trimming | |
0
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
22 |
11 | 23 ```{r} |
24 if ('READS_1' == 'None') { | |
25 stop("No pre-trimming reads provided!") | |
26 } else { | |
27 ## run fastqc evaluation | |
28 fastqc_command = paste0('fastqc ') %>% | |
29 (function(x) { | |
30 ifelse('CONTAMINANTS' != 'None', paste0(x, '-c CONTAMINANTS '), x) | |
31 }) %>% | |
32 (function(x) { | |
33 ifelse('LIMITS' != 'None', paste0(x, '-l LIMITS '), x) | |
34 }) %>% | |
35 (function(x) { | |
36 paste0(x, '-o REPORT_DIR ') | |
37 }) | |
38 fastqc_command_reads_1 = paste0(fastqc_command, 'READS_1 > /dev/null 2>&1') | |
39 system(fastqc_command_reads_1, intern = TRUE) | |
40 | |
41 # Original html report | |
42 reads_1_base = tail(strsplit('READS_1', '/')[[1]], 1) | |
43 original_html = tags$a(href=paste0(reads_1_base, '_fastqc.html'), paste0('HTML report: ', opt$name_1)) | |
44 | |
45 unzip(paste0('REPORT_DIR/', reads_1_base, '_fastqc.zip'), exdir = 'REPORT_DIR') | |
46 reads_1_unzip = paste0('REPORT_DIR/', reads_1_base, '_fastqc/') | |
47 # fastqc_data.txt | |
48 file.copy(paste0(reads_1_unzip, 'fastqc_data.txt'), 'REPORT_DIR/reads_1_fastqc_data.txt') | |
49 fastqc_data = tags$a(href='reads_1_fastqc_data.txt', paste0('fastqc_data.txt: ', opt$name_1)) | |
50 # summary.txt | |
51 file.copy(paste0(reads_1_unzip, 'summary.txt'), 'REPORT_DIR/reads_1_summary.txt') | |
52 summary_data = tags$a(href='reads_1_summary.txt', paste0('summary.txt: ', opt$name_1)) | |
53 | |
54 tags$ul( | |
55 tags$li(original_html), | |
56 tags$li(fastqc_data), | |
57 tags$li(summary_data) | |
58 ) | |
0
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
59 } |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
60 ``` |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
61 |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
62 |
11 | 63 ## Evaluation of reads after trimming |
64 | |
0
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
65 ```{r} |
11 | 66 if ('READS_2' == 'None') { |
67 stop("No pre-trimming reads provided!") | |
68 } else { | |
69 ## run fastqc evaluation | |
70 fastqc_command = paste0('fastqc ') %>% | |
71 (function(x) { | |
72 ifelse('CONTAMINANTS' != 'None', paste0(x, '-c CONTAMINANTS '), x) | |
73 }) %>% | |
74 (function(x) { | |
75 ifelse('LIMITS' != 'None', paste0(x, '-l LIMITS '), x) | |
76 }) %>% | |
77 (function(x) { | |
78 paste0(x, '-o REPORT_DIR ') | |
79 }) | |
80 fastqc_command_reads_2 = paste0(fastqc_command, 'READS_2 > /dev/null 2>&1') | |
81 system(fastqc_command_reads_2, intern = TRUE) | |
82 | |
83 # Original html report | |
84 reads_2_base = tail(strsplit('READS_2', '/')[[1]], 1) | |
85 original_html = tags$a(href=paste0(reads_2_base, '_fastqc.html'), paste0('HTML report: ', opt$name_2)) | |
86 | |
87 unzip(paste0('REPORT_DIR/', reads_2_base, '_fastqc.zip'), exdir = 'REPORT_DIR') | |
88 reads_2_unzip = paste0('REPORT_DIR/', reads_2_base, '_fastqc/') | |
89 # fastqc_data.txt | |
90 file.copy(paste0(reads_2_unzip, 'fastqc_data.txt'), 'REPORT_DIR/reads_2_fastqc_data.txt') | |
91 fastqc_data = tags$a(href='reads_2_fastqc_data.txt', paste0('fastqc_data.txt: ', opt$name_2)) | |
92 # summary.txt | |
93 file.copy(paste0(reads_2_unzip, 'summary.txt'), 'REPORT_DIR/reads_2_summary.txt') | |
94 summary_data = tags$a(href='reads_2_summary.txt', paste0('summary.txt: ', opt$name_2)) | |
95 | |
96 tags$ul( | |
97 tags$li(original_html), | |
98 tags$li(fastqc_data), | |
99 tags$li(summary_data) | |
100 ) | |
0
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
101 } |
11 | 102 ``` |
0
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
103 |
11 | 104 |
105 | |
106 # Fastqc output visualization | |
107 | |
108 ## Overview | |
109 | |
110 ```{r} | |
111 reads_1_summary = read.csv('REPORT_DIR/reads_1_summary.txt', header = FALSE, sep = '\t')[, 2:1] | |
112 reads_2_summary = read.csv('REPORT_DIR/reads_2_summary.txt', header = FALSE, sep = '\t')[, 1] | |
113 combined_summary = cbind(reads_1_summary, reads_2_summary) | |
114 names(combined_summary) = c('MODULE', paste0(opt$name_1, '(before)'), paste0(opt$name_2, '(after)')) | |
115 combined_summary[combined_summary == 'FAIL'] = 'FAIL (X)' | |
116 combined_summary[combined_summary == 'WARN'] = 'WARN (!)' | |
117 knitr::kable(combined_summary) | |
118 ``` | |
119 | |
120 # Session Info | |
121 | |
122 ```{r 'session info'} | |
123 sessionInfo() | |
0
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
124 ``` |