Mercurial > repos > mingchen0919 > rmarkdown_samtools_flagstat
view rmarkdown_samtools_flagstat.Rmd @ 5:2a244f3c48a9 draft default tip
updates
author | mingchen0919 |
---|---|
date | Sun, 31 Dec 2017 16:11:49 -0500 |
parents | 77e8e7bc5b44 |
children |
line wrap: on
line source
--- title: 'Reads alignment stats' output: html_document: number_sections: true toc: true theme: cosmo highlight: tango --- ```{r setup, include=FALSE, warning=FALSE, message=FALSE} knitr::opts_chunk$set( echo = ECHO, error = TRUE ) ``` # Reads alignment stats on `r opt$input_bam_name` ```{r 'flagstat'} command = paste0('samtools flagstat ', opt$input_bam, ' > ', paste0(opt$report_dir, '/report.txt')) system(command) df = readLines(paste0(opt$report_dir, '/report.txt')) %>% str_replace('(\\d+\\s+\\+\\s+\\d+)\\s+', '\\1,') %>% str_split(',') %>% as.data.frame() %>% t() rownames(df) = NULL colnames(df) = c('PASS + FAIL', 'Description') knitr::kable(df) ```