Mercurial > repos > mingchen0919 > aurora_fastqc_site
annotate 01_evaluation_overview.Rmd @ 2:c64267b9f754 draft default tip
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
author | mingchen0919 |
---|---|
date | Sun, 30 Dec 2018 12:48:14 -0500 |
parents | b7c115edd970 |
children |
rev | line source |
---|---|
0 | 1 --- |
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 | |
9 --- | |
10 | |
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} | |
2
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
12 knitr::opts_knit$set(progress = FALSE) |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
13 knitr::opts_chunk$set(error = TRUE, echo = FALSE) |
0 | 14 ``` |
15 | |
16 # Run FastQC | |
17 | |
2
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
18 ```{bash} |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
19 sh ${TOOL_INSTALL_DIR}/build-and-run-job-scripts.sh |
0 | 20 ``` |
21 | |
2
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
22 ```{r echo=FALSE,results='asis'} |
0 | 23 # display fastqc job script |
2
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
24 cat('```bash\n') |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
25 cat(readLines(paste0(Sys.getenv('REPORT_FILES_PATH'), '/job-1-script.sh')), sep = '\n') |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
26 cat('\n```') |
0 | 27 ``` |
28 | |
29 # Fastqc Output Visualization | |
30 | |
31 ## Overview | |
32 | |
33 ```{r eval=TRUE} | |
2
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
34 read_1_summary = read.csv(paste0(opt$X_d, '/read_1_fastqc/summary.txt'), |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
35 stringsAsFactors = FALSE, |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
36 header = FALSE, sep = '\t')[, 2:1] |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
37 read_2_summary = read.csv(paste0(opt$X_d, '/read_2_fastqc/summary.txt'), |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
38 stringsAsFactors = FALSE, |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
39 header = FALSE, sep = '\t')[, 1] |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
40 combined_summary = data.frame(read_1_summary, read_2_summary, stringsAsFactors = FALSE) |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
41 names(combined_summary) = c('MODULE', 'Pre-trimming', 'Post-trimming') |
0 | 42 combined_summary[combined_summary == 'FAIL'] = 'FAIL (X)' |
43 combined_summary[combined_summary == 'WARN'] = 'WARN (!)' | |
44 knitr::kable(combined_summary) | |
45 ``` | |
2
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
46 |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
47 ```{r 'function definition', echo=FALSE} |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
48 extract_data_module = function(fastqc_data, module_name, header = TRUE, comment.char = "") { |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
49 f = readLines(fastqc_data) |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
50 start_line = grep(module_name, f) |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
51 end_module_lines = grep('END_MODULE', f) |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
52 end_line = end_module_lines[which(end_module_lines > start_line)[1]] |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
53 module_data = f[(start_line+1):(end_line-1)] |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
54 writeLines(module_data, '/tmp/temp.txt') |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
55 read.csv('/tmp/temp.txt', sep = '\t', header = header, comment.char = comment.char) |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
56 } |
c64267b9f754
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
mingchen0919
parents:
0
diff
changeset
|
57 ``` |