Main Content


Retrieve sequences from object



seqs = getSequence(object) returns nucleotide sequences from a BioRead or BioMap object.


subsetSeqs = getSequence(object,subset) returns the sequences subsetSeqs for only the object elements specified by subset.


collapse all

Store read data from a SAM-formatted file in a BioRead object.

br = BioRead('ex1.sam')
br = 
  BioRead with properties:

     Quality: [1501x1 File indexed property]
    Sequence: [1501x1 File indexed property]
      Header: [1501x1 File indexed property]
       NSeqs: 1501
        Name: ''

Retrieve the sequences (reads) from the object.

seqs = getSequence(br);

Retrieve the sequences from the first and third elements in the object.

seqs2 = getSequence(br,[1 3])
seqs2 = 2x1 cell

Use a logical vector to get the same information.

seqs3 = getSequence(br,[true false true])
seqs3 = 2x1 cell

You can use a header to get the corresponding sequences with that header. If multiple sequences have the same header, the function returns all those sequences.

Get the sequences with the header B7_591:4:96:693:509.

seqs4 = getSequence(br,{'B7_591:4:96:693:509'})
seqs4 = 1x1 cell array

Access each property of the object using the dot notation.

seqs = br.Sequence;
seq2   = br.Sequence([1 3])
seq2 = 2x1 cell

Input Arguments

collapse all

Object containing the read data, specified as a BioRead or BioMap object.

Example: bioreadObj

Subset of elements in the object, specified as a vector of positive integers, logical vector, string vector, or cell array of character vectors containing valid sequence headers.

Example: [1 3]


When you use a sequence header (or a cell array of headers) for subset, a repeated header specifies all elements with that header.

Output Arguments

collapse all

Nucleotide sequences from the object, returned as a cell array of character vectors.

Nucleotide sequences from a subset of elements from the object, returned as a cell array of character vectors.

Version History

Introduced in R2010a