Main Content

getIndex

Return index array of annotations from GTFAnnotation or GFFAnnotation object

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.

example

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.

Examples

collapse all

Construct a GTFAnnotation object using a GTF-formatted file that is provided with Bioinformatics Toolbox™.

GTFAnnotObj = GTFAnnotation('hum37_2_1M.gtf');

Extract indices of annotations for positions 210,000 through 220,000 from the reference sequence.

Idx = getIndex(GTFAnnotObj,210000,220000)
Idx = 16×1

     7
    15
    16
    17
    36
    47
    48
    49
    69
    70
      ⋮

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 = 9×1

    61
    62
    63
    64
    65
    66
    67
    68
    69

Input Arguments

collapse all

Feature annotations, specified as a GTFAnnotation or GFFAnnotation object.

Start of a range in each reference sequence in AnnotObj, specified as a nonnegative integer less than or equal to EndPos.

Data Types: double

End of a range in each reference sequence in AnnotObj, specified as a nonnegative integer greater than or equal to StartPos.

Data Types: double

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.

Example:

One or more reference sequences in AnnotObj, specified as a character vector, string, string vector, or cell array of character vectors. Only annotations whose reference field matches one of the character vectors or strings are included in Idx.

Data Types: char | string | cell

One or more features in AnnotObj, specified as a character vector, string, string vector, or cell array of character vectors. Only annotations whose feature field matches one of the character vectors or strings are included in Idx.

Data Types: char | string | cell

One or more genes in AnnotObj of type GTFAnnotation, specified as a character vector, string, string vector, or cell array of character vectors. Only annotations whose gene field matches one of the character vectors or strings are included in Idx.

Data Types: char | string | cell

One or more transcripts in AnnotObj of type GTFAnnotation, specified as a character vector, string, string vector, or cell array of character vectors. Only annotations whose transcript field matches one of the character vectors or strings are included in Idx.

Data Types: char | string | cell

Minimum number of base positions that annotation must overlap in the range, to be included in Idx, specified as a positive integer, "full" or "start". Use "full" when an annotation must be fully contained in the range to be included. Use "start" when an annotation’s start position must lie within the range to be included.

Data Types: double | char | string

Output Arguments

collapse all

Indices of elements in AnnotObj, returned as an array of integers.

Version History

Introduced in R2013a