sub _fetch_ancestor_chart { my ( $this, $term ) = @_; assert_ref( $term, 'Bio::EnsEMBL::OntologyTerm' ); my $statement = q( SELECT subparent_term.term_id, parent_term.term_id, relation_type.name FROM closure JOIN relation ON (relation.parent_term_id = closure.parent_term_id AND relation.child_term_id = closure.subparent_term_id) JOIN relation_type USING (relation_type_id) JOIN term subparent_term ON (subparent_term.term_id = closure.subparent_term_id) JOIN term parent_term ON (parent_term.term_id = closure.parent_term_id) WHERE closure.child_term_id = ? ORDER BY closure.distance); my $sth = $this->prepare($statement); $sth->bind_param( 1, $term->dbID(), SQL_INTEGER ); $sth->execute(); my ( $subparent_id, $parent_id, $relation ); $sth->bind_columns( \( $subparent_id, $parent_id, $relation ) ); my %id_chart; my %acc_chart; while ( $sth->fetch() ) { if ( !exists( $id_chart{$parent_id} ) ) { $id_chart{$parent_id} = {}; } push( @{ $id_chart{$subparent_id}{$relation} }, $parent_id ); } my @terms = @{ $this->fetch_all_by_dbID_list( [ keys(%id_chart) ] ) }; foreach my $term (@terms) { $id_chart{ $term->dbID() }{'term'} = $term; $acc_chart{ $term->accession() }{'term'} = $term; } foreach my $term (@terms) { my $accession = $term->accession(); my $dbID = $term->dbID(); foreach my $relation ( keys( %{ $id_chart{$dbID} } ) ) { if ( $relation eq 'term' ) { next } foreach my $id ( @{ $id_chart{$dbID}{$relation} } ) { push( @{ $acc_chart{$accession}{$relation} }, $id_chart{$id}{'term'} ); } } } return \%acc_chart; } ## end sub _fetch_ancestor_chart

Class Summary
Synopsis
my $goa = $registry-\>get_adaptor( 'Multi', 'Ontology', 'OntologyTerm' ); my $term = $goa-\>fetch_by_accession('GO:0010885'); my @children = @{ $goa-\>fetch_all_by_parent_term($term) }; my @descendants = @{ $goa-\>fetch_all_by_ancestor_term($term) }; my @parents = @{ $goa-\>fetch_all_by_child_term($term) }; my @ancestors = @{ $goa-\>fetch_all_by_descendant_term($term) }; my %ancestor_chart = %{ $goa-\>_fetch_ancestor_chart($term) };
Description
An abstract adaptor class for fetching ontology terms, creates Bio::EnsEMBL::OntologyTerm objects.
Definition at line 31 of file OntologyTermAdaptor.pm.
Method Documentation
protected Bio::EnsEMBL::DBSQL::BaseAdaptor::_columns | ( | ) | [inherited] |
Undocumented method

Reimplemented in Bio::EnsEMBL::DBSQL::DensityFeatureAdaptor, Bio::EnsEMBL::DBSQL::DnaAlignFeatureAdaptor, Bio::EnsEMBL::DBSQL::ExonAdaptor, Bio::EnsEMBL::DBSQL::GeneAdaptor, Bio::EnsEMBL::DBSQL::KaryotypeBandAdaptor, Bio::EnsEMBL::DBSQL::MiscFeatureAdaptor, Bio::EnsEMBL::DBSQL::OperonAdaptor, Bio::EnsEMBL::DBSQL::OperonTranscriptAdaptor, Bio::EnsEMBL::DBSQL::PredictionExonAdaptor, Bio::EnsEMBL::DBSQL::PredictionTranscriptAdaptor, Bio::EnsEMBL::DBSQL::ProteinAlignFeatureAdaptor, Bio::EnsEMBL::DBSQL::RepeatFeatureAdaptor, Bio::EnsEMBL::DBSQL::SimpleFeatureAdaptor, Bio::EnsEMBL::DBSQL::SplicingEventAdaptor, Bio::EnsEMBL::DBSQL::SplicingEventFeatureAdaptor, Bio::EnsEMBL::DBSQL::SplicingTranscriptPairAdaptor, Bio::EnsEMBL::DBSQL::TranscriptAdaptor, Bio::EnsEMBL::DBSQL::UnmappedObjectAdaptor, Bio::EnsEMBL::Map::DBSQL::MarkerFeatureAdaptor, Bio::EnsEMBL::Map::DBSQL::QtlAdaptor, and Bio::EnsEMBL::Map::DBSQL::QtlFeatureAdaptor.
protected Bio::EnsEMBL::DBSQL::BaseAdaptor::_default_where_clause | ( | ) | [inherited] |
Undocumented method

