Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

setSequence

Class: BioRead

Set sequences for object

Syntax

NewObj = setSequence(BioObj, Sequences)
NewObj = setSequence(BioObj, Sequences, Subset)

Description

NewObj = setSequence(BioObj, Sequences) returns NewObj, a new object, created from BioObj, an existing object, with the Sequence property set to Sequences, a cell array of character vectors containing the letter representations of nucleotide sequences.

NewObj = setSequence(BioObj, Sequences, Subset) returns NewObj, a new object, created from BioObj, an existing object, sets the sequences of a subset of the elements in BioObj with the Sequence property of a subset of the elements set to Sequences, a cell array of character vectors containing the letter representations of nucleotide sequences. setSequence sets the sequences for only the object elements specified by Subset.

Input Arguments

BioObj

Object of the BioRead or BioMap class.

Note

If BioObj was constructed from a BioIndexedFile object, you cannot set its Sequence property.

Sequences

Cell array of character vectors containing the letter representations of nucleotide sequences.

Subset

One of the following to specify a subset of the elements in BioObj:

  • Vector of positive integers

  • Logical vector

  • Cell array of character vectors containing valid sequence headers

Note

A one-to-one relationship must exist between the number and order of elements in Sequences and Subset. If you use a cell array of headers 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

Construct a BioRead object, and then set a subset of the sequences:

% Construct a BioRead object from a FASTQ file 
BRObj = BioRead('SRR005164_1_50.fastq');
% Set the Sequence property of the second element to a new sequence 
BRObj = setSequence(BRObj, {'NNNNNNN'}, 2);

Tips

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

  • If you use the setSequence method to modify the Sequence property, you also may need to modify the Start and Signature properties accordingly, which you can do using the setStart and setSignature methods.

Alternatives

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

BioObj.Sequence(Indices) = NewSequences

In the previous syntax, Indices is a vector of positive integers or a logical vector. Indices cannot be a cell array of character vectors containing sequences. NewSequences is a cell array of character vectors containing sequences. Indices and NewSequences must have the same number and order of elements.

Was this topic helpful?