Main Content


Set mate positions of read sequences in BioMap object



NewObj = setMatePosition(BioObj,MatePos) returns a new BioMap object constructed from BioObj with the MatePosition property set to MatePos.

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

BioObj = setMatePosition(BioObj,MatePos)


To set the mate position, when constructing BioObj you must set the InMemory name-value argument to true. See Manage Sequence Read Data in Objects.


NewObj = setMatePosition(BioObj,MatePos,Subset) sets the mate positions for only the object elements specified by Subset.


collapse all

Construct a BioMap object, and then set a subset of the sequence mate position values. Construct a BioMap object from a SAM file setting the InMemory name-value argument to true, and determine the header for the second element.

BioObj = BioMap('ex1.sam',InMemory=true);
hdr = BioObj.Header(2)
hdr = 1x1 cell array

Set the MatePosition property of the second element to a new value of 5.

NewObj = setMatePosition(BioObj,5,hdr)
NewObj = 
  BioMap with properties:

    SequenceDictionary: {'seq1'}
             Reference: {1501x1 cell}
             Signature: {1501x1 cell}
                 Start: [1501x1 uint32]
        MappingQuality: [1501x1 uint8]
                  Flag: [1501x1 uint16]
          MatePosition: [1501x1 uint32]
               Quality: {1501x1 cell}
              Sequence: {1501x1 cell}
                Header: {1501x1 cell}
                 NSeqs: 1501
                  Name: ''

Set the MatePosition properties of the first and third elements in the new object to 6 and 7 respectively.

NewObj = setMatePosition(NewObj, [6 7], [1 3]);

Set the MatePosition property of all elements in the new object to zero.

y = zeros(1,NewObj.NSeqs);
NewObj = setMatePosition(NewObj,y);

Input Arguments

collapse all

Object for read sequences, specified as a BioMap object. Construct BioObj using BioMap.


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

Mate positions of the read sequences with respect to the position numbers in the reference sequence, specified as a vector of nonnegative integers.

Example: [3 12]

Data Types: single | double

Subset of the elements in BioObj, specified as one of the following:

  • Vector of positive integers

  • Logical vector

  • Cell array of character vectors containing valid sequence headers

  • String vector containing valid sequence headers


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, a repeated header specifies all elements with that header.

Example: [5 26]

Data Types: single | double | logical | char | string | cell

Alternative Functionality

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

BioObj.MatePosition(Indices) = NewMatePos

In this 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.

Version History

Introduced in R2010b