Reimplemented in Bio::EnsEMBL::DBSQL::MiscFeatureAdaptor, Bio::EnsEMBL::DBSQL::RepeatFeatureAdaptor, Bio::EnsEMBL::Map::DBSQL::MarkerFeatureAdaptor, and Bio::EnsEMBL::Map::DBSQL::QtlFeatureAdaptor.
protected A Bio::EnsEMBL::DBSQL::OntologyTermAdaptor::_fetch_ancestor_chart | ( | ) |
Arg [1] : Bio::EnsEMBL::OntologyTerm The term whose ancestor terms should be fetched.
Description : Given a child ontology term, returns a hash structure containing its ancestor terms, up to and including any root term. Relations of the type 'is_a' and 'part_of' are included.
Example :
my %chart = %{ $ot_adaptor->_fetch_ancestor_chart($term) };
Return type : A reference to a hash structure like this:
{ 'GO:XXXXXXX' => { 'term' => # ref to Bio::EnsEMBL::OntologyTerm object 'is_a' => [...], # listref of Bio::EnsEMBL::OntologyTerm 'part_of' => [...], # listref of Bio::EnsEMBL::OntologyTerm }, 'GO:YYYYYYY' => { # Similarly for all ancestors, # and including the query term itself. } }

protected Bio::EnsEMBL::DBSQL::OntologyTermAdaptor::_fetch_synonyms_by_dbID | ( | ) |
Undocumented method

protected Bio::EnsEMBL::DBSQL::BaseAdaptor::_final_clause | ( | ) | [inherited] |
Undocumented method

Reimplemented in Bio::EnsEMBL::DBSQL::ExonAdaptor, Bio::EnsEMBL::DBSQL::MiscFeatureAdaptor, and Bio::EnsEMBL::DBSQL::PredictionExonAdaptor.
protected Bio::EnsEMBL::DBSQL::BaseAdaptor::_left_join | ( | ) | [inherited] |
Undocumented method

Reimplemented in Bio::EnsEMBL::DBSQL::DnaAlignFeatureAdaptor, Bio::EnsEMBL::DBSQL::GeneAdaptor, Bio::EnsEMBL::DBSQL::MiscFeatureAdaptor, Bio::EnsEMBL::DBSQL::ProteinAlignFeatureAdaptor, Bio::EnsEMBL::DBSQL::SplicingEventAdaptor, Bio::EnsEMBL::DBSQL::TranscriptAdaptor, Bio::EnsEMBL::DBSQL::UnmappedObjectAdaptor, Bio::EnsEMBL::Map::DBSQL::MarkerFeatureAdaptor, and Bio::EnsEMBL::Map::DBSQL::QtlFeatureAdaptor.
protected Bio::EnsEMBL::DBSQL::BaseAdaptor::_list_dbIDs | ( | ) | [inherited] |
Undocumented method

protected Bio::EnsEMBL::DBSQL::BaseAdaptor::_objs_from_sth | ( | ) | [inherited] |
Undocumented method

Reimplemented in Bio::EnsEMBL::DBSQL::DensityFeatureAdaptor, Bio::EnsEMBL::DBSQL::DnaAlignFeatureAdaptor, Bio::EnsEMBL::DBSQL::ExonAdaptor, Bio::EnsEMBL::DBSQL::GeneAdaptor, Bio::EnsEMBL::DBSQL::KaryotypeBandAdaptor, Bio::EnsEMBL::DBSQL::MiscFeatureAdaptor, Bio::EnsEMBL::DBSQL::OperonAdaptor, Bio::EnsEMBL::DBSQL::OperonTranscriptAdaptor, Bio::EnsEMBL::DBSQL::PredictionExonAdaptor, Bio::EnsEMBL::DBSQL::PredictionTranscriptAdaptor, Bio::EnsEMBL::DBSQL::ProteinAlignFeatureAdaptor, Bio::EnsEMBL::DBSQL::RepeatFeatureAdaptor, Bio::EnsEMBL::DBSQL::SimpleFeatureAdaptor, Bio::EnsEMBL::DBSQL::SplicingEventAdaptor, Bio::EnsEMBL::DBSQL::TranscriptAdaptor, Bio::EnsEMBL::DBSQL::UnconventionalTranscriptAssociationAdaptor, Bio::EnsEMBL::DBSQL::UnmappedObjectAdaptor, Bio::EnsEMBL::Map::DBSQL::MarkerFeatureAdaptor, and Bio::EnsEMBL::Map::DBSQL::QtlFeatureAdaptor.
protected Bio::EnsEMBL::DBSQL::BaseAdaptor::_straight_join | ( | ) | [inherited] |
Undocumented method

protected Bio::EnsEMBL::DBSQL::BaseAdaptor::_tables | ( | ) | [inherited] |
Undocumented method

Reimplemented in Bio::EnsEMBL::DBSQL::DataFileAdaptor, Bio::EnsEMBL::DBSQL::DensityFeatureAdaptor, Bio::EnsEMBL::DBSQL::DnaAlignFeatureAdaptor, Bio::EnsEMBL::DBSQL::ExonAdaptor, Bio::EnsEMBL::DBSQL::GeneAdaptor, Bio::EnsEMBL::DBSQL::KaryotypeBandAdaptor, Bio::EnsEMBL::DBSQL::MiscFeatureAdaptor, Bio::EnsEMBL::DBSQL::OperonAdaptor, Bio::EnsEMBL::DBSQL::OperonTranscriptAdaptor, Bio::EnsEMBL::DBSQL::PredictionExonAdaptor, Bio::EnsEMBL::DBSQL::PredictionTranscriptAdaptor, Bio::EnsEMBL::DBSQL::ProteinAlignFeatureAdaptor, Bio::EnsEMBL::DBSQL::RepeatFeatureAdaptor, Bio::EnsEMBL::DBSQL::SimpleFeatureAdaptor, Bio::EnsEMBL::DBSQL::SplicingEventAdaptor, Bio::EnsEMBL::DBSQL::SplicingEventFeatureAdaptor, Bio::EnsEMBL::DBSQL::SplicingTranscriptPairAdaptor, Bio::EnsEMBL::DBSQL::TranscriptAdaptor, Bio::EnsEMBL::DBSQL::UnmappedObjectAdaptor, Bio::EnsEMBL::Map::DBSQL::MarkerFeatureAdaptor, and Bio::EnsEMBL::Map::DBSQL::QtlFeatureAdaptor.
public Listref Bio::EnsEMBL::DBSQL::BaseAdaptor::bind_param_generic_fetch | ( | ) | [inherited] |
Arg [1] : (optional) scalar $param This is the parameter to bind Arg [2] : (optional) int $sql_type Type of the parameter (from DBI (:sql_types)) Example : $adaptor->bind_param_generic_fetch($stable_id,SQL_VARCHAR); $adaptor->generic_fetch(); Description: When using parameters for the query, will call the bind_param to avoid some security issues. If there are no arguments, will return the bind_parameters ReturnType : listref Exceptions: if called with one argument

public Bio::EnsEMBL::DBSQL::DBAdaptor Bio::EnsEMBL::DBSQL::BaseAdaptor::db | ( | ) | [inherited] |
Arg [1] : (optional) Bio::EnsEMBL::DBSQL::DBAdaptor $obj the database this adaptor is using. Example : $db = $adaptor->db(); Description: Getter/Setter for the DatabaseConnection that this adaptor is using. Returntype : Bio::EnsEMBL::DBSQL::DBAdaptor Exceptions : none Caller : Adaptors inherited from BaseAdaptor Status : Stable

public Bio::EnsEMBL::DBSQL::DBConnection Bio::EnsEMBL::DBSQL::BaseAdaptor::dbc | ( | ) | [inherited] |
Arg [1] : (optional) Bio::EnsEMBL::DBSQL::DBConnection $obj the database this adaptor is using. Example : $db = $adaptor->db(); Description: Getter/Setter for the DatabaseConnection that this adaptor is using. Returntype : Bio::EnsEMBL::DBSQL::DBConnection Exceptions : none Caller : Adaptors inherited from BaseAdaptor Status : Stable

public Bio::EnsEMBL::DBSQL::BaseAdaptor::dump_data | ( | ) | [inherited] |
Undocumented method

public Bio::EnsEMBL::DBSQL::OntologyTermAdaptor::fetch_all | ( | ) |
public Listref Bio::EnsEMBL::DBSQL::OntologyTermAdaptor::fetch_all_by_ancestor_term | ( | ) |
Arg [1] : Bio::EnsEMBL::OntologyTerm The term whose descendant terms should be fetched.
Description : Given a parent ontology term, returns a list of all its descendant terms, down to and including any leaf terms. Relations of the type 'is_a' and 'part_of' are followed.
Example :
my @descendants = @{ $ot_adaptor->fetch_all_by_ancestor_term($term) };
Return type : listref of Bio::EnsEMBL::OntologyTerm

public Listref Bio::EnsEMBL::DBSQL::OntologyTermAdaptor::fetch_all_by_child_term | ( | ) |
Arg [1] : Bio::EnsEMBL::OntologyTerm The term whose parent terms should be fetched.
Description : Given a child ontology term, returns a list of its immediate parent terms.
Example :
my @parents = @{ $ot_adaptor->fetch_all_by_child_term($term) };
Return type : listref of Bio::EnsEMBL::OntologyTerm

public Bio::EnsEMBL::DBSQL::OntologyTermAdaptor::fetch_all_by_dbID_list | ( | ) |
public Listref Bio::EnsEMBL::DBSQL::OntologyTermAdaptor::fetch_all_by_descendant_term | ( | ) |
Arg [1] : Bio::EnsEMBL::OntologyTerm The term whose ancestor terms should be fetched.
Arg [2] : (optional) String The subset within the ontolgy to which the query should be restricted. The subset may be specified as a SQL pattern, e.g., "\%goslim\%" (but "goslim\%" might not do what you expect), or as a specific subset name, e.g., "goslim_generic".
Arg [3] : (optional) Boolean If true (non-zero), only return the closest term(s). If this argument is true, and the previous argument is left undefined, this method will return the parent(s) of the given term.
Description : Given a child ontology term, returns a list of all its ancestor terms, up to and including any root term. Relations of the type 'is_a' and 'part_of' are followed. Optionally, only terms in a given subset of the ontology may be returned, and additionally one may ask to only get the closest term(s) to the given child term.
Example :
my @ancestors = @{ $ot_adaptor->fetch_all_by_descendant_term($term) };
Return type : listref of Bio::EnsEMBL::OntologyTerm

public Listref Bio::EnsEMBL::DBSQL::OntologyTermAdaptor::fetch_all_by_name | ( | ) |
Arg [1] : String, name of term, or SQL pattern Arg [2] : (optional) String, name of ontology
Description : Fetches ontology term(s) given a name, a synonym, or a SQL pattern like "\%splice_site\%"
Example :
my ($term) = @{ $ot_adaptor->fetch_by_name( 'DNA_binding_site', 'SO' ) };
# Will find terms in both SO and GO: my @terms = @{ $ot_adaptor->fetch_by_name('%splice_site%') };
Return type : listref of Bio::EnsEMBL::OntologyTerm

public Listref Bio::EnsEMBL::DBSQL::OntologyTermAdaptor::fetch_all_by_parent_term | ( | ) |
Arg [1] : Bio::EnsEMBL::OntologyTerm The term whose children terms should be fetched.
Description : Given a parent ontology term, returns a list of its immediate children terms.
Example :
my @children = @{ $ot_adaptor->fetch_all_by_parent_term($term) };
Return type : listref of Bio::EnsEMBL::OntologyTerm

public Bio::EnsEMBL::OntologyTerm Bio::EnsEMBL::DBSQL::OntologyTermAdaptor::fetch_by_accession | ( | ) |
Arg [1] : String
Description : Fetches an ontology term given an accession.
Example :
my $term = $ot_adaptor->fetch_by_accession('GO:0030326');
Return type : Bio::EnsEMBL::OntologyTerm

public Bio::EnsEMBL::DBSQL::OntologyTermAdaptor::fetch_by_dbID | ( | ) |
public Listref Bio::EnsEMBL::DBSQL::BaseAdaptor::generic_fetch | ( | ) | [inherited] |
Arg [1] : (optional) string $constraint An SQL query constraint (i.e. part of the WHERE clause) Arg [2] : (optional) Bio::EnsEMBL::AssemblyMapper $mapper A mapper object used to remap features as they are retrieved from the database Arg [3] : (optional) Bio::EnsEMBL::Slice $slice A slice that features should be remapped to Example : $fts = $a->generic_fetch('contig_id in (1234, 1235)', 'Swall'); Description: Performs a database fetch and returns feature objects in contig coordinates. Returntype : listref of Bio::EnsEMBL::SeqFeature in contig coordinates Exceptions : none Caller : BaseFeatureAdaptor, ProxyDnaAlignFeatureAdaptor::generic_fetch Status : Stable

Reimplemented in Bio::EnsEMBL::DBSQL::DataFileAdaptor.
public Bio::EnsEMBL::DBSQL::BaseAdaptor::get_dumped_data | ( | ) | [inherited] |
Undocumented method

public Boolean Bio::EnsEMBL::DBSQL::BaseAdaptor::is_multispecies | ( | ) | [inherited] |
Arg [1] : (optional) boolean $arg Example : if ($adaptor->is_multispecies()) { } Description: Getter/Setter for the is_multispecies boolean of to use for this adaptor. Returntype : boolean Exceptions : none Caller : general Status : Stable

public Scalar Bio::EnsEMBL::DBSQL::BaseAdaptor::last_insert_id | ( | ) | [inherited] |
Arg [1] : (optional) $field the name of the field the inserted ID was pushed into Arg [2] : (optional) HashRef used to pass extra attributes through to the DBD driver Description : Delegating method which uses DBI to extract the last inserted identifier. If using MySQL we just call the DBI method DBI::last_insert_id() since MySQL ignores any extra arguments. See DBI for more information about this delegated method. Example : my $id = $self->last_insert_id('my_id'); my $other_id = $self->last_insert_id(); Returntype : Scalar or undef

public Bio::EnsEMBL::DBSQL::BaseAdaptor Bio::EnsEMBL::DBSQL::BaseAdaptor::new | ( | ) | [inherited] |
Arg [1] : Bio::EnsEMBL::DBSQL::DBConnection $dbobj Example : $adaptor = new AdaptorInheritedFromBaseAdaptor($dbobj); Description: Creates a new BaseAdaptor object. The intent is that this constructor would be called by an inherited superclass either automatically or through $self->SUPER::new in an overridden new method. Returntype : Bio::EnsEMBL::DBSQL::BaseAdaptor Exceptions : none Caller : Bio::EnsEMBL::DBSQL::DBConnection Status : Stable

Reimplemented in Bio::EnsEMBL::DBSQL::AnalysisAdaptor, Bio::EnsEMBL::DBSQL::AssemblyExceptionFeatureAdaptor, Bio::EnsEMBL::DBSQL::AssemblyMapperAdaptor, Bio::EnsEMBL::DBSQL::AssemblySliceAdaptor, Bio::EnsEMBL::DBSQL::AttributeAdaptor, Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor, Bio::EnsEMBL::DBSQL::CoordSystemAdaptor, Bio::EnsEMBL::DBSQL::DensityFeatureAdaptor, Bio::EnsEMBL::DBSQL::DensityTypeAdaptor, Bio::EnsEMBL::DBSQL::GOTermAdaptor, Bio::EnsEMBL::DBSQL::MetaCoordContainer, Bio::EnsEMBL::DBSQL::MiscSetAdaptor, Bio::EnsEMBL::DBSQL::SequenceAdaptor, Bio::EnsEMBL::DBSQL::SliceAdaptor, Bio::EnsEMBL::DBSQL::SOTermAdaptor, Bio::EnsEMBL::DBSQL::StrainSliceAdaptor, Bio::EnsEMBL::DBSQL::UnmappedObjectAdaptor, and Bio::EnsEMBL::External::BlastAdaptor.
public DBI::StatementHandle Bio::EnsEMBL::DBSQL::BaseAdaptor::prepare | ( | ) | [inherited] |
Arg [1] : string $string a SQL query to be prepared by this adaptors database Example : $sth = $adaptor->prepare("select yadda from blabla") Description: provides a DBI statement handle from the adaptor. A convenience function so you dont have to write $adaptor->db->prepare all the time Returntype : DBI::StatementHandle Exceptions : none Caller : Adaptors inherited from BaseAdaptor Status : Stable

Reimplemented in Bio::EnsEMBL::DBSQL::SliceAdaptor, and Bio::EnsEMBL::External::BlastAdaptor.
public Int Bio::EnsEMBL::DBSQL::BaseAdaptor::species_id | ( | ) | [inherited] |
Arg [1] : (optional) int $species_id The internal ID of the species in a multi-species database. Example : $db = $adaptor->db(); Description: Getter/Setter for the internal ID of the species in a multi-species database. The default species ID is 1. Returntype : Integer Exceptions : none Caller : Adaptors inherited from BaseAdaptor Status : Stable

The documentation for this class was generated from the following file:
- Bio/EnsEMBL/DBSQL/OntologyTermAdaptor.pm