Main Content

setSignature

Class: BioMap

Set signature (alignment information) for BioMap object

Syntax

NewObj = setSignature(BioObj, Signature)
NewObj = setSignature(BioObj, Signature, Subset)

Description

NewObj = setSignature(BioObj, Signature) returns NewObj, a new BioMap object, constructed from BioObj, an existing BioMap object, with the Signature property set to Signature, a cell array of CIGAR-formatted character vectors, each representing how a read sequence aligns to the reference sequence.

NewObj = setSignature(BioObj, Signature, Subset) returns NewObj, a new BioMap object, constructed from BioObj, an existing BioMap object, with the Signature property of a subset of the elements set to Signature, a cell array of CIGAR-formatted character vectors, each representing how read sequences, specified by Subset, align to the reference sequence. It sets the signature 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 Signature property.

Signature

Cell array of CIGAR-formatted character vectors, each representing how a read sequence aligns to the reference sequence. Signature can be empty.

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 Signature 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 signatures:

% Construct a BioMap object from a SAM file 
BMObj1 = BioMap('ex1.sam');
% Set the Signature property of the second element to a new value 
BMObj1 = setSignature(BMObj1,  {'36M'}, 2);

Tips

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

  • If you modify sequences or start positions in an object, you may need to use the setSignature method to modify the Signature property of modified sequences accordingly.

Alternatives

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

BioObj.Signature(Indices) = NewSignature

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. NewSignature is a character vector or a cell array of CIGAR-formatted character vectors, each representing how a read sequence aligns to the reference sequence. Signature can be empty. Indices and NewSignature must have the same number and order of elements.