setMatePosition

Class: BioMap

Set mate positions of read sequences in BioMap object

Syntax

NewObj = setMatePosition(BioObj,MatePos)
NewObj = setMatePosition(BioObj,MatePos,Subset)

Description

NewObj = setMatePosition(BioObj,MatePos) returns NewObj, a new BioMap object, constructed from BioObj, an existing BioMap object, with the MatePosition property set to MatePos, a vector of nonnegative integers specifying the mate positions of the read sequences with respect to the position numbers in the reference sequence.

NewObj = setMatePosition(BioObj,MatePos,Subset) returns NewObj, a new BioMap object, constructed from BioObj, an existing BioMap object, with the MatePosition property of a subset of the elements set to MatePos, a vector of nonnegative integers specifying the mate positions of the read sequences with respect to the position numbers in the reference sequence. The setMatePosition method sets the mate 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 MatePosition property.

MatePos

Vector of nonnegative integers specifying the mate positions of the 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 MatePos 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 mate position values:

% Construct a BioMap object from a SAM file and determine the header for the second element
BMObj1 = BioMap('ex1.sam');
BMObj1.Header(2)
ans = 

    'EAS54_65:7:152:368:113'
% Set the MatePosition property of the second element to a new value of 5
BMObj1 = setMatePosition(BMObj1, 5, {'EAS54_65:7:152:368:113'});
% Set the MatePosition properties of the first and third elements in
% the object to 6 and 7 respectively
BMObj1 = setMatePosition(BMObj1, [6 7], [1 3]);
% Set the MatePosition property of all elements in the object to zero
y = zeros(1,BMObj1.NSeqs);
BMObj1 = setMatePosition(BMObj1,y);

Tips

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

Alternatives

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

BioObj.MatePosition(Indices) = NewMatePos

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