~ubuntu-branches/ubuntu/trusty/bioperl/trusty

« back to all changes in this revision

Viewing changes to scripts/taxa/query_entrez_taxa.PLS

  • Committer: Package Import Robot
  • Author(s): Charles Plessy
  • Date: 2013-09-22 13:39:48 UTC
  • mfrom: (3.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20130922133948-c6z62zegjyp7ztou
Tags: 1.6.922-1
* New upstream release.
* Replaces and Breaks grinder (<< 0.5.3-3~) because of overlaping contents.
  Closes: #722910
* Stop Replacing and Breaking bioperl ( << 1.6.9 ): not needed anymore. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
# This is a -*-Perl-* file (make my emacs happy)
3
 
 
4
 
=head1 NAME
5
 
 
6
 
query_entrez_taxa - query Entrez taxonomy database and print out information 
7
 
 
8
 
=head1 USAGE
9
 
 
10
 
query_entrez_taxa "Homo sapiens" "Saccharomyces cerevisiae" Rhizopus Metazoa
11
 
query_entrez_taxa -gi 28800981 -gi 54301680 -db nucleotide
12
 
query_entrez_taxa -gi 71836523 -db protein
13
 
 
14
 
 Provide the genus and species name in quotes, you can also query for
15
 
 a non-species node like Family or Order
16
 
 
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
21
 
 
22
 
   other arguments are assumed to be species names to lookup in taxonomy db
23
 
 
24
 
 
25
 
=head1 AUTHOR
26
 
 
27
 
Jason Stajich jason-at-bioperl-dot-org
28
 
 
29
 
=cut
30
 
 
31
 
use strict;
32
 
use Bio::DB::Taxonomy;
33
 
use Getopt::Long;
34
 
 
35
 
my $verbose = 0;
36
 
my (@gi, $dbname);
37
 
GetOptions('v|verbose' => \$verbose,
38
 
           'gi:i'      => \@gi,
39
 
           'db:s'      => \$dbname);
40
 
 
41
 
my $db = new Bio::DB::Taxonomy(-source => 'entrez', -verbose => $verbose);
42
 
if( @gi ) {
43
 
    my @nodes= $db->get_Taxonomy_Node(-gi => \@gi,
44
 
                                      -db => $dbname);
45
 
    for my $node ( @nodes ) {
46
 
        my $gi = shift @gi;
47
 
        print " for gi $gi:\n";
48
 
        print " taxonid is ",$node->ncbi_taxid,"\n";    
49
 
        print " node is ", join(", ",$node->classification), "\n";
50
 
        print " species is ", $node->species,"\n";
51
 
        print " parent is ", $node->parent_id, "\n";
52
 
        print " rank is ", $node->rank, "\n";
53
 
        print " genetic_code  ", $node->genetic_code, "\n";
54
 
        print " mito_genetic_code  ", $node->mitochondrial_genetic_code, "\n";
55
 
        print " scientfic name is ", $node->binomial, "\n";
56
 
    }   
57
 
}
58
 
 
59
 
print "\n\n";
60
 
for my $name ( @ARGV ) {
61
 
    my $taxonid = $db->get_taxonid($name);
62
 
    my $node   = $db->get_Taxonomy_Node(-taxonid => $taxonid);
63
 
    print "taxonid is $taxonid\n";
64
 
 
65
 
    print " node is ", join(", ",$node->classification), "\n";
66
 
    print " species is ", $node->species,"\n";
67
 
    print " parent is ", $node->parent_id, "\n";
68
 
    print " rank is ", $node->rank, "\n";
69
 
    print " genetic_code  ", $node->genetic_code, "\n";
70
 
    print " mito_genetic_code  ", $node->mitochondrial_genetic_code, "\n";
71
 
    print " scientfic name is ", $node->binomial, "\n";
72
 
    print " common name is ", $node->common_name, "\n";
73
 
    print " create date is ", $node->create_date, "\n";
74
 
    print " update date is ", $node->update_date, "\n";
75
 
    print " pub date is ", ($node->pub_date || ''), "\n";
76
 
    print " variant is ", $node->variant, "\n";
77
 
    print " sub_species is ", $node->sub_species, "\n";
78
 
    print " organelle is ", $node->organelle, "\n";
79
 
    print " division is ", $node->division, "\n";
80
 
}