Class: BioRead

Retrieve sequence headers from object


Headers = getHeader(BioObj)
Headers = getHeader(BioObj, Subset)


Headers = getHeader(BioObj) returns Headers, a cell array of strings containing sequence headers from an object.

Headers = getHeader(BioObj, Subset) returns header strings for only object elements specified by Subset.

Input Arguments


Object of the BioRead or BioMap class.


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:   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


Cell array of strings containing the sequence headers specified by Subset in BioObj.


Retrieve the headers from different elements of a BioRead object:

% Create variables containing sequences, quality scores, and headers
seqs = {randseq(10); randseq(15); randseq(20)};
quals = {repmat('!', 1, 10); repmat('%', 1, 15); repmat('&', 1, 20)};
headers = {'H1'; 'H2'; 'H3'};
% Construct a BioRead object from these three variables
BRObj = BioRead(seqs, quals, headers);
% Retrieve the Header value of the second element in the object
getHeader(BRObj, 2);
getHeader(BRObj, [false true false]);
% Retrieve the Header values of the first and third elements in the
% object
getHeader(BRObj, [1 3]);
getHeader(BRObj, [true false true]);
% Retrieve the Header value of all the elements in the object
getHeader(BRObj, 1:3);


An alternative to using the getHeader method is to use dot indexing with the Header property:


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.

Was this topic helpful?