Sleipnir
Public Member Functions
Sleipnir::COntologyKEGG Class Reference

Implements IOntology for the KEGG orthology. More...

#include <annotation.h>

Inheritance diagram for Sleipnir::COntologyKEGG:
Sleipnir::COntologyKEGGImpl Sleipnir::IOntology

Public Member Functions

bool Open (std::istream &istm, CGenome &Genome, const std::string &strOrganism, bool fSynonyms=false)
 Initializes the ontology using a KEGG "ko" file.
void GetGeneNames (std::vector< std::string > &vecstrGenes) const
 Obtain the primary gene names for all genes in the ontology.
void TermFinder (const CGenes &Genes, std::vector< STermFound > &vecsTerms, bool fBonferroni=true, bool fRecursive=true, bool fGenome=false, float dPValue=1, const CGenes *pBackground=NULL) const
 Uses the hypergeometric distribution to find functional enrichments of the given gene set.
size_t GetNode (const std::string &strID) const
 Returns the ontology term index corresponding to the given ontology-specific ID string.
bool IsAnnotated (size_t iTerm, const CGene &Gene, bool fRecursive) const
 Indicates whether the given gene is annotated to or (optionally) below the given term.
size_t GetNodes () const
 Returns the number of nodes (terms) in the ontology.
const std::string & GetID () const
 Returns string identifier of the encapsulated ontology.
const std::string & GetID (size_t iTerm) const
 Returns the ontology-specific ID string of the requested term.
const std::string & GetGloss (size_t iTerm) const
 Returns the ontology-specific description of the requested term.
size_t GetParents (size_t iTerm) const
 Returns the number of parents of the requested term.
size_t GetParent (size_t iTerm, size_t iParent) const
 Returns the ontology term index of the requested parent of the requested term.
size_t GetChildren (size_t iTerm) const
 Returns the number of children of the requested term.
size_t GetChild (size_t iTerm, size_t iChild) const
 Returns the ontology term index of the requested child of the requested term.
size_t GetGenes (size_t iTerm, bool fRecursive) const
 Returns the number of genes annotated to or (optionally) below this term.
const CGeneGetGene (size_t iTerm, size_t iGene) const
 Returns the requested gene annotated to or below the given term.
bool GetParents (size_t iTerm, std::set< size_t > &setiParents) const
 Retrieves the parent term IDs of the requested term.
bool GetChildren (size_t iTerm, std::set< size_t > &setiChildren) const
 Retrieves the descendant term IDs of the requested term.

Detailed Description

Implements IOntology for the KEGG orthology.

COntologyKEGG parses the "ko" file from the Kyoto Encyclopedia of Genes and Genomes to extract organism-independent function annotations from KEGG.

Definition at line 367 of file annotation.h.


Member Function Documentation

size_t Sleipnir::COntologyKEGG::GetChild ( size_t  iTerm,
size_t  iChild 
) const [inline, virtual]

Returns the ontology term index of the requested child of the requested term.

Parameters:
iTermIndex of ontology term.
iChildChild to retrieve.
Returns:
Ontology term index of the requested child.
Remarks:
Requested child must be less than IOntology::GetChildren.

Implements Sleipnir::IOntology.

Definition at line 419 of file annotation.h.

size_t Sleipnir::COntologyKEGG::GetChildren ( size_t  iTerm) const [inline, virtual]

Returns the number of children of the requested term.

Parameters:
iTermIndex of ontology term.
Returns:
Number of children of the requested term.

Implements Sleipnir::IOntology.

Definition at line 415 of file annotation.h.

Referenced by GetChildren().

bool Sleipnir::COntologyKEGG::GetChildren ( size_t  iTerm,
std::set< size_t > &  setiChildren 
) const [inline, virtual]

Retrieves the descendant term IDs of the requested term.

Parameters:
iTermIndex of ontology term.
setiChildrenOutput set of descendant term IDs.
Returns:
True on success, false otherwise.
Remarks:
Operates recursively, returning all nodes between iTerm and the ontology leaves.
See also:
GetChildren | GetChild

Implements Sleipnir::IOntology.

