- Open Access
Efficient digest of high-throughput sequencing data in a reproducible report
BMC Bioinformatics volume 14, Article number: S3 (2013)
High-throughput sequencing (HTS) technologies are spearheading the accelerated development of biomedical research. Processing and summarizing the large amount of data generated by HTS presents a non-trivial challenge to bioinformatics. A commonly adopted standard is to store sequencing reads aligned to a reference genome in SAM (Sequence Alignment/Map) or BAM (Binary Alignment/Map) files. Quality control of SAM/BAM files is a critical checkpoint before downstream analysis. The goal of the current project is to facilitate and standardize this process.
We developed bamchop, a robust program to efficiently summarize key statistical metrics of HTS data stored in BAM files, and to visually present the results in a formatted report. The report documents information about various aspects of HTS data, such as sequencing quality, mapping to a reference genome, sequencing coverage, and base frequency. Bamchop uses the R language and Bioconductor packages to calculate statistical matrices and the Sweave utility and associated LaTeX markup for documentation. Bamchop's efficiency and robustness were tested on BAM files generated by local sequencing facilities and the 1000 Genomes Project. Source code, instruction and example reports of bamchop are freely available from https://github.com/CBMi-BiG/bamchop.
Bamchop enables biomedical researchers to quickly and rigorously evaluate HTS data by providing a convenient synopsis and user-friendly reports.
The development of high-throughput sequencing (HTS) technologies has lead to major biomedical discoveries in recent years [1–3]. The power of these technologies comes from the repeated sequencing of genomic regions of interest, such as exons  and protein binding sites , and requires processing millions of sequencing reads contained within raw data files sized between several hundred megabytes to over twenty-five gigabytes . Reads are typically mapped to a reference genome via specifically designed alignment programs . Mapped read counts are subsequently used for quantitative analysis, such as allele frequency of DNA mutations , abundance of mRNA in a tissue of interest , and frequency of protein-DNA binding .
The large amount of HTS data challenges the development of more efficient, robust, and reproducible data analysis workflows. One of the most successful efforts to standardize HTS workflow was the development of the Sequence Alignment/Map (SAM) format for the storage of aligned sequencing reads, along with a corresponding set of utility programs operating on SAM files . SAM and its more practically utilized binary companion, BAM (Binary Alignment/Map), have been generally accepted as a standard to store and exchange aligned reads by the genomics community, including sequencing facilities and large-scale HTS projects such as the 1000 Genomes  and ENCODE  projects. BAM files can be further sorted and indexed to support random access to reads mapped to any genomic location.
Version 1.4 of the SAM format has eleven mandatory fields that can be classified into two categories. Each of the per read fields represents one aspect of each aligned read with a single value. For example, the "POS" field stores the mapped location of a read within a reference sequence, and the "MAPQ" field corresponds to a score assigned by the alignment program to indicate the confidence of the mapping. Per base fields "SEQ" and "QUAL" respectively record the base calls and sequencing quality scores of all bases in each read. These two fields account for the majority of the size of SAM/BAM files. The "CIGAR" field is a special case. It uses a compact character string to depict the actual base pair alignment. For example, "75M" means there are 75 bases of the read aligned to the reference sequence without gap, whereas "20M1D55M" means there is a single base deletion between the twentieth and twenty-first bases of all 75 bases.
The creation of BAM files is a milestone that typically marks the transition from raw data generation/processing to specific downstream analysis of HTS data. Once provided with the BAM files, researchers often need to evaluate data quality and identify potential issues that might affect downstream analysis. Examples of common questions are whether the sequencing quality and depth are sufficient to support robust quantitative analysis, and which lessons are learned from the current data to optimize future experiments. Close inspection of the BAM files is necessary to address these needs.
Programs systematically evaluating HTS data are available but scarce. FastQC summarizes sequencing quality, nucleic acid bias, and other information about the sequencing reads themselves, but does not provide information related to read alignment and sequencing coverage . RNA-SeQC is used to specifically summarize read count, coverage, and expression correlation of RNA-seq data, but is not applicable to other types of HTS data .
The R programming language provides an ideal platform for summarizing HTS data due to its extensive functionality in scientific computation and data illustration , as well as its support of bioinformatics data analysis through the Bioconductor project . Sweave is a framework that integrates R code within LaTeX documents . Sweave enables the insertion of dynamic content, such as project-specific outputs, in a preformatted template, enabling highly efficient reporting of data analysis results.
To address the need for a more comprehensive evaluation of HTS data, we used the R framework to create an automated assessment method that was implemented in the bamchop program. Bamchop retrieves information from BAM files and reports a series of statistical matrices related to assorted aspect of HTS data.
Hardware and software
Bamchop was developed and tested on a Unix server (Dell R610) with two 6-core Xeon CPUs and 192 GB of RAM using the R environment (version 2.15.0). The software requires several extension R packages (full list available via project website) that are mostly available through the Bioconductor project. For example, the Rsamtools package is an essential element of the program by providing the interface to access BAM files. Bamchop also depends on a TeX installation to generate PDF formatted documents from LaTeX intermediates.
Bamchop has a very simple command line user interface. The program requires only two inputs: a BAM file and an R data object containing information about the reference genome to which the sequencing reads were mapped. Examples of such information are base frequency of each chromosome and exon/intron locations. Bamchop does not require any information about how the BAM file was generated, which makes it applicable to any experimental protocol, sequencing platform, or alignment program. However, bamchop does require the BAM file to be sorted and indexed.
The major components of bamchop include a "main" program, a set of utility functions used to calculate statistics, a set of plotting functions used to generate illustrations, a database of genome-related information, and a Sweave reporting template.
The workflow of a bamchop run is described in Figure 1. First, the scanBam() function implemented by the Rsamtools package loads mapping locations of all reads and all SAM fields of a randomly selected subset of reads from a BAM file. The latter is a necessary compromise to reduce system requirements and runtime (discussed below). An R data object storing the genome metadata will also be loaded. Bamchop includes pre-compiled information related to human and mouse genomes (hg19, hg18 and mm9) that are stored in an internal database, but users can also prepare their own genome/build metadata using a utility function. Once the main program loads the input data into the R environment, it calls a series of utility functions that statistically summarizes various aspects of the HTS data and saves the results in a structured "bamchop" data object. The object is then passed to a Sweave template to generate illustrations in a LaTeX document. This document is then converted to a PDF file as the final step.
The overall architecture of bamchop is straightforward and flexible. The main program and the utility functions are responsible for the generation of statistical matrices by performing most of the computational tasks, while the Sweave template transforms results into a report. These two layers communicate through a single "bamchop" object. This object can be saved and reused when the Sweave template is updated. Furthermore, its contents can be extended to include additional information, such as strand-specific sequencing depth, for downstream analysis without affecting the generation of the report.
The primary output of bamchop is an indexed PDF file with several sections corresponding to assorted aspects of the HTS data. The detailed contents of this report are described in the Results. Optionally, metadata and statistical results generated during the process can be written to the disk for re-use.
Results and discussion
Estimate statistics with random subset of sequencing reads
The large and ever-increasing size of HTS data will be a continuous challenge to any hardware and software. Loading multi-gigabyte BAM files into R environment is a time-consuming task even for powerful server systems. To explore methods of alleviating potential data load bottlenecks, we investigated whether a subset of randomly selected sequencing reads serves as a precise proxy for generating global statistics, especially those based on the per-base SAM fields.
A resampling procedure was performed to randomly select 100 to 1 million aligned reads and import all SAM fields of these reads from a BAM file. A set of summary statistics were compiled from each of these random subsets, such as position-specific sequencing quality, base frequency, insertion size of paired reads, and mapping quality. This procedure was repeated 100 times. The distributions of summary statistics obtained from these repeats are displayed in Figure 2. The results indicate that for random subsets of 105 or more reads, the estimation of global statistics closely approached the true values. For example, the iterated estimates of the average insertion size of paired-end reads ranged between 261.8 and 263.4 bp when 105 random reads were used; whereas the global average of a total of over 300 million reads was 262.6 bp. We concluded that 105 reads are sufficient to precisely and consistently reproduce global statistics. Conversely, mapping locations of all reads are imported from BAM files into bamchop because they are relatively lightweight and required by most downstream analyses. The storage of minimal mapping information (chromosome, position, and strand) takes less than one gigabyte of memory for 100 million reads.
The primary output of each bamchop run is a PDF document composed of the following components:
• Overall landscape of sequencing depth. The first page of the report depicts a graphical index of sequencing depth on a chromosomal basis (Figure 3). The graphic is generated in low resolution to reduce processing time but provides a quick way to identify large genomic regions with atypical sequencing depth.
Summary statistics. This section provides a quick review of single-value global statistics (not shown), such as the total read number of reads and the mean sequencing score.
Read count and sequencing coverage. One of the most frequently asked questions about HTS data is whether the data provides sufficient sequencing depth to support downstream quantitative analysis. This section lists the proportions of the whole genome satisfying a number of pre-configured depth thresholds (Figure 4A), as well as the mean depth of different genomic features (Figure 4B) and chromosomes (not shown).
Sequencing quality. Information about overall sequencing quality is essential for estimating the reliability of sequencing data. Sequencing quality usually decreases as the sequencing extends, so bases close to the end of reads are more error-prone. This section lists the proportions of bases satisfying given thresholds of quality scores (Figure 5A) as well as position-specific distributions of quality scores (Figure 5B).
Reference genome mapping. This section summarizes the "FLAG" field of SAM format (not shown), mapping quality score (Figure 6A) assigned by the alignment program to each read, the frequency of reads with mismatches (Figure 6B), and the extent of duplicated mapping (Figure 6C). If paired-end sequencing is utilized, summary of paired mapping and distribution of insertion size is also reported (Figure 6D).
Base frequency. Bamchop reports both frequency of Ns among all base calls and percentage of reads including any N bases (Figure 7A). Frequency of regular nucleic acid bases in sequencing reads is compared to the background frequency of bases in reference sequences (Figure 7B-C). In addition, frequency of single bases (Figure 7D), di-base combinations (not shown), and k-mers (not shown) at both ends of reads is also summarized to detect sequencing bias or primer contamination.
Alerts. This section lists potential problems indicating low quality or suggesting adjustment of downstream data analysis. For example, an alert will be issued if the overall frequency of uncalled bases is higher than 0.5% or more than 55% of the reads are mapped to one strand.
An example of a complete bamchop report is available as Additional file 1.
Bamchop was validated on a variety of BAM files originated from local targeted resequencing, RNA-Seq, and ChIP-Seq projects and the 1000 Genomes project. These data were generated by different sequencing machines, including Genome Analyzer IIx (Illumina Inc.), 5500 SOLiD (Life Technologies, Corp.) and 454 (Roche Diagnostics Corp.), and aligned by different programs, such as LifeScope (LifeTechnologies, Corp.), Novoalign (Novocraft Technologies), and MAQ .
Part of the test runs was summarized in Table 1. Interestingly, these results showed that the runtime of bamchop had stronger correlation to the total number of mapped reads than to the size of BAM files or to the total number of mapped bases. Indeed, the total number of mapped reads and runtime significantly fit a linear regression model (p = 4X10-6) as shown in Figure 8. Based on this model, every 100 million extra reads in BAM files will take bamchop 10.5 more minutes to run. Therefore, bamchop is a robust and sustainable program that will be capable of handling different types and sizes of BAM files in foreseeable future.
We developed a user-friendly software for biomedical researchers to rapidly and intuitively assess HTS data. The robustness of this software has been validated on BAM files of various sizes and generated by a variety of HTS experimental paradigms and sequencing workflows. Bamchop is being implemented as a core component of a workflow our group has developed for identification of sequence variations in clinical diagnostics and research samples via targeted resequencing technologies. We plan to continuously improve the functionalities of bamchop with new features and faster performance. Specifically, we plan to expand bamchop with individual modules that summarize information related to specific HTS applications, such as RNA-Seq and ChIP-Seq. Additional new functions will also include detailed information about selected genomic regions of interest and comparison of multiple BAM files.
Availability and requirements
Source code repository: https://github.com/CBMi-BiG/bamchop
System requirements: Unix system with at least 32 GB of RAM
Software dependency: R/Bioconductor and LaTeX documentation system
License: free for academic use
Davey JW, Hohenlohe PA, Etter PD, Boone JQ, Catchen JM, Blaxter ML: Genome-wide genetic marker discovery and genotyping using next-generation sequencing. Nat Rev Genet. 2011, 12 (7): 499-510. 10.1038/nrg3012.
Bamshad MJ, Ng SB, Bigham AW, Tabor HK, Emond MJ, Nickerson DA, Shendure J: Exome sequencing as a tool for Mendelian disease gene discovery. Nat Rev Genet. 2011, 12 (11): 745-755. 10.1038/nrg3031.
Chiu RW, Akolekar R, Zheng YW, Leung TY, Sun H, Chan KC, Lun FM, Go AT, Lau ET, To WW: Non-invasive prenatal assessment of trisomy 21 by multiplexed maternal plasma DNA sequencing: large scale validity study. BMJ. 2011, 342: c7401-10.1136/bmj.c7401.
Veltman JA, Brunner HG: De novo mutations in human genetic disease. Nat Rev Genet. 2012, 13 (8): 565-575. 10.1038/nrg3241.
Furey TS: ChIP-seq and beyond: new and improved methodologies to detect and characterize protein-DNA interactions. Nat Rev Genet. 2012
Treangen TJ, Salzberg SL: Repetitive DNA and next-generation sequencing: computational challenges and solutions. Nat Rev Genet. 2012, 13 (1): 36-46.
Ruffalo M, LaFramboise T, Koyutürk M: Comparative analysis of algorithms for next-generation sequencing read alignment. Bioinformatics. 2011, 27 (20): 2790-2796. 10.1093/bioinformatics/btr477.
Kim SY, Lohmueller KE, Albrechtsen A, Li Y, Korneliussen T, Tian G, Grarup N, Jiang T, Andersen G, Witte D: Estimation of allele frequency and association mapping using next-generation sequencing data. BMC Bioinformatics. 2011, 12: 231-10.1186/1471-2105-12-231.
Krupp M, Marquardt JU, Sahin U, Galle PR, Castle J, Teufel A: RNA-Seq Atlas--a reference database for gene expression profiling in normal tissue by next-generation sequencing. Bioinformatics. 2012, 28 (8): 1184-1185. 10.1093/bioinformatics/bts084.
Shi L, Perin JC, Leipzig J, Zhang Z, Sullivan KE: Genome-wide analysis of interferon regulatory factor I binding in primary human monocytes. Gene. 2011, 487 (1): 21-28. 10.1016/j.gene.2011.07.004.
Li H, Handsaker B, Wysoker A, Fennell T, Ruan J, Homer N, Marth G, Abecasis G, Durbin R, Subgroup GPDP: The Sequence Alignment/Map format and SAMtools. Bioinformatics. 2009, 25 (16): 2078-2079. 10.1093/bioinformatics/btp352.
Consortium GP: A map of human genome variation from population-scale sequencing. Nature. 2010, 467 (7319): 1061-1073. 10.1038/nature09534.
Bernstein BE, Birney E, Dunham I, Green ED, Gunter C, Snyder M, Consortium EP: An integrated encyclopedia of DNA elements in the human genome. Nature. 2012, 489 (7414): 57-74. 10.1038/nature11247.
Deluca DS, Levin JZ, Sivachenko A, Fennell T, Nazaire MD, Williams C, Reich M, Winckler W, Getz G: RNA-SeQC: RNA-seq metrics for quality control and process optimization. Bioinformatics. 2012, 28 (11): 1530-1532. 10.1093/bioinformatics/bts196.
Team RC: R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. 2012
Gentleman RC, Carey VJ, Bates DM, Bolstad B, Dettling M, Dudoit S, Ellis B, Gautier L, Ge Y, Gentry J: Bioconductor: open software development for computational biology and bioinformatics. Genome Biol. 2004, 5 (10): R80-10.1186/gb-2004-5-10-r80.
Leisch F: Sweave: Dynamic generation of statistical reports using literate data analysis. Compstat 2002 --- Proceedings in Computational Statistics. Edited by: Rönz WHaB. 2002, Physica Verlag, Heidelberg, 2002: 575-580.
Li H, Ruan J, Durbin R: Mapping short DNA sequencing reads and calling variants using mapping quality scores. Genome Res. 2008, 18 (11): 1851-1858. 10.1101/gr.078212.108.
We thank Drs. Avni Santani, Marni Falk and John Maris for kindly making their HTS data available for the development and testing of bamchop. This project was partially supported by NIH/NICHD grant P30-HD026979.
The publication costs for this article were funded by the David Lawrence Altschuler Chair in Genomics and Computational Biology to Dr. Peter White.
This article has been published as part of BMC Bioinformatics Volume 14 Supplement 11, 2013: Selected articles from The Second Workshop on Data Mining of Next-Generation Sequencing in conjunction with the 2012 IEEE International Conference on Bioinformatics and Biomedicine. The full contents of the supplement are available online at http://www.biomedcentral.com/bmcbioinformatics/supplements/14/S11.
The authors declare that they have no competing interests.
ZZ designed and programmed the software, and drafted the manuscript. JL and PSW revised the manuscript. PSW oversaw the project. JL provided the original Sweave template and support to developing environment. AMY tested the program. Other co-authors participated in designing and testing the program.
Electronic supplementary material
About this article
Cite this article
Zhang, Z., Leipzig, J., Sasson, A. et al. Efficient digest of high-throughput sequencing data in a reproducible report. BMC Bioinformatics 14, S3 (2013). https://doi.org/10.1186/1471-2105-14-S11-S3
- Read Count
- Sequencing Depth
- Sequencing Quality
- Alignment Program
- Bioconductor Project