Sleipnir
Public Member Functions | Static Public Member Functions | Static Public Attributes
Sleipnir::COntologyOBO Class Reference

Implements IOntology for OBO based Ontologies. More...

#include <annotation.h>

Inheritance diagram for Sleipnir::COntologyOBO:
Sleipnir::COntologyOBOImpl Sleipnir::IOntology

Public Member Functions

bool Open (std::istream &istmOntology, std::istream &istmAnnotations, CGenome &Genome, const char *szNamespace, bool fDatabaseIDs=false, bool fSynonyms=false)
 Initializes the ontology from one aspect of the Gene Ontology using OBO structure and GO annotation files.
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.

Static Public Member Functions

static bool Open (std::istream &istmOntology, std::istream &istmAnnotations, CGenome &Genome, COntologyOBO &OntoBP, COntologyOBO &OntoMF, COntologyOBO &OntoCC, bool fDatabaseIDs=false, bool fSynonyms=false)
 Initializes three aspects of the Gene Ontology using OBO structure and GO annotation files.

Static Public Attributes

static const char c_szBiologicalProcess [] = "biological_process"
 Common Gene Ontology aspects/namespaces: biological process.
static const char c_szCellularComponent [] = "cellular_component"
 Common Gene Ontology aspects/namespaces: cellular component.
static const char c_szMolecularFunction [] = "molecular_function"
 Common Gene Ontology aspects/namespaces: molecular function.

Detailed Description

Implements IOntology for OBO based Ontologies.

COntologyOBO parses OBO and annotation files to obtain the structure and annotations for OBO ontologies.

Definition at line 447 of file annotation.h.


Member Function Documentation

size_t Sleipnir::COntologyOBO::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 520 of file annotation.h.

size_t Sleipnir::COntologyOBO::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 516 of file annotation.h.

Referenced by GetChildren().

bool Sleipnir::COntologyOBO::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 536 of file annotation.h.

References GetChildren().

const CGene& Sleipnir::COntologyOBO::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 528 of file annotation.h.

void Sleipnir::COntologyOBO::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 473 of file annotation.h.

size_t Sleipnir::COntologyOBO::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 524 of file annotation.h.

const std::string& Sleipnir::COntologyOBO::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 504 of file annotation.h.

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

Returns string identifier of the encapsulated ontology.

Returns:
String identifier of the ontology.

Implements Sleipnir::IOntology.

Definition at line 496 of file annotation.h.

Referenced by GetID().

const std::string& Sleipnir::COntologyOBO::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 500 of file annotation.h.

References GetID().

size_t Sleipnir::COntologyOBO::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 484 of file annotation.h.

size_t Sleipnir::COntologyOBO::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 492 of file annotation.h.

size_t Sleipnir::COntologyOBO::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 512 of file annotation.h.

size_t Sleipnir::COntologyOBO::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 508 of file annotation.h.

Referenced by GetParents().

bool Sleipnir::COntologyOBO::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 532 of file annotation.h.

References GetParents().

bool Sleipnir::COntologyOBO::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 488 of file annotation.h.

bool Sleipnir::COntologyOBO::Open ( std::istream &  istmOntology,
std::istream &  istmAnnotations,
CGenome Genome,
COntologyOBO OntoBP,
COntologyOBO OntoMF,
COntologyOBO OntoCC,
bool  fDatabaseIDs = false,
bool  fSynonyms = false 
) [static]

Initializes three aspects of the Gene Ontology using OBO structure and GO annotation files.

Parameters:
istmOntologyStream from which OBO structure file is read.
istmAnnotationsStream from which gene annotation file is read.
GenomeGenome into which genes are inserted or read during annotation parsing.
OntoBPOntology initialized with GO's biological process aspect.
OntoMFOntology initialized with GO's molecular function aspect.
OntoCCOntology initialized with GO's cellular compartment aspect.
fDatabaseIDsIf true, use annotation database IDs as primary gene names.
fSynonymsIf true, use first gene synonym (if present) as primary gene names.
Returns:
True if the ontologies were successfully initialized.

Equivalent to calling COntologyOBO::Open three times for the three GO aspects.

Definition at line 94 of file annotationobo.cpp.

References c_szBiologicalProcess, c_szCellularComponent, c_szMolecularFunction, and Open().

Referenced by Open().

bool Sleipnir::COntologyOBO::Open ( std::istream &  istmOntology,
std::istream &  istmAnnotations,
CGenome Genome,
const char *  szNamespace,
bool  fDatabaseIDs = false,
bool  fSynonyms = false 
)

Initializes the ontology from one aspect of the Gene Ontology using OBO structure and GO annotation files.

Parameters:
istmOntologyStream from which OBO structure file is read.
istmAnnotationsStream from which gene annotation file is read.
GenomeGenome into which genes are inserted or read during annotation parsing.
szNamespaceAspect (namespace) of GO to use for this ontology.
fDatabaseIDsIf true, use annotation database IDs as primary gene names.
fSynonymsIf true, use first gene synonym (if present) as primary gene names.
Returns:
True if the ontology was successfully initialized.

COntologyOBO::Open parses the structure of one aspect of the Gene Ontology from the given (organism-independent) OBO file and obtains gene annotations from the given (organism-specific) annotation file. Terms are identified by GO IDs (e.g. "GO:0007093"), and genes are identified by the annotation name, first synonym, or database ID as specified by the fSynonyms and fDatabaseIDs parameters. 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, fSynonyms and fDatabaseIDs should both be false to use ORF IDs as primary gene names (false will use common names). For human, it is recommended to pre-map annotation IDs to HGNC symbols, as the default IPI and Uniprot peptide IDs can be extremely ambiguous. For mouse, fDatabaseIDs should be true to use MGI IDs as primary gene names. For worm, fDatabaseIDs should be true to use Wormbase gene IDs as primary gene names, or fSynonyms should be true to use systematic transcript IDs (both false will use common names). For fly, fDatabaseIDs should be true to use Flybase gene IDs as primary gene names.
See also:
COntologyOBO::Open

Definition at line 156 of file annotationobo.cpp.

void Sleipnir::COntologyOBO::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 477 of file annotation.h.


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