[Bioperl-l] Organism name fetcher from Genbank

Damien Mattei Damien.Mattei@unice.fr
Wed, 12 Jun 2002 17:07:04 +0200


i was just coding this feature in a program yesterday...

so i extract it and put it in a simple script, here it is:

#!/usr/bin/perl -w
#
# return organism given the accession number
# example :
# ./getorg.pl AP001201
#Homo sapiens

use Bio::DB::GenBank;

my $rdb = new Bio::DB::GenBank();

my $orga;

my $seq = $rdb->get_Seq_by_acc($ARGV[0]);

# for each contig
foreach my $feat ($seq->all_SeqFeatures()) {
	
     # for each comment
     foreach my $tag ( $feat->all_tags() ) {
	
	if (($tag =~ /organism/)) {
	
	    $orga = join(' ',$feat->each_tag_value($tag));
	
	}
     }
}

print $orga , "\n";

exit;

but you know i'm not a guru and sometimes reading doc can help ;-)


Ranni King wrote:

> Hi
> 
> I'm not a perl person, and I need some help.  Can anyone send me a 
> module, or a script that can fetch the whole organism name from Genbank 
> by providing the accession number.  I saw in one of the bioperl modules 
> (in the examples) a 'getGenBank.pl' module that fetches the sequence 
> given the accession number.  I want a similar module but fetching the 
> organism name and not the sequence.
> 
> I would be gratful if someone can help me with this.
> 
> Thanks
> 
> Ranni
> 


--------------------------------------
Damien Mattei
C.N.R.S / U.N.S.A - UMR 6549
mailto:mattei@unice.fr
http://www-iag.unice.fr/
--------------------------------------