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