Main Content

getMatePosition

Class: BioMap

Retrieve mate positions of read sequences from BioMap object

Syntax

MatePos = getMatePosition(BioObj)
MatePos = getMatePosition(BioObj,Subset)

Description

MatePos = getMatePosition(BioObj) returns MatePos, a vector of nonnegative integers specifying the mate positions of read sequences with respect to the position numbers in the reference sequence from a BioMap object.

MatePos = getMatePosition(BioObj,Subset) returns mate positions for only read sequences specified by Subset.

Input Arguments

BioObj

Object of the BioMap class.

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 or string vector containing valid sequence headers

Note

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

MatePos

MatePosition property of all or a subset of elements in BioObj. MatePos is a vector of nonnegative integers specifying the mate positions of read sequences with respect to the position numbers in the reference sequence. MatePos includes the mate positions for only read sequences specified by Subset.

Not all values in the MatePosition vector represent valid mate positions, for example, mates that map to a different reference sequence or mates that do not map. To determine if a mate position is valid, use the filterByFlag method with the 'pairedInMap' flag.

Examples

Construct a BioMap object, and then retrieve the mate position for different sequences in the object:

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

    'EAS114_32:5:78:583:499'
% Retrieve the MatePosition property of the 17th element in the object using the header
MatePos_17 = getMatePosition(BMObj1,{'EAS114_32:5:78:583:499'})
MatePos_17 =

         229
          37

Notice the previous example returned two mate positions. This is because the header EAS114_32:5:78:583:499 is a repeated header in the BMObj1 object. The getMatePosition method returns mate positions for all elements in the object with that header.

% Retrieve the MatePosition properties of the 37th and 47th elements in
% the object
MatePos_37_47 = getMatePosition(BMObj1, [37 47])
MatePos_37_47 =

          95
         283
% Retrieve the MatePosition properties of all elements in the object
MatePos_All = getMatePosition(BMObj1);

Alternatives

An alternative to using the getMatePosition method is to use dot indexing with the MatePosition property:

BioObj.MatePosition(Indices)

In the previous syntax, Indices is a vector of positive integers or a logical vector. Indices cannot be a cell array of character vectors or string vector containing sequence headers.