Documentation Center

  • Trial Software
  • Product Updates

getHeader

Class: BioRead

Retrieve sequence headers from object

Syntax

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

Description

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

BioObj

Object of the BioRead or BioMap class.

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

Headers

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

Examples

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);
getHeader(BRObj, 1:3);

Alternatives

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

BioObj.Header(Indices)

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.

See Also

| |

How To

Related Links

Was this topic helpful?