Main Content

setMappingQuality

Class: BioMap

Set sequence mapping quality scores for BioMap object

Syntax

NewObj = setMappingQuality(BioObj, MappingQuality)
NewObj = setMappingQuality(BioObj, MappingQuality, Subset)

Description

NewObj = setMappingQuality(BioObj, MappingQuality) returns NewObj, a new BioMap object, constructed from BioObj, an existing BioMap object, with the MappingQuality property set to MappingQuality, a vector of integers specifying the mapping quality scores for read sequences.

NewObj = setMappingQuality(BioObj, MappingQuality, Subset) returns NewObj, a new BioMap object, constructed from BioObj, an existing BioMap object, with the MappingQuality property of a subset of the elements set to MappingQuality, a vector of integers specifying the mapping quality scores for read sequences. It sets the mapping quality scores for only the object elements specified by Subset.

Input Arguments

BioObj

Object of the BioMap class.

Note

If BioObj was constructed from a BioIndexedFile object, you cannot set its MappingQuality property.

MappingQuality

Vector of integers specifying the mapping quality scores for read sequences.

Subset

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

  • Vector of positive integers

  • Logical vector

  • Cell array of character vectors containing valid sequence headers

Note

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

Output Arguments

NewObj

Object of the BioMap class.

Examples

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

% Construct a BioMap object from a SAM file 
BMObj1 = BioMap('ex1.sam');
% Set the Mapping Quality property of the second element to a new
% value 
BMObj1 = setMappingQuality(BMObj1, 74, 2);

Tips

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

Alternatives

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

BioObj.MappingQuality(Indices) = NewMappingQuality

In the previous syntax, Indices is a vector of positive integers or a logical vector. Indices cannot be a cell array of character vectors containing sequence headers. NewMappingQuality is a vector of integers specifying the mapping quality scores for read sequences. Indices and NewQuality must have the same number and order of elements.