annotate 01_evaluation_overview.Rmd @ 0:b7c115edd970 draft

planemo upload
author mingchen0919
date Tue, 27 Feb 2018 10:37:12 -0500
parents
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 title: 'Short reads evaluation with [FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/)'
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
3 output:
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
4 html_document:
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
5 number_sections: true
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
6 toc: true
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
7 theme: cosmo
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
8 highlight: tango
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
9 ---
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
10
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
12 knitr::opts_chunk$set(
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
13 echo = as.logical(opt$X_e),
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
14 error = TRUE,
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
15 eval = TRUE
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
16 )
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
17 ```
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
18
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
19 # Run FastQC
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
20
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
21 ```{bash eval=TRUE,echo=FALSE}
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
22 cd ${X_d}
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
23 cp ${X_r} ${X_d}/read_1.fq
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
24 cp ${X_R} ${X_d}/read_2.fq
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
25
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
26 cat >temp.sh <<EOL
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
27 fastqc \\
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
28 -q \\
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
29 -c ${X_c} \\
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
30 -l ${X_l} \\
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
31 ${X_d}/read_1.fq > /dev/null 2>&1
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
32
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
33 fastqc \\
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
34 -q \\
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
35 -c ${X_c} \\
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
36 -l ${X_l} \\
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
37 ${X_d}/read_2.fq > /dev/null 2>&1
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
38 EOL
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
39
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
40 grep -v None temp.sh > fastqc.sh
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
41
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
42 # run fastqc
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
43 sh fastqc.sh
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
44
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
45 # unzip outputs
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
46 unzip -q read_1_fastqc.zip
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
47 unzip -q read_2_fastqc.zip
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
48 ```
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
49
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
50 ```{r}
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
51 # display fastqc job script
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
52 fastqc_sh = paste0(opt$X_d, '/fastqc.sh')
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
53 tags$code(tags$pre(readChar(fastqc_sh, file.info(fastqc_sh)$size )))
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
54 ```
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
55
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
56 # Raw FastQC reports
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
57
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
58 ## Before trimming
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
59 ```{r eval=TRUE}
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
60 ori_html = tags$a(href = 'read_1_fastqc/fastqc_report.html', opt$X_n)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
61 ori_fastqc_data = tags$a(href = 'read_1_fastqc/fastqc_data.txt', 'fastqc_data.txt')
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
62 ori_summary = tags$a(href = 'read_1_fastqc/summary.txt', 'summary.txt')
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
63 tags$ul(
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
64 tags$li(ori_html),
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
65 tags$li(ori_fastqc_data),
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
66 tags$li(ori_summary)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
67 )
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
68 ```
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
69
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
70 ## After trimming
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
71 ```{r eval=TRUE}
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
72 ori_html = tags$a(href = 'read_2_fastqc/fastqc_report.html', opt$X_n)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
73 ori_fastqc_data = tags$a(href = 'read_2_fastqc/fastqc_data.txt', 'fastqc_data.txt')
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
74 ori_summary = tags$a(href = 'read_2_fastqc/summary.txt', 'summary.txt')
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
75 tags$ul(
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
76 tags$li(ori_html),
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
77 tags$li(ori_fastqc_data),
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
78 tags$li(ori_summary)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
79 )
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
80 ```
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
81
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
82
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
83 # Fastqc Output Visualization
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
84
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
85 ## Overview
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
86
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
87 ```{r eval=TRUE}
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
88 read_1_summary = read.csv(paste0(opt$X_d, '/read_1_fastqc/summary.txt'), header = FALSE, sep = '\t')[, 2:1]
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
89 read_2_summary = read.csv(paste0(opt$X_d, '/read_2_fastqc/summary.txt'), header = FALSE, sep = '\t')[, 1]
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
90 combined_summary = cbind(read_1_summary, read_2_summary)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
91 names(combined_summary) = c('MODULE', paste0(opt$X_n, '(before)'), paste0(opt$X_N, '(after)'))
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
92 combined_summary[combined_summary == 'FAIL'] = 'FAIL (X)'
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
93 combined_summary[combined_summary == 'WARN'] = 'WARN (!)'
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
94 knitr::kable(combined_summary)
b7c115edd970 planemo upload
mingchen0919
parents:
diff changeset
95 ```