Rqc is an optimized tool designed for quality control and assessment of high-throughput sequencing data. It performs parallel processing of entire files and produces a report which contains a set of high-resolution graphics that can be used for quality assessment.

This version of Rqc produces high-quality images for the following statistics:

Basic Workflow

The main goal of Rqc is to provide graphical tools for quality assessment of reads contained in FASTQ files. This package is designed focusing on simplicity of use. Therefore, the Rqc package allows the user to call one single function called rqc. The rqc method processes a set of input files and generates an HTML report containing several plots that can be used for quality assessment.

To access this functionality, the user needs to load Rqc package.

library(Rqc)

The next step is to determine the location of the FASTQ files that should be analyzed. The example below, uses sample files provided by the ShortRead package, but the user must modify this location accordingly, in order to reflect the actual location of the files that need QA.

folder <- system.file(package="ShortRead", "extdata/E-MTAB-1147")

The basic usage of the rqc function requires the definition of 2 arguments. One, path, is the location where the files of interest are saved at (this was defined on the step above). The other argument, pattern, is a regular expression that identifies all files of interest. Below, we use .fastq.gz to specify that all files containing that string are to be processed.

rqc(path = folder, pattern = ".fastq.gz")

At this point, the user’s default Internet browser will open an HTML file. This file is the report generated by Rqc, which, by default, is stored in a temporary directory. A sample report is shown below:


Rqc 1.0.4 - Quality Control Report

Average Quality

This plot describes the average quality pattern by showing on the X-axis quality thresholds and on the Y-axis the percentage of reads that exceed that quality level.

rqcReadQualityPlot(rqcResultSet)

Cycle-specific Average Quality

This describes the average quality scores for each cycle of sequencing.

rqcCycleAverageQualityPlot(rqcResultSet)

Read Length Distribution

Barplot that presents the distribuition of the lengths of the reads available in the FASTQ file.

rqcReadWidthPlot(rqcResultSet)

Cycle-specific GC Content

Line plot showing the average GC content for every cycle of sequencing.

rqcCycleGCPlot(rqcResultSet)

Cycle-specific Quality Distribution

Bar plot showing the proportion of quality calls per cycle. Colors are presented in a gradient Red-Blue, where red identifies calls of lower quality. This visualization is preferred as it is cleaner than the boxplots described below.

rqcCycleQualityPlot(rqcResultSet)

Cycle-specific Quality Distribution - Boxplot

Boxplots describing empirical patterns of quality distribution on each cycle of sequencing.

rqcCycleQualityBoxPlot(rqcResultSet)

Cycle-specific Base Call Proportion

This bar plot describes the proportion of each nucleotide called for every cycle of sequencing.

rqcCycleBaseCallsPlot(rqcResultSet)

The line plot shows a more detailed view.

rqcCycleBaseCallsLinePlot(rqcResultSet)


It is important to note that the rqc function samples 1 million records from the FASTQ files. This can be set by adjusting the n argument for this function. If the user desires to have the file processed as a whole (rather than sampling records from it), (s)he must set the argument sample to FALSE.

Advanced Workflow

The rqc function wraps a set of functions to generate a quick report that can be used for quality assessment. However, users can perform a step-by-step analysis by using the information described below.

1. Defining input files

If one wants to process a set of files that are not located at the same directory, the users needs to create a vector containing the absolute path of files. The list.files function can be useful.

fastqDir <- system.file(package="ShortRead", "extdata/E-MTAB-1147")
files <- list.files(fastqDir, "fastq.gz", full.names=TRUE)

The example input files are samples from a public data set. These samples are available through the ShortRead package. More information regarding these data can be found on the vignette of that package.

2. Processing files

To process the files without generating an HTML report, the user should use rqcQA function instead rqc. This function receives a vector containing the paths of the input files.

rqcResultSet <- rqcQA(files = files)

The rqcQA function returns a list that contains the required information to create the plots present on the standard HTML report. Actually, both rqc and rqcQA return a named list of RqcResultSet objects. This output can be used directly as input to other Rqc package functions. Examples of functions that can use these objects are rqcReport and plot. RqcResultSet is a class that extends .QA class of ShortRead package. An RqcResultSet object contains information in two different perspectives: read-specific data and cycle-specific data. They can be accessed using [[ brackets.

3. Generating report

To create a final HTML report, the user can apply the rqcReport function to the rqcResultSet object.

reportFile <- rqcReport(rqcResultSet)
browseURL(reportFile)

The report generated by rqcReport contains the all plots described on the beginning of this document. By default, it is written to a temporary directory. This behavior can by modified by setting the outdir argument.

Parallel processing

The Rqc package performs parallel processing of the samples by interfacing with the BiocParallel package. By default, BiocParallel loads MulticoreParam with the maximum number of workers available. At this point, Rqc supports only MulticoreParam for parallel processing. It is possible to process the input files serially throught the use of the SerialParam function.

Graphics

For each plot generated by Rqc, there is a function that shapes the data appropriately. The shaped information is then used to produce the final plot. The example below shows how the user can access these data to generate plots using other tools.

df <- rqcCycleAverageQualityCalc(rqcResultSet)
plot(df$cycle, df$quality, col = df$filename, xlab='Cycle', ylab='Quality Score')

One can also process a subset of result data using subsets of a list.

sublist <- rqcResultSet[1]
rqcCycleQualityPlot(sublist)

Final Considerations

The Rqc package provides a simple interface to generate plots often used for quality assessment of high-throughput sequencing data. It uses the standard Bioconductor parallelization framework to add efficiency to data processing. The images produced by the package are high-quality figures that can be directly used on publications.

Session Information

sessionInfo()
## R version 3.1.1 Patched (2014-09-25 r66681)
## Platform: x86_64-unknown-linux-gnu (64-bit)
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats4    parallel  stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] Rqc_1.0.4               ggplot2_1.0.0          
##  [3] ShortRead_1.24.0        GenomicAlignments_1.2.0
##  [5] Rsamtools_1.18.0        GenomicRanges_1.18.1   
##  [7] GenomeInfoDb_1.2.0      Biostrings_2.34.0      
##  [9] XVector_0.6.0           IRanges_2.0.0          
## [11] S4Vectors_0.4.0         BiocGenerics_0.12.0    
## [13] BiocParallel_1.0.0      BiocStyle_1.4.1        
## 
## loaded via a namespace (and not attached):
##  [1] BBmisc_1.7          BatchJobs_1.4       Biobase_2.26.0     
##  [4] DBI_0.3.1           MASS_7.3-35         RColorBrewer_1.0-5 
##  [7] RSQLite_0.11.4      Rcpp_0.11.3         base64enc_0.1-2    
## [10] bitops_1.0-6        brew_1.0-6          checkmate_1.4      
## [13] codetools_0.2-9     colorspace_1.2-4    digest_0.6.4       
## [16] evaluate_0.5.5      fail_1.2            foreach_1.4.2      
## [19] formatR_1.0         grid_3.1.1          gtable_0.1.2       
## [22] htmltools_0.2.6     hwriter_1.3.2       iterators_1.0.7    
## [25] knitr_1.7           labeling_0.3        lattice_0.20-29    
## [28] latticeExtra_0.6-26 munsell_0.4.2       plyr_1.8.1         
## [31] proto_0.3-10        reshape2_1.4        rmarkdown_0.3.3    
## [34] scales_0.2.4        sendmailR_1.2-1     stringr_0.6.2      
## [37] tools_3.1.1         yaml_2.1.13         zlibbioc_1.12.0