[Bioperl-l] More on ACC NR -> Species name

James Wasmuth james.wasmuth at ed.ac.uk
Wed Feb 19 14:25:52 EST 2003


The Bio::Species object you've created (Bio::Species=HASH(0x8658bf0)) 
can be manipulated to give you what you want from it, eg. common name, 
species.

To get species use

$self->species( $species )


Have a look at the documentation for it at 
http://doc.bioperl.org/releases/bioperl-1.2/Bio/Species.html

James



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
>  
>

-- 

Nematode Bioinformatics
Blaxter Nematode Genomics Group
Institute of Cell, Animal and Population Biology
Ashworth Labs
University of Edinburgh
King's Buildings
Edinburgh
EH9 3JT
UK

0131 650 7403





More information about the Bioperl-l mailing list