setFlag

Class: BioMap

Set read sequence flags for BioMap object

Syntax

NewObj = setFlag(BioObj, Flag)
NewObj = setFlag(BioObj, MappingQuality, Subset)

Description

NewObj = setFlag(BioObj, Flag) returns NewObj, a new BioMap object, constructed from BioObj, an existing BioMap object, with the Flag property set to Flag, a vector of nonnegative integers indicating the bit-wise information that specifies the status of each of the 11 flags described by the SAM format specification.

NewObj = setFlag(BioObj, MappingQuality, Subset) returns NewObj, a new BioMap object, constructed from BioObj, an existing BioMap object, with the Flag property of a subset of the elements set to Flag, a vector of nonnegative integers indicating the bit-wise information that specifies the status of each of the 11 flags described by the SAM format specification. It sets the Flag property for only the object elements specified by Subset.

Tips

To update the Flag property in an existing BioMap object, use the same object as the input BioObj and the output NewObj.

Input Arguments

BioObj

Object of the BioMap class.

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

Flag

Vector of nonnegative integers. Each integer corresponds to one read sequence and indicates the bit-wise information that specifies the status of each of the 11 flags described by the SAM format specification. These flags describe different sequencing and alignment aspects of a read sequence.

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 Flag 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 BioMap class.

Examples

Construct a BioMap object, and then set a subset of the flags:

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

Alternatives

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

BioObj.Flag(Indices) = NewFlag

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. NewFlag is a vector of nonnegative integers indicating the bit-wise information that specifies the status of each of the 11 flags described by the SAM format specification. Each integer corresponds to one read sequence in a BioMap object. Indices and NewFlag must have the same number and order of elements.

Was this topic helpful?