Main Content

getKeys

Class: BioIndexedFile

Retrieve alphanumeric keys from source file associated with BioIndexedFile object

Syntax

Keys = getKeys(BioIFobj)

Description

Keys = getKeys(BioIFobj) returns Keys, a cell array of character vectors specifying all the keys to the entries in the source file associated with BioIFobj, a BioIndexedFile object. The keys appear in the same order as they do in the source file, even if they are not unique.

Input Arguments

BioIFobj

Object of the BioIndexedFile class.

Output Arguments

Keys

Cell array of character vectors specifying all the keys to the entries in the source file. The keys appear in the same order as they do in the source file, even if they are not unique.

Examples

Construct a BioIndexedFile object to access a table containing cross-references between gene names and gene ontology (GO) terms:

% Create variable containing full absolute path of source file
sourcefile = which('yeastgenes.sgd');
% Create a BioIndexedFile object from the source file. Indicate
% the source file is a tab-delimited file where contiguous rows
% with the same key are considered a single entry. Store the
% index file in the Current Folder. Indicate that keys are
% located in column 3 and that header lines are prefaced with !
gene2goObj = BioIndexedFile('mrtab', sourcefile, '.', ...
                            'KeyColumn', 3, 'HeaderPrefix','!')

Retrieve all the keys for the entries in the source file, then view the first 12 keys:

% Retrieve all keys for entries in gene2goObj
keys = getKeys(gene2goObj);
% View the first 12 keys
keys(1:12)
ans = 

    '15S_RRNA'
    '21S_RRNA'
    'AAC1'
    'AAC3'
    'AAD10'
    'AAD14'
    'AAD15'
    'AAD16'
    'AAD3'
    'AAD4'
    'AAD6'
    'AAH1'

Tips

Use this method to see a complete list of the alphanumeric keys, in the order they occur in the source file from which the BioIndexedFile object was created.