comparison rmarkdown_samtools_flagstat.Rmd @ 2:77e8e7bc5b44 draft

update
author mingchen0919
date Wed, 27 Dec 2017 15:19:43 -0500
parents
children
comparison
equal deleted inserted replaced
1:c5c626653593 2:77e8e7bc5b44
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