QualityScaledXStringSet-class: QualityScaledBStringSet, QualityScaledDNAStringSet,...

Description Usage Arguments Details Accessor methods Subsetting and appending Author(s) See Also Examples

Description

The QualityScaledBStringSet class is a container for storing a BStringSet object with an XStringQuality object.

Similarly, the QualityScaledDNAStringSet (or QualityScaledRNAStringSet, or QualityScaledAAStringSet) class is a container for storing a DNAStringSet (or RNAStringSet, or AAStringSet) objects with an XStringQuality object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Constructors:
QualityScaledBStringSet(x, quality)
QualityScaledDNAStringSet(x, quality)
QualityScaledRNAStringSet(x, quality)
QualityScaledAAStringSet(x, quality)

## Read/write a QualityScaledXStringSet object from/to a FASTQ file:
readQualityScaledDNAStringSet(filepath,
                quality.scoring=c("phred", "solexa", "illumina"),
                nrec=-1L, skip=0L, seek.first.rec=FALSE,
                use.names=TRUE)

writeQualityScaledXStringSet(x, filepath, append=FALSE,
                compress=FALSE, compression_level=NA)

Arguments

x

For the QualityScaled*StringSet constructors: Either a character vector, or an XString, XStringSet or XStringViews object.

For writeQualityScaledXStringSet: A QualityScaledDNAStringSet object or other QualityScaledXStringSet derivative.

quality

An XStringQuality derivative.

filepath, nrec, skip, seek.first.rec, use.names, append, compress, compression_level

See ?`XStringSet-io`.

quality.scoring

Specify the quality scoring used in the FASTQ file. Must be one of "phred" (the default), "solexa", or "illumina". If set to "phred" (or "solexa" or "illumina"), the qualities will be stored in a PhredQuality (or SolexaQuality or IlluminaQuality, respectively) object.

Details

The QualityScaledBStringSet, QualityScaledDNAStringSet, QualityScaledRNAStringSet and QualityScaledAAStringSet functions are constructors that can be used to "naturally" turn x into an QualityScaledXStringSet object of the desired base type.

Accessor methods

The QualityScaledXStringSet class derives from the XStringSet class hence all the accessor methods defined for an XStringSet object can also be used on an QualityScaledXStringSet object. Common methods include (in the code snippets below, x is an QualityScaledXStringSet object):

length(x): The number of sequences in x.

width(x): A vector of non-negative integers containing the number of letters for each element in x.

nchar(x): The same as width(x).

names(x): NULL or a character vector of the same length as x containing a short user-provided description or comment for each element in x.

quality(x): The quality of the strings.

Subsetting and appending

In the code snippets below, x and values are XStringSet objects, and i should be an index specifying the elements to extract.

x[i]: Return a new QualityScaledXStringSet object made of the selected elements.

Author(s)

P. Aboyoun

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
## ---------------------------------------------------------------------
## QualityScaled*StringSet() CONSTRUCTORS
## ---------------------------------------------------------------------

x1 <- DNAStringSet(c("TTGA", "CTCN"))
q1 <- PhredQuality(c("*+,-", "6789"))
qdna1 <- QualityScaledDNAStringSet(x1, q1)
qdna1

## ---------------------------------------------------------------------
## READ/WRITE A QualityScaledDNAStringSet OBJECT FROM/TO A FASTQ FILE
## ---------------------------------------------------------------------

filepath <- system.file("extdata", "s_1_sequence.txt",
                        package="Biostrings")

## By default, readQualityScaledDNAStringSet() assumes that the FASTQ
## file contains "Phred quality scores" (this is the standard Sanger
## variant to assess reliability of a base call):
qdna2 <- readQualityScaledDNAStringSet(filepath)
qdna2

outfile2a <- tempfile()
writeQualityScaledXStringSet(qdna2, outfile2a)

outfile2b <- tempfile()
writeQualityScaledXStringSet(qdna2, outfile2b, compress=TRUE)

## Use 'quality.scoring="solexa"' or 'quality.scoring="illumina"' if the
## quality scores are Solexa quality scores:
qdna3 <- readQualityScaledDNAStringSet(filepath, quality.scoring="solexa")
qdna3

outfile3a <- tempfile()
writeQualityScaledXStringSet(qdna3, outfile3a)

outfile3b <- tempfile()
writeQualityScaledXStringSet(qdna3, outfile3b, compress=TRUE)

## Sanity checks:
stopifnot(identical(readLines(outfile2a), readLines(filepath)))
stopifnot(identical(readLines(outfile2a), readLines(outfile2b)))
stopifnot(identical(readLines(outfile3a), readLines(filepath)))
stopifnot(identical(readLines(outfile3a), readLines(outfile3b)))

anandhupresannan/biostrings documentation built on Nov. 2, 2019, 1:47 p.m.