Documentation Center

  • Trial Software
  • Product Updates

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 strings 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 strings containing the letter representations of nucleotide sequences. setSequence sets the sequences for only the object elements specified by Subset.

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.

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

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);

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

See Also

| | | |

How To

Related Links

Was this topic helpful?