[Bioperl-l] Organism name fetcher from Genbank
Jason Stajich
jason@cgt.mc.duke.edu
Wed, 12 Jun 2002 11:20:01 -0400 (EDT)
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 ;-)
>
>
> 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/
> --------------------------------------
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>
--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu