setQuality

Class: BioRead

Set sequence quality scores for object

Syntax

NewObj = setQuality(BioObj, Quality)
NewObj = setQuality(BioObj, Quality, Subset)

Description

NewObj = setQuality(BioObj, Quality) returns NewObj, a new object, created from BioObj, an existing object, with the Quality property set to Quality, a cell array of strings containing the ASCII representations of per-base quality scores for nucleotide sequences.

NewObj = setQuality(BioObj, Quality, Subset) returns NewObj, a new object, created from BioObj, an existing object, with the Quality property of a subset of the elements set to Quality, a cell array of strings containing the ASCII representations of per-base quality scores for nucleotide sequences. setQuality sets the quality scores for only the object elements specified by Subset.

Tips

To update quality scores in an existing object, use the same object as the input BioObj and the output NewObj.

Input Arguments

BioObj

Object of the BioRead or BioMap class.

    Note:   If BioObj was constructed from a BioIndexedFile object, you cannot set its Quality property.

Quality

Cell array of strings containing the ASCII representations of per-base quality scores for nucleotide sequences.

Subset

One of the following to specify a subset of the elements in BioObj:

  • Vector of positive integers

  • Logical vector

  • Cell array of strings containing valid sequence headers

    Note:   A one-to-one relationship must exist between the number and order of elements in Quality and Subset. If you use a cell array of header strings to specify Subset, be aware that a repeated header specifies all elements with that header.

Output Arguments

NewObj

Object of the BioRead or BioMap class.

Examples

Construct a BioRead object, and then set a subset of the quality scores:

% Construct a BioRead object from a FASTQ file 
BRObj = BioRead('SRR005164_1_50.fastq');
% Create a new quality score
newValue = {repmat('N', 1, length(BRObj.Quality{2}))}; 
% Set the Quality property of the second element to the new
% quality score 
BRObj = setQuality(BRObj, newValue, 2);

Alternatives

An alternative to using the setQuality method to update an existing object is to use dot indexing with the Quality property:

BioObj.Quality(Indices) = NewQuality

In the previous syntax, Indices is a vector of positive integers or a logical vector. Indices cannot be a cell array of strings containing sequence headers. NewQuality is a cell array of strings containing ASCII representations of per-base quality scores. Indices and NewQuality must have the same number and order of elements.

Was this topic helpful?