2
|
1 ---
|
14
|
2 title: 'HTML report title'
|
|
3 output:
|
|
4 html_document:
|
|
5 number_sections: true
|
|
6 toc: true
|
|
7 theme: cosmo
|
|
8 highlight: tango
|
2
|
9 ---
|
|
10
|
14
|
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
|
|
12 knitr::opts_chunk$set(
|
|
13 echo = ECHO
|
|
14 )
|
2
|
15 ```
|
|
16
|
|
17
|
14
|
18 # Fastqc Analysis
|
2
|
19
|
14
|
20 * Copy fastq files to job working directory
|
|
21
|
|
22 ```{bash 'copy files'}
|
2
|
23 for f in $(echo READS | sed "s/,/ /g")
|
|
24 do
|
|
25 cp $f ./
|
|
26 done
|
|
27 ```
|
|
28
|
14
|
29 * Run fastqc
|
2
|
30
|
14
|
31 ```{bash 'run fastqc'}
|
2
|
32 for r in $(ls *.dat)
|
|
33 do
|
14
|
34 fastqc -o REPORT_DIR $r > /dev/null 2>&1
|
2
|
35 done
|
|
36 ```
|
|
37
|
14
|
38 * Create links to original HTML reports
|
2
|
39
|
|
40 ```{r 'html report links'}
|
|
41 html_report_list = list()
|
14
|
42 html_files = list.files('REPORT_DIR', pattern = '.*html')
|
2
|
43 for (i in html_files) {
|
|
44 html_report_list[[i]] = tags$li(tags$a(href=i, i))
|
|
45 }
|
|
46 tags$ul(html_report_list)
|
|
47 ```
|
|
48
|
14
|
49 # Fastqc output summary
|
2
|
50
|
14
|
51 * Define a function to extract outputs for each module from fastqc output
|
2
|
52
|
14
|
53 ```{r 'function definition'}
|
|
54 extract_data_module = function(fastqc_data, module_name) {
|
|
55 f = readLines(fastqc_data)
|
|
56 start_line = grep(module_name, f)
|
|
57 end_module_lines = grep('END_MODULE', f)
|
|
58 end_line = end_module_lines[which(end_module_lines > start_line)[1]]
|
|
59 module_data = f[(start_line+1):(end_line-1)]
|
|
60 writeLines(module_data, 'temp.txt')
|
|
61 read.csv('temp.txt', sep = '\t')
|
2
|
62 }
|
|
63 ```
|
|
64
|
14
|
65 ##
|
2
|
66
|
14
|
67 # Session Info
|
2
|
68
|
14
|
69 ```{r 'session info'}
|
|
70 sessionInfo()
|
2
|
71 ```
|
|
72
|