Skip to content

Quality control workflow

mdavy86 edited this page Oct 20, 2012 · 18 revisions

Table of Contents

Resources

Quality control workflow

The ShortRead package contains a function called qa() which creates a quality report from several input formats, (usually a Fastq file).

 type=c("SolexaExport", "SolexaRealign", "Bowtie", "MAQMap", "MAQMapShort", "fastq", "BAM")

This function produces similar outputs to FastqQC but executes slightly faster. Functionality has been written to perform quality control either;

  1. on a ShortReadQ structure of NGS reads loading into R using readFastq()
  2. Specify the directory to run qa() directly from the NGS files.

Quality control workflow

Setup

The first command clears out any existing R objects from your current workspace

 # Clear working directory objects
 rm(list=ls())

Any contributed libraries need to be installed once, but loaded each time they are used with either require(), or library();

require(ShortRead)

Loading help documentation vignette;

 # Getting vignette help
 if(interactive()) vignette("Overview") ## Quality assessment, page 8 

The next commands source some global variables in the file ~/VISG-course-2012/supplementary_QC/globals.R

# Globals
cat("[ Code to source() ]\n")
cat(readLines("globals.R"), sep="\n")

# source globals code
source("globals.R")

cat("[ Directory and Fastq filenames ]\n")
print(indir)
print(fileNames)

1. Path to first example Fastq file

Define the path fo the first Fastq file in fileNames object to the R object 'file1;

 file1 <- file.path(indir, fileNames[1])
 print(file)

2. Read in Fastq example

Read in the first Fastq file into R using ShortReads readFastq() which creates an instance of the ShorReadQ class. This structure contains the sequence data, quality information, and header information;

 rfq       <- readFastq(file1, qualityType="Auto")

3. Show method

Using print() or show() displays auxillary information about the ShortReadQ structure, in this Roche 454 example we can tell that there is a variable number of cycles from the ragged array length: 4936 reads; width: 71..1200 cycles information;

 print(rfq)

4. Class of rfq is an instance of ShortReadQ S4 class

Checking the class;

 class(rfq)

5. Print all S4 class slotNames

Checking the slot names for the S4 class, usually there are accessor methods of the same name as the slots, in this case there are function methods sread(), quality(), and id(), to access slot components of the ShortReadQ object;

 slotNames(rfq)

6. sread accessor method

7. id accessor method

8. quality accessor method

9. Run Quality control script

10. Create hmtml report

Clone this wiki locally