A database adaptor allowing access to the nodes of the NCBI taxonomy. It is currently managed independently of the registry: my $tax_dba = Bio::EnsEMBL::DBSQL::TaxonomyDBAdaptor->new( -user => $tax_user, -pass => $tax_pass, -dbname => $tax_db, -host => $tax_host, -port => $tax_port); my $node_adaptor = $tax_dba->get_TaxonomyNodeAdaptor(); # or alternatively my $node_adaptor = Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor->new($tax_dba); The TaxonomyNodeAdaptor handles TaxonomyNode objects, which represent nodes in the NCBI taxonomy There are two main practical uses for the : 1. Accessing the taxonomy database to find species of interest and to then find those within the ENA databases e.g. to find all descendants of the node representing Escherichia coli: my $node = $node_adaptor->fetch_by_taxon_id(562); for my $child (\@{$node_adaptor->fetch_descendants($node)}) { my $dbas = $helper->get_all_by_taxon_id($node->taxon_id()) if(defined $dbas) { for my $dba (\@{$dbas}) { # do something with the $dba } } } 2. Placing ENA species into a taxonomic hierarchy and manipulating that hierarchy (mainly for use in the web interface) # iterate over all dbas from a registry or ENARegistryHelper for my $dba (\@{$helper->get_all_DBAdaptors()}) { my $node = $node_adaptor->fetch_by_coredbadaptor($dba); # add the node to a hash set of leaf nodes if not already there if ( $leaf_nodes->{ $node->taxon_id() } ) { $node = $leaf_nodes->{ $node->taxon_id() }; } else { $leaf_nodes->{ $node->taxon_id() } = $node; } # attach the DBA to the node push \@{$node->dba()}, $dba; } my \@leaf_nodes = values(%$leaf_nodes); # get the root of the tree my $root = $node_adaptor->fetch_by_taxon_id(1); # get rid of all branches of the taxonomy that don't involve a node from the dba $node_adaptor->build_pruned_tree( $root, \\@leaf_nodes ); # collapse $node_adaptor->collapse_tree($root);
protected Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::_build_node_array | ( | ) |
Description: Build a sparse array based on left/right indices of a set of nodes to allow speedy lookup Argument: Arrayref of Bio::EnsEMBL::TaxonomyNode Return type: Arrayref containing arrayref of 1/0 by left/right, min left index, max right index
protected Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::_first_element | ( | ) |
Arg : arrayref Description: Utility method to return the first element in a list, undef if empty Returntype : arrayref element Exceptions : none Caller : internal Status : Stable
protected Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::_get_node | ( | ) |
Undocumented method
protected Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::_get_node_id | ( | ) |
Undocumented method
protected Bio::EnsEMBL::TaxonomyNode Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::_get_parent_by_index | ( | ) |
Description: Find the parent of a node, initially based on left/right index to find direct parent, and then by recursion through parents to work back to the closest common ancestor. Argument: Current node Argument: Prospective parent Return type: Bio::EnsEMBL::TaxonomyNode
protected Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::_restrict_set | ( | ) |
Description: Restrict the input set to those needed to build a tree including all members of the leaf set Argument: Arrayref of Bio::EnsEMBL::TaxonomyNode (leaf set) Argument: Arrayref of Bio::EnsEMBL::TaxonomyNode (input set) Return: Arrayref of Bio::EnsEMBL::TaxonomyNode
public void Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::add_descendants | ( | ) |
Description : Fetch descendants for the supplied node and assemble into a tree Argument : Bio::EnsEMBL::TaxonomyNode Return type : None
public Bio::EnsEMBL::TaxonomyNode Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::associate_nodes | ( | ) |
Description : Associate the supplied nodes into a tree based on left/right indices and return the root node Argument : Arrayref of Bio::EnsEMBL::TaxonomyNode Return type : Bio::EnsEMBL::TaxonomyNode
public void Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::build_pruned_tree | ( | ) |
Description : Restrict supplied tree by list of key leaf nodes Argument : Bio::EnsEMBL::TaxonomyNode Argument : Array ref of Bio::EnsEMBL::TaxonomyNode Return type : None
public void Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::collapse_tree | ( | ) |
Description : Remove all nodes from tree that do not fit the required criteria. By default, these are not branch points, the root node, leaf nodes or nodes with database adaptors. Argument : Bio::EnsEMBL::TaxonomyNode Argument : Array ref of Bio::EnsEMBL::TaxonomyNode Argument : (Optional) Subroutine reference which is used to define whether to retain a node Return type : None
public Int Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::distance_between_nodes | ( | ) |
Description : Count the number of steps in the shortest route from one node to another (via the common ancestor) Argument : Bio::EnsEMBL::TaxonomyNode Argument : Bio::EnsEMBL::TaxonomyNode Return type : Integer
public Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_all_by_name | ( | ) |
Description : Fetch an array of nodes which have a name LIKE the supplied String Argument : Name as String (can contain SQL wildcards) Return type : Arrayref of Bio::EnsEMBL::TaxonomyNode
public Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_all_by_name_and_class | ( | ) |
Description : Fetch an array of nodes which have a name and name class LIKE the supplied Strings Argument : Name as String (can contain SQL wildcards) Argument : Name class as String (can contain SQL wildcards) Return type : Arrayref of Bio::EnsEMBL::TaxonomyNode
public Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_all_by_name_and_rank | ( | ) |
Description : Fetch an array of nodes which have the supplied rank and a name LIKE the supplied String Argument : Name as String (can contain SQL wildcards) Argument : Rank as String Return type : Arrayref of Bio::EnsEMBL::TaxonomyNode
public Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_all_by_rank | ( | ) |
Description : Fetch an array of nodes which have the supplied rank Argument : String Return type : Arrayref of Bio::EnsEMBL::TaxonomyNode
public Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_all_by_taxon_ids | ( | ) |
Description : Fetch an array of nodes corresponding to the supplied taxonomy IDs Argument : Arrayref of Int Return type : Arrayref of Bio::EnsEMBL::TaxonomyNode
public Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_all_common_ancestors | ( | ) |
Undocumented method
public Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_ancestor_by_rank | ( | ) |
Undocumented method
public Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_ancestors | ( | ) |
Description : Fetch an array of nodes which are above the supplied node on the tree (ordered ascending up the tree) Argument : Bio::EnsEMBL::TaxonomyNode or ID of desired node Return type : Arrayref of Bio::EnsEMBL::TaxonomyNode
public Bio::EnsEMBL::TaxonomyNode Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_by_coredbadaptor | ( | ) |
Description : Fetch a single node corresponding to the taxonomy ID found in the supplied Ensembl DBAdaptor. Warning: Passing 2 different DBAs with the same taxid will yield two distinct Node objects which will need merging! COnsider using fetch_by_coredbadaptors instead. Argument : Bio::EnsEMBL::DBSQL::DBAdaptor Return type : Bio::EnsEMBL::TaxonomyNode
public Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_by_coredbadaptors | ( | ) |
Description : Fetch an array of nodes corresponding to the taxonomy IDs found in the supplied Ensembl DBAdaptors. Argument : Bio::EnsEMBL::DBSQL::DBAdaptor Return type : Arrayref of Bio::EnsEMBL::TaxonomyNode
public Bio::EnsEMBL::TaxonomyNode Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_by_taxon_id | ( | ) |
Description : Fetch a single node corresponding to the supplied taxon ID. Argument : Int Return type : Bio::EnsEMBL::TaxonomyNode
public Bio::EnsEMBL::TaxonomyNode Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_by_taxon_name | ( | ) |
Description : Fetch a single node where the name is as specified Argument : String Return type : Bio::EnsEMBL::TaxonomyNode
public Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_children | ( | ) |
Description : Fetch an array of nodes for which the parent is the supplied node Argument : Bio::EnsEMBL::TaxonomyNode or ID of desired node Return type : Arrayref of Bio::EnsEMBL::TaxonomyNode
public Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_common_ancestor | ( | ) |
Undocumented method
public Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_descendant_ids | ( | ) |
Description : Fetch an array of taxon IDs below the supplied node on the tree Argument : Bio::EnsEMBL::TaxonomyNode or ID of desired node Return type : Arrayref of integers
public Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_descendants | ( | ) |
Description : Fetch an array of nodes below the supplied node on the tree Argument : Bio::EnsEMBL::TaxonomyNode or ID of desired node Return type : Arrayref of Bio::EnsEMBL::TaxonomyNode
public Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_descendants_offset | ( | ) |
Description : Fetch an array of nodes below the node the specified number of levels on the tree above the specified node Argument : Bio::EnsEMBL::TaxonomyNode or ID of desired node Argument : offset (number of rows to move up tree before getting descendants - default is 1) Return type : Arrayref of Bio::EnsEMBL::TaxonomyNode
public Arrayref Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_leaf_nodes | ( | ) |
Description : Fetch an array of nodes which are the leaves below the supplied node on the tree Argument : Bio::EnsEMBL::TaxonomyNode or ID of desired node Return type : Arrayref of Bio::EnsEMBL::TaxonomyNode
public Bio::EnsEMBL::TaxonomyNode Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_parent | ( | ) |
Description : Fetch a single node corresponding to the parent of the node Argument : Bio::EnsEMBL::TaxonomyNode or ID of desired node Return type : Bio::EnsEMBL::TaxonomyNode
public Bio::EnsEMBL::TaxonomyNode Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::fetch_root | ( | ) |
Description : Fetch a single node corresponding to the root of the supplied node Argument : Bio::EnsEMBL::TaxonomyNode or ID of desired node Return type : Bio::EnsEMBL::TaxonomyNode
public Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::helper | ( | ) |
Undocumented method
public Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::mapper | ( | ) |
public Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::new_public | ( | ) |
Description : Build a new adaptor from the public database Returns : Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor
public Boolean Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::node_has_ancestor | ( | ) |
Description : Find if one node has another as an ancestor Argument : Bio::EnsEMBL::TaxonomyNode or ID of desired node Argument : Bio::EnsEMBL::TaxonomyNode or ID of ancestor Return type : 1 if ancestor
public void Bio::EnsEMBL::DBSQL::TaxonomyNodeAdaptor::set_num_descendants | ( | ) |
Description : Traverse the supplied tree setting number of descendants based on current tree structure Argument : Bio::EnsEMBL::TaxonomyNode Return type : None