Main Content

setStart

Class: BioMap

Set start positions of aligned read sequences in BioMap object

Syntax

NewObj = setStart(BioObj, Start)
NewObj = setStart(BioObj, Start, Subset)

Description

NewObj = setStart(BioObj, Start) returns NewObj, a new BioMap object, constructed from BioObj, an existing BioMap object, with the Start property set to Start, a vector of positive integers specifying the start positions of the aligned read sequences with respect to the position numbers in the reference sequence. Modifying the Start property shifts the aligned sequences.

NewObj = setStart(BioObj, Start, Subset) returns NewObj, a new BioMap object, constructed from BioObj, an existing BioMap object, with the Start property of a subset of the elements set to Start, a vector of positive integers specifying the start positions of the aligned read sequences with respect to the position numbers in the reference sequence. It sets the start positions for only the object elements specified by Subset.

Input Arguments

BioObj

Object of the BioMap class.

Note

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

Start

Vector of positive integers specifying the start positions of the aligned read sequences with respect to the position numbers in the reference sequence.

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 Start 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 BioMap class.

Examples

Construct a BioMap object, and then set a subset of the sequence start values:

% Construct a BioMap object from a SAM file 
BMObj1 = BioMap('ex1.sam');
% Set the Start property of the second element to a new value 
BMObj1 = setStart(BMObj1, 5, 2);

Tips

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

  • If you modify sequences or signatures in an object, you may need to use the setStart method to modify the Start property to shift the alignment of modified sequences accordingly.

Alternatives

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

BioObj.Start(Indices) = NewStart

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 sequence headers. NewStart is a vector of integers specifying the start positions of the aligned read sequences with respect to the position numbers in the reference sequence. Indices and NewStart must have the same number and order of elements.