getIndex

Class: GTFAnnotation

Return index array of annotations from GTFAnnotation 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 GTFAnnotation 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 Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'Reference'

String or cell array of strings specifying one or more reference sequences in AnnotObj. Only indices of annotations whose reference field matches one of the strings are included in Idx.

'Feature'

String or cell array of strings specifying one or more features in AnnotObj. Only indices of annotations whose feature field matches one of the strings are included in Idx.

'Gene'

String or cell array of strings specifying one or more genes in AnnotObj. Only annotations whose gene field matches one of the strings are included in AnnotStruct.

'Transcript'

String or cell array of strings specifying one or more transcripts in AnnotObj. Only annotations whose transcript field matches one of the strings are included in AnnotStruct.

'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

Retrieve Indices of Annotations from a GTFAnnotation Object

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 =

     7
    15
    16
    17
    36
    47
    48
    49
    69
    70
    71
    89
    99
   111
   112
   113
Was this topic helpful?