Class: BioRead

Retrieve sequences from object


Sequences = getSequence(BioObj)
Sequences = getSequence(BioObj, Subset)


Sequences = getSequence(BioObj) returns Sequences, a cell array of strings containing the letter representations of nucleotide sequences from an object.

Sequences = getSequence(BioObj, Subset) returns sequence 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 sequences specified by Subset in BioObj.


Retrieve the sequences from different elements of a BioRead object:

% Construct a BioRead object from a FASTQ file 
BRObj = BioRead('SRR005164_1_50.fastq');
% Retrieve the sequence of the second element in the object
getSequence(BRObj, 2);
getSequence(BRObj, {'SRR005164.2'});
getSequence(BRObj, [false true false]);
% Retrieve the sequences of the first and third elements in the object
getSequence(BRObj, [1 3]);
getSequence(BRObj, {'SRR005164.1', 'SRR005164.3'});
getSequence(BRObj, [true false true]);
% Retrieve the sequences of all the elements in the object
getSequence(BRObj, 1:50);


An alternative to using the getSequence method is to use dot indexing with the Sequence 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?