Main Content

getIndex

Class: GFFAnnotation

Return index array of annotations from GFFAnnotation object

Syntax

Idx = getIndex(AnnotObj)
Idx = getIndex(AnnotObj,StartPos,EndPos)
Idx = getIndex(___,Name,Value)

Description

Idx = getIndex(AnnotObj) returns an index array Idx, an array of integers containing the index of each annotation in AnnotObj.

Idx = getIndex(AnnotObj,StartPos,EndPos) returns an index array Idx for a subset of elements that falls within each reference sequence range specified by StartPos and EndPos.

Idx = getIndex(___,Name,Value) returns an index array Idx, using any of the input arguments from the previous syntaxes and additional options specified by one or more Name,Value pair arguments.

Input Arguments

AnnotObj

Object of the GFFAnnotation class.

StartPos

Nonnegative integer specifying the start of a range in each reference sequence in AnnotObj. The integer StartPos must be less than or equal to EndPos.

EndPos

Nonnegative integer specifying the end of a range in each reference sequence in AnnotObj. The integer EndPos must be greater than or equal to StartPos.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Reference

Character vector or cell array of character vectors specifying one or more reference sequences in AnnotObj. Only indices of annotations whose reference field matches one of the specified references are included in Idx.

Feature

Character vector or cell array of character vectors specifying one or more features in AnnotObj. Only indices of annotations whose feature field matches one of the specified features are included in Idx.

Overlap

Minimum number of base positions that an annotation must overlap in the range, to have its index included in Idx. This value can be any of the following:

  • Positive integer

  • 'full' — An annotation must be fully contained in the range to be included.

  • 'start' — An annotation’s start position must lie within the range to be included.

Default: 1

Output Arguments

Idx

Array of integers representing indices of elements in AnnotObj.

Examples

Example 23. Retrieve Indices of Annotations from a GFFAnnotation Object

Construct a GFFAnnotation object using a GFF-formatted file that is provided with Bioinformatics Toolbox™.

GFFAnnotObj = GFFAnnotation('tair8_1.gff');

Extract indices of annotations or features for positions 10,000 through 20,000 from the reference sequence.

Idx = getIndex(GFFAnnotObj,10000,20000)

Idx =

    61
    62
    63
    64
    65
    66
    67
    68
    69