[Bioperl-l] More on ACC NR -> Species name
Henrik Nilsson
henrik.nilsson at botany.gu.se
Wed Feb 19 14:39:43 EST 2003
Thanks everyone for your kind input on the matter!
>You can get the seq from genbank via
>Bio::DB::GenBank, and then ask for the species with
>$seq->species() [this will return a Bio::Species object]
Yes, this would be exactly what I am looking for. My being a bioperl
newcomer, I'm not sure how to implement your elegant solution. The
following code, for example, doesn't really do the trick:
-----------------------
#!/usr/bin/perl -w
use strict;
use Bio::Perl;
use IO::String;
use Bio::Perl qw( get_sequence );
use Bio::DB::GenBank;
use Bio::Species;
use Bio::Root::Root;
my ($seq_object, $seq_id, $seq_as_string, $species);
$seq_object = get_sequence('genbank',"AF429427");
$seq_id = $seq_object->display_id;
$seq_as_string = $seq_object->seq();
$species = $seq_object->species();
print "seq_id: $seq_id\n";
print "sequence: $seq_as_string\n";
print "species: $species\n";
exit;
----------------------
although it does output
seq_id: AF429427
sequence: TTGTAGCTGGCCGTAAACT ...
species: Bio::Species=HASH(0x8658bf0)
i.e. it does fetch the sequence and seq_id, but not the species.
What am I doing wrong?
Yours gratefully,
Henrik N
More information about the Bioperl-l
mailing list