getEntryByIndex
Class: BioIndexedFile
Retrieve entries from source file associated with BioIndexedFile object using numeric index
Syntax
Entries
= getEntryByIndex(BioIFobj
, Indices
)
Description
extracts
entries from the source file associated with Entries
= getEntryByIndex(BioIFobj
, Indices
)BioIFobj
,
a BioIndexedFile object. It extracts and concatenates the entries
specified by Indices
, a numeric vector
of positive integers. It returns Entries
,
a character vector of concatenated entries. The value of each element
in Indices
must be less than or equal to
the number of entries in the source file. A one-to-one relationship
exists between the number and order of elements in Indices
and
the output Entries
, even if Indices
has
repeated entries.
Input Arguments
|
Object of the |
|
Numeric vector of positive integers. The value of each element
must be less than or equal to the number of entries in the source
file associated with |
Output Arguments
|
Character vector of concatenated entries extracted from the
source file associated with |
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','!')
Return the first, third, and fifth entries from the source file:
% Access 1st, 3rd, and 5th entries subset_entries = getEntryByIndex(gene2goObj, [1 3 5]);
Tips
Use this method to visualize and explore a subset of the entries in the source file for validation purposes.