March 23, 2016
Welliton Souza and Benilton Carvalho
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:
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.
Cycle-specific Average Quality: this describes the average quality scores for each cycle of sequencing.
Read Length Distribution: this is a barplot that presents the distribuition of the lengths of the reads available in the FASTQ file.
Cycle-specific GC Content: a line plot showing the average GC content for every cycle of sequencing.
Cycle-specific Quality Distribution: a 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.
Cycle-specific Quality Distribution - Boxplots: boxplots describing empirical patterns of quality distribution on each cycle of sequencing.
Cycle-specific Base Call Proportion: this bar plot describes the proportion of each nucleotide called for every cycle of sequencing.
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
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.
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
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:
## Warning: closing unused connection 6 (/home/biocbuild/bbs-3.4-bioc/R/ ## library/ShortRead/extdata/E-MTAB-1147/ERR127302_1_subset.fastq.gz)
This table describes input files.
reads column can be total number of reads (
sample=FALSE) or sample size.
This plot describe an overview of per read mean quality distribution of all files
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.
This describes the average quality scores for each cycle of sequencing.
This plot shows the proportion of reads that appeared many times.
This heatmap plot shows dstance matrix between top represented reads. This functon only works with one result file (and not a list).
Barplot that presents the distribuition of the lengths of the reads available in the FASTQ file.
Line plot showing the average GC content for every cycle of sequencing.
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.
Biplot from Principal Component Analysis (PCA) of cycle-specific read average quality.
Boxplots describing empirical patterns of quality distribution on each cycle of sequencing.
## Warning: closing unused connection 7 (/home/biocbuild/bbs-3.4-bioc/R/ ## library/ShortRead/extdata/E-MTAB-1147/ERR127302_2_subset.fastq.gz)
This bar plot describes the proportion of each nucleotide called for every cycle of sequencing.
The line plot shows a more detailed view.
It is important to note that the
rqc function samples 1 million
records from the FASTQ files. This can be set by adjusting the
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
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.
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.
To process the files without generating an HTML report, the user
rqcQA function instead
rqc. This function receives a
vector containing the paths of the input files.
qa <- rqcQA(files, workers=1)
rqcQA function returns a list that contains the required
information to create the plots present on the standard HTML
report. Actually, both
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
RqcResultSet is a class that
.QA class of ShortRead package. An
contains information in two different perspectives: read-specific
data and cycle-specific data. They can be accessed using
To create a final HTML report, the user can apply the
function to the
reportFile <- rqcReport(qa) 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
The Rqc package performs parallel processing of the samples by
interfacing with the BiocParallel package. By default,
multicoreWorkers function that returns the maximum number
of workers available. You can change the number of cores setting
rqcQA functions. It is possible to process the
input files serially by setting
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(qa) cycle <- as.numeric(levels(df$cycle))[df$cycle] plot(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 <- qa rqcCycleQualityPlot(sublist)
Rqc package accepts R Markdown file format as template file for generating custom reports. Markdown is a markup language for web development. R Markdown files are regular Markdown files with R codes. Every chunk of code is executed during compilation done by knitr package. Knitr takes R Markdown file and generates Markdown file merged with R codes and their outputs such as text, tables and figures. Result Markdown file is used by Rqc for generating final report in HTML or PDF formats. The source file of Rqc's default report is a good reference for writing new template reports. Run code below returns the system file path to this source file.
system.file(package = "Rqc", "templates", "rqc_report.Rmd")
Basic concepts for writing Markdown documents with R code are available at http://rmarkdown.rstudio.com/. Advanced concepts about the compilation process of R Markdown files are available at http://yihui.name/knitr/. The Bioconductor project provides style guidelines for HTML documents at http://www.bioconductor.org/packages/release/bioc/vignettes/BiocStyle/inst/doc/HtmlStyle.html.
Rqc result data is available inside template files through
This object is a list of summarized statistics about input files and it is used by all accessor functions and plots provided by Rqc package.
rqcReport function takes template file path as argument and generates personalized reports.
rqcReport(qa, templateFile = "custom_report.Rmd")
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.
## R version 3.3.1 (2016-06-21) ## Platform: x86_64-pc-linux-gnu (64-bit) ## Running under: Ubuntu 16.04.1 LTS ## ## locale: ##  LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C ##  LC_TIME=en_US.UTF-8 LC_COLLATE=C ##  LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 ##  LC_PAPER=en_US.UTF-8 LC_NAME=C ##  LC_ADDRESS=C LC_TELEPHONE=C ##  LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C ## ## attached base packages: ##  stats4 parallel stats graphics grDevices utils datasets ##  methods base ## ## other attached packages: ##  knitr_1.14 Rqc_1.8.0 ##  ggplot2_2.1.0 ShortRead_1.32.0 ##  GenomicAlignments_1.10.0 SummarizedExperiment_1.4.0 ##  Biobase_2.34.0 Rsamtools_1.26.0 ##  GenomicRanges_1.26.0 GenomeInfoDb_1.10.0 ##  Biostrings_2.42.0 XVector_0.14.0 ##  IRanges_2.8.0 S4Vectors_0.12.0 ##  BiocGenerics_0.20.0 BiocParallel_1.8.0 ##  BiocStyle_2.2.0 ## ## loaded via a namespace (and not attached): ##  Rcpp_0.12.7 biovizBase_1.22.0 ##  lattice_0.20-34 digest_0.6.10 ##  mime_0.5 R6_2.2.0 ##  plyr_1.8.4 chron_2.3-47 ##  acepack_1.3-3.3 RSQLite_1.0.0 ##  evaluate_0.10 highr_0.6 ##  httr_1.2.1 BiocInstaller_1.24.0 ##  zlibbioc_1.20.0 GenomicFeatures_1.26.0 ##  data.table_1.9.6 rpart_4.1-10 ##  Matrix_1.2-7.1 labeling_0.3 ##  splines_3.3.1 AnnotationHub_2.6.0 ##  stringr_1.1.0 foreign_0.8-67 ##  RCurl_1.95-4.8 biomaRt_2.30.0 ##  munsell_0.4.3 shiny_0.14.1 ##  httpuv_1.3.3 rtracklayer_1.34.0 ##  htmltools_0.3.5 nnet_7.3-12 ##  gridExtra_2.2.1 interactiveDisplayBase_1.12.0 ##  Hmisc_3.17-4 XML_3.98-1.4 ##  bitops_1.0-6 grid_3.3.1 ##  xtable_1.8-2 gtable_0.2.0 ##  DBI_0.5-1 magrittr_1.5 ##  formatR_1.4 scales_0.4.0 ##  stringi_1.1.2 reshape2_1.4.1 ##  hwriter_1.3.2 latticeExtra_0.6-28 ##  Formula_1.2-1 RColorBrewer_1.1-2 ##  ensembldb_1.6.0 tools_3.3.1 ##  dichromat_2.0-0 BSgenome_1.42.0 ##  markdown_0.7.7 survival_2.39-5 ##  AnnotationDbi_1.36.0 colorspace_1.2-7 ##  cluster_2.0.5 VariantAnnotation_1.20.0 ##  GenomicFiles_1.10.0