qualityScores: Extract Quality Score Data in a Sequencing Read Dataset

Description Usage Arguments Details Value Author(s) Examples

View source: R/qualityScores.R

Description

Extract quality strings and convert them to Phred scores for generating boxplots.

Usage

1
2
3
4
5
6
7
qualityScores(

    # basic input/output options
    filename,
    input_format = "gzFASTQ",
    offset = 33,
    nreads = 10000)

Arguments

filename

a character string giving the name of an input file containing sequence reads.

input_format

a character string specifying format of the input file. gzFASTQ (gzipped FASTQ) by default. Acceptable formats include gzFASTQ, FASTQ, SAM and BAM. Character string is case insensitive.

offset

a numeric value giving the offset added to the base-calling Phred scores. Possible values include 33 and 64. By default, 33 is used.

nreads

a numeric value giving the number of reads from which quality scores are extracted. 10000 by default. A value of -1 indicates that quality scores will be extracted from all the reads.

Details

Quality scores of read bases are represented by ASCII characters in next-gen sequencing data. This function extracts the quality characters from each base in each read and then converts them to Phred scores using the provided offset value (offset).

If the total number of reads in a dataset is n, then every n/nreads read is extracted from the input data.

Value

A data matrix containing Phred scores for read bases. Rows in the matrix are reads and columns are base positions in each read.

Author(s)

Wei Shi, Yang Liao and Zhiyin Dai

Examples

1
2
3
reads <- system.file("extdata","reads.txt.gz",package="Rsubread")
x <- qualityScores(filename=reads,offset=64,nreads=1000)
x[1:10,1:10]

Example output

qualityScores Rsubread 1.26.1

Scan the input file...
Totally 1000 reads were scanned; the sampling interval is 1.
Now extract read quality information...

Completed successfully. Quality scores for 999 reads (equally spaced in the file) are returned.

       1  2  3  4  5  6  7  8  9 10
 [1,] 33 33 33 20 20 24 31 15 21 16
 [2,] 33 33 30 33 33 30 34 30 32 28
 [3,] 32 33 33 32 33 33 33 20 32 24
 [4,] 33 33 33 33 33 30 29 34 31 25
 [5,] 33 33 33 33 33 34 34 34 33 30
 [6,] 33 30 31 24 24 28 33 33 30 32
 [7,] 33 33 33 33 30 28 17 25 31 33
 [8,] 33 32  2  2  2  2  2  2  2  2
 [9,] 33 33 33 34 33 33 31 33 33 33
[10,] 33 33 33 33 28 24 33 33 33 28

Rsubread documentation built on March 17, 2021, 6:01 p.m.