getFlag
Class: BioMap
Retrieve read sequence flags from BioMap
object
Syntax
Flag
= getFlag(BioObj
)
Flag
= getFlag(BioObj
, Subset
)
Description
returns Flag
= getFlag(BioObj
)Flag
, a vector of nonnegative integers indicating the
bit-wise information that specifies the status of the 11 flags described by the SAM
format specification. Each integer corresponds to one read sequence from a
BioMap
object.
returns
flag integers for only object elements specified by Flag
= getFlag(BioObj
, Subset
)Subset
.
Input Arguments
|
Object of the |
|
One of the following to specify a subset of the elements in
Note If you use a cell array of headers to specify |
Output Arguments
|
Vector of nonnegative integers. Each integer corresponds to one read sequence and indicates
the bit-wise information that specifies the status of the 11 flags described
by the SAM format specification. These flags describe different sequencing
and alignment aspects of a read sequence. |
Examples
Construct a BioMap
object, and then retrieve
the SAM flag values for different elements in the object:
% Construct a BioMap object from a SAM file BMObj1 = BioMap('ex1.sam'); % Retrieve integer specifying bit-wise information for 11 % SAM flags of the second element flagValue = getFlag(BMObj1, 2)
flagValue = 73
% Retrieve integers specifying bit-wise information for 11 % SAM flags of the first and third elements flagValues = getFlag(BMObj1, [1 3])
flagValues = 73 137
% Retrieve integers specifying bit-wise information for 11 % SAM flags of all elements allFlagValues = getFlag(BMObj1);
% Determine the status of the fourth flag (mate is unmapped) % for the second element, which has a flag value of 73 bitget(73, 4)
ans = 1
Tips
After using the getFlag
method to return
the integer specifying the bit-wise information for the SAM flags,
use the bitget
function to
determine the status of a specific SAM flag. For more information,
see Examples.
Alternatives
An alternative to using the getFlag
method
is to use dot indexing with the Flag
property:
BioObj.Flag(Indices)
In the previous syntax, Indices
is a vector of positive integers or
a logical vector. Indices
cannot be a cell array of character
vectors or string vector containing sequence headers.