2
|
1 ---
|
|
2 title: 'Reads alignment stats'
|
|
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}
|
|
12 knitr::opts_chunk$set(
|
|
13 echo = ECHO,
|
|
14 error = TRUE
|
|
15 )
|
|
16 ```
|
|
17
|
|
18
|
|
19 # Reads alignment stats on `r opt$input_bam_name`
|
|
20
|
|
21 ```{r 'flagstat'}
|
|
22 command = paste0('samtools flagstat ', opt$input_bam, ' > ', paste0(opt$report_dir, '/report.txt'))
|
|
23 system(command)
|
|
24 df = readLines(paste0(opt$report_dir, '/report.txt')) %>%
|
|
25 str_replace('(\\d+\\s+\\+\\s+\\d+)\\s+', '\\1,') %>%
|
|
26 str_split(',') %>%
|
|
27 as.data.frame() %>% t()
|
|
28 rownames(df) = NULL
|
|
29 colnames(df) = c('PASS + FAIL', 'Description')
|
|
30 knitr::kable(df)
|
|
31 ```
|
|
32
|