[Bioperl-l] Organism name fetcher from Genbank
Damien Mattei
Damien.Mattei@unice.fr
Thu, 13 Jun 2002 08:52:47 +0200
i didn't know that, it's more simple, but in fact i needed the
chromosome and map field too and it doesn't seem that i can get them
with Bio::Species
Damien
Jason Stajich wrote:
> if the sequence is a properly annotated genbank file you can also pull the
> name from
> the Bio::Species object that is available from the seq object by:
> my $species = $seq->species();
> -j
> On Wed, 12 Jun 2002, Damien Mattei wrote:
>
>
>>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 ;-)
>>
--------------------------------------
Damien Mattei
C.N.R.S / U.N.S.A - UMR 6549
mailto:mattei@unice.fr
http://www-iag.unice.fr/
--------------------------------------