Bio::DB::CUTG: move into its own distribution
[bioperl-live.git] / bin / bp_query_entrez_taxa
blob91a7a2191e006f55a3aed5c80860246c8f9d19e6
1 #!/usr/bin/perl
2 # This is a -*-Perl-* file (make my emacs happy)
4 =head1 NAME
6 bp_query_entrez_taxa - query Entrez taxonomy database and print out information
8 =head1 USAGE
10 bp_query_entrez_taxa "Homo sapiens" "Saccharomyces cerevisiae" Rhizopus Metazoa
11 bp_query_entrez_taxa -gi 28800981 -gi 54301680 -db nucleotide
12 bp_query_entrez_taxa -gi 71836523 -db protein
14 Provide the genus and species name in quotes, you can also query for
15 a non-species node like Family or Order
17 Command-line options:
18 -v or --verbose : print verbose debugging info
19 -gi : one or many GI numbers to lookup taxon id for
20 -db : the sequence db (nucleotide or protein) the GI is for
22 other arguments are assumed to be species names to lookup in taxonomy db
25 =head1 AUTHOR
27 Jason Stajich jason-at-bioperl-dot-org
29 =cut
31 use strict;
32 use warnings;
33 use Bio::DB::Taxonomy;
34 use Getopt::Long;
36 my $verbose = 0;
37 my (@gi, $dbname);
38 GetOptions('v|verbose' => \$verbose,
39 'gi:i' => \@gi,
40 'db:s' => \$dbname);
42 my $db = new Bio::DB::Taxonomy(-source => 'entrez', -verbose => $verbose);
43 if( @gi ) {
44 my @nodes= $db->get_Taxonomy_Node(-gi => \@gi,
45 -db => $dbname);
46 for my $node ( @nodes ) {
47 my $gi = shift @gi;
48 print " for gi $gi:\n";
49 print " taxonid is ",$node->ncbi_taxid,"\n";
50 print " node is ", join(", ",$node->classification), "\n";
51 print " species is ", $node->species,"\n";
52 print " parent is ", $node->parent_id, "\n";
53 print " rank is ", $node->rank, "\n";
54 print " genetic_code ", $node->genetic_code, "\n";
55 print " mito_genetic_code ", $node->mitochondrial_genetic_code, "\n";
56 print " scientfic name is ", $node->binomial, "\n";
60 print "\n\n";
61 for my $name ( @ARGV ) {
62 my $taxonid = $db->get_taxonid($name);
63 my $node = $db->get_Taxonomy_Node(-taxonid => $taxonid);
64 print "taxonid is $taxonid\n";
66 print " node is ", join(", ",$node->classification), "\n";
67 print " species is ", $node->species,"\n";
68 print " parent is ", $node->parent_id, "\n";
69 print " rank is ", $node->rank, "\n";
70 print " genetic_code ", $node->genetic_code, "\n";
71 print " mito_genetic_code ", $node->mitochondrial_genetic_code, "\n";
72 print " scientfic name is ", $node->binomial, "\n";
73 print " common name is ", $node->common_name, "\n";
74 print " create date is ", $node->create_date, "\n";
75 print " update date is ", $node->update_date, "\n";
76 print " pub date is ", ($node->pub_date || ''), "\n";
77 print " variant is ", $node->variant, "\n";
78 print " sub_species is ", $node->sub_species, "\n";
79 print " organelle is ", $node->organelle, "\n";
80 print " division is ", $node->division, "\n";