Bio::Taxon

Bio::Taxon is a node in a represented taxonomy.
Download

Bio::Taxon Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Sendu Bala
  • Publisher web site:
  • http://search.cpan.org/~sendu/

Bio::Taxon Tags


Bio::Taxon Description

Bio::Taxon is a node in a represented taxonomy. Bio::Taxon is a node in a represented taxonomy.SYNOPSIS use Bio::Taxon; # Typically you will get a Taxon from a Bio::DB::Taxonomy object # but here is how you initialize one my $taxon = new Bio::Taxon(-name => $name, -id => $id, -rank => $rank, -division => $div); # Get one from a database my $dbh = new Bio::DB::Taxonomy(-source => 'flatfile', -directory=> '/tmp', -nodesfile=> '/path/to/nodes.dmp', -namesfile=> '/path/to/names.dmp'); my $human = $dbh->get_taxon(-name => 'Homo sapiens'); $human = $dbh->get_taxon(-taxonid => '9606'); print "id is ", $human->id, "n"; # 9606 print "rank is ", $human->rank, "n"; # species print "scientific name is ", $human->scientific_name, "n"; # Homo sapiens print "division is ", $human->division, "n"; # Primates my $mouse = $dbh->get_taxon(-name => 'Mus musculus'); # You can quickly make your own lineages with the list database my @ranks = qw(superkingdom class genus species); my @h_lineage = ('Eukaryota', 'Mammalia', 'Homo', 'Homo sapiens'); my $list_dbh = new Bio::DB::Taxonomy(-source => 'list', -names => @h_lineage, -ranks => @ranks); $human = $list_dbh->get_taxon(-name => 'Homo sapiens'); my @names = $human->common_names; # @names is empty $human->common_names('woman'); @names = $human->common_names; # @names contains woman # You can switch to another database when you need more information my $entrez_dbh = new Bio::Db::Taxonomy(-source => 'entrez'); $human->db_handle($entrez_dbh); @names = $human->common_names; # @names contains woman, human, man # Since Bio::Taxon implements Bio::Tree::NodeI, we have access to those # methods (and can manually create our own taxa and taxonomy without the use # of any database) my $homo = $human->ancestor; # Though be careful with each_Descendent - unless you add_Descendent() # yourself, you won't get an answer because unlike for ancestor(), Bio::Taxon # does not ask the database for the answer. You can ask the database yourself # using the same method: ($human) = $homo->db_handle->each_Descendent($homo); # We can also take advantage of Bio::Tree::Tree* methods: # a) some methods are available with just an empty tree object use Bio::Tree::Tree; my $tree_functions = new Bio::Tree::Tree(); my @lineage = $tree_functions->get_lineage_nodes($human); my $lca = $tree_functions->get_lca($human, $mouse); # b) for other methods, create a tree using your Taxon object my $tree = new Bio::Tree::Tree(-node => $human); my @taxa = $tree->get_nodes; $homo = $tree->find_node(-rank => 'genus'); # Normally you can't get the lca of a list-database derived Taxon and an # entrez or flatfile-derived one because the two different databases might # have different roots and different numbers of ranks between the root and the # taxa of interest. To solve this, make a tree of the Taxon with the more # detailed lineage and splice out all the taxa that won't be in the lineage of # your other Taxon: my $entrez_mouse = $entrez_dbh->get_taxon(-name => 'Mus musculus'); my $list_human = $list_dbh->get_taxon(-name => 'Homo sapiens'); my $mouse_tree = new Bio::Tree::Tree(-node => $entrez_mouse); $mouse_tree->splice(-keep_rank => @ranks); $lca = $mouse_tree->get_lca($entrez_mouse, $list_human); Requirements: · Perl


Bio::Taxon Related Software