Definition at line 435 of file annotation.h.

References GetChildren().

const CGene& Sleipnir::COntologyKEGG::GetGene ( size_t  iTerm,
size_t  iGene 
) const [inline, virtual]

Returns the requested gene annotated to or below the given term.

Parameters:
iTermOntology term index from which to retrieve gene.
iGeneIndex of gene within the requested term.
Returns:
Gene annotation at the requested index.
Remarks:
If iGene is less than the number of genes annotated directly to the term, a direct annotation is returned. Otherwise, descendant terms are searched and the requested gene index is retrieved from this set. iGene must be less than the value of IOntology::GetGenes.

Implements Sleipnir::IOntology.

Definition at line 427 of file annotation.h.

void Sleipnir::COntologyKEGG::GetGeneNames ( std::vector< std::string > &  vecstrGenes) const [inline, virtual]

Obtain the primary gene names for all genes in the ontology.

Parameters:
vecstrGenesOutputs primary gene names for all genes in the ontology.

Implements Sleipnir::IOntology.

Definition at line 372 of file annotation.h.

size_t Sleipnir::COntologyKEGG::GetGenes ( size_t  iTerm,
bool  fRecursive 
) const [inline, virtual]

Returns the number of genes annotated to or (optionally) below this term.

Parameters:
iTermOntology term index.
fRecursiveIf true, include gene annotations to descendant terms.
Returns:
Number of genes annotated to or below this term.

Implements Sleipnir::IOntology.

Definition at line 423 of file annotation.h.

const std::string& Sleipnir::COntologyKEGG::GetGloss ( size_t  iTerm) const [inline, virtual]

Returns the ontology-specific description of the requested term.

Parameters:
iTermIndex of ontology term.
Returns:
Ontology-specific description of the requested term (e.g. "mitotic cell cycle").

Implements Sleipnir::IOntology.

Definition at line 403 of file annotation.h.

const std::string& Sleipnir::COntologyKEGG::GetID ( ) const [inline, virtual]

Returns string identifier of the encapsulated ontology.

Returns:
String identifier of the ontology.

Implements Sleipnir::IOntology.

Definition at line 395 of file annotation.h.

Referenced by GetID().

const std::string& Sleipnir::COntologyKEGG::GetID ( size_t  iTerm) const [inline, virtual]

Returns the ontology-specific ID string of the requested term.

Parameters:
iTermIndex of ontology term.
Returns:
Ontology-specific ID of the requested term (e.g. "GO:0007093").

Implements Sleipnir::IOntology.

Definition at line 399 of file annotation.h.

References GetID().

size_t Sleipnir::COntologyKEGG::GetNode ( const std::string &  strID) const [inline, virtual]

Returns the ontology term index corresponding to the given ontology-specific ID string.

Parameters:
strIDOntology term ID to retrieve (e.g. "GO:0007093").
Returns:
The index of the requested term, -1 if not found.

Implements Sleipnir::IOntology.

Definition at line 383 of file annotation.h.

size_t Sleipnir::COntologyKEGG::GetNodes ( ) const [inline, virtual]

Returns the number of nodes (terms) in the ontology.

Returns:
Number of nodes (terms) in the ontology.

Implements Sleipnir::IOntology.

Definition at line 391 of file annotation.h.

size_t Sleipnir::COntologyKEGG::GetParent ( size_t  iTerm,
size_t  iParent 
) const [inline, virtual]

Returns the ontology term index of the requested parent of the requested term.

Parameters:
iTermIndex of ontology term.
iParentParent to retrieve.
Returns:
Ontology term index of the requested parent.
Remarks:
Requested parent must be less than IOntology::GetParents.

Implements Sleipnir::IOntology.

Definition at line 411 of file annotation.h.

size_t Sleipnir::COntologyKEGG::GetParents ( size_t  iTerm) const [inline, virtual]

Returns the number of parents of the requested term.

Parameters:
iTermIndex of ontology term.
Returns:
Number of parents of the requested term.

Implements Sleipnir::IOntology.

Definition at line 407 of file annotation.h.

Referenced by GetParents().

bool Sleipnir::COntologyKEGG::GetParents ( size_t  iTerm,
std::set< size_t > &  setiParents 
) const [inline, virtual]

Retrieves the parent term IDs of the requested term.

Parameters:
iTermIndex of ontology term.
setiParentsOutput set of parent term IDs.
Returns:
True on success, false otherwise.
Remarks:
Operates recursively, returning all nodes between iTerm and the ontology root.
See also:
GetParents | GetParent

Implements Sleipnir::IOntology.

Definition at line 431 of file annotation.h.

References GetParents().

bool Sleipnir::COntologyKEGG::IsAnnotated ( size_t  iTerm,
const CGene Gene,
bool  fRecursive 
) const [inline, virtual]

Indicates whether the given gene is annotated to or (optionally) below the given term.

Parameters:
iTermOntology term index.
GeneGene for which annotation is tested.
fRecursiveIf true, include annotations to descendants of the given term.
Returns:
True if the given gene is annotated to or (optionally) below the given term.

Implements Sleipnir::IOntology.

Definition at line 387 of file annotation.h.

bool Sleipnir::COntologyKEGG::Open ( std::istream &  istm,
CGenome Genome,
const std::string &  strOrganism,
bool  fSynonyms = false 
)

Initializes the ontology using a KEGG "ko" file.

Parameters:
istmStream from which ko file is read.
GenomeGenome into which genes are inserted or read during annotation parsing.
strOrganismOrganism identifier for which annotations should be read (e.g. "SCE" or "HSA").
fSynonymsIf true, use the first ko synonym (when present) as the primary gene name; otherwise, use the ko file's gene identifier.
Returns:
True if the ontology was successfully initialized.

Given an input stream containing a ko file from the KEGG orthology, COntologyKEGG::Open parses both the structure of KEGG (usually a flat set of non-hierarchical pathways) and the genes annotated to each KEGG term. Terms are identified by KEGG IDs (e.g. "ko00624"), and genes are identified by the ko ID or first synonym as specified by the fSynonyms parameter. Genes are retrieved from Genome if already present or inserted if not; it is thus important to ensure that the proper primary gene names are used so as to agree with any identifiers already present in Genome.

Remarks:
For yeast, leaving fSynonyms false will use ORF IDs as the primary gene name (usually the desired behavior); setting it true will use common names. For mouse or human, leaving fSynonyms false will use Entrez gene IDs as the primary gene name; setting it true will use HGNC symbols (usually the desired behavior). For worm, fSynonyms should always be false to use systematic transcript IDs as the primary gene name. For fly, leaving fSynonyms false will use Flybase gene IDs as the primary gene name (usually the desired behavior); setting it true will use common names. For other organisms, please inspect the ko file.

Definition at line 69 of file annotationkegg.cpp.

References Sleipnir::CGene::AddAnnotation().

void Sleipnir::COntologyKEGG::TermFinder ( const CGenes Genes,
std::vector< STermFound > &  vecsTerms,
bool  fBonferroni = true,
bool  fRecursive = true,
bool  fGenome = false,
float  dPValue = 1,
const CGenes pBackground = NULL 
) const [inline, virtual]

Uses the hypergeometric distribution to find functional enrichments of the given gene set.

Parameters:
GenesGene set to test for functional enrichments.
vecsTermsOutput statistics for the given genes over all terms in the ontology.
fBonferroniIf true, p-values are Bonferroni corrected.
fRecursiveIf true, annotations to descendants are used when calculating term overlaps.
fGenomeIf true, use all genes in the genome as background; otherwise, use only genes with at least one annotation in the ontology.
dPValueOnly terms significant below this p-value will be recorded.
pBackgroundIf non-null, use the given gene set as the background.

TermFinder uses the GO::TermFinder technique of Boyle, Sherlock, et al to calculate ontology terms (i.e. functions) enriched in the given gene set. This involves significance testing the overlap of the given gene set with annotations to every ontology term using the hypergeometric test.

Implements Sleipnir::IOntology.

Definition at line 376 of file annotation.h.


The documentation for this class was generated from the following files: