Documentation Center

  • Trial Software
  • Product Updates

setHeader

Class: BioRead

Set sequence headers for object

Syntax

NewObj = setHeader(BioObj, Headers)
NewObj = setHeader(BioObj, Headers, Subset)

Description

NewObj = setHeader(BioObj, Headers) returns NewObj, a new object, created from BioObj, an existing object, with the Header property set to Headers, a cell array of strings containing sequence headers.

NewObj = setHeader(BioObj, Headers, Subset) returns NewObj, a new object, created from BioObj, an existing object, with the Header property of a subset of the elements set to Headers, a cell array of strings containing sequence headers. setHeader sets the headers for only the object elements specified by Subset.

Tips

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

Input Arguments

BioObj

Object of the BioRead or BioMap class.

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

Headers

Cell array of strings containing sequence headers.

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 Headers 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 BioRead or BioMap class.

Examples

Set the headers of some elements in a BioRead object:

% Construct a BioRead object from a FASTQ file 
BRObj = BioRead('SRR005164_1_50.fastq');
% Set the Header property of the first five elements in the object
BRObj = setHeader(BRObj, {'H1', 'H2', 'H3', 'H4', 'H5'}, [1:5]);

Alternatives

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

BioObj.Header(Indices) = NewHeaders

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. NewHeaders is a cell array of strings containing headers. Indices and NewHeaders must have the same number and order of elements.

See Also

| |

How To

Related Links

Was this topic helpful?