[Bioperl-l] More on ACC NR -> Species name
Hilmar Lapp
hlapp at gmx.net
Wed Feb 19 22:19:38 EST 2003
It does fetch the species, it just is an object, not a string. Do
'perldoc Bio::Species' to see the methods. If you just want the name
then say
print $species->binomial;
-hilmar
On Wednesday, February 19, 2003, at 09:39 PM, Henrik Nilsson wrote:
> 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
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>
>
--
-------------------------------------------------------------
Hilmar Lapp email: lapp at gnf.org
GNF, San Diego, Ca. 92121 phone: +1-858-812-1757
-------------------------------------------------------------
More information about the Bioperl-l
mailing list