Question: Perl script to retrieve species name from Swissprot
0
gravatar for anicet.ebou
2.6 years ago by
anicet.ebou160
anicet.ebou160 wrote:

I want to query uniprot/KB by accesion number to retrieve species names only.I have write this script:

#!/usr/bin/perl
use strict; use warnings; use Bio::Seq; use Bio::DB::SwissProt; use SWISS::Entry;

print "Please enter the accession number ... "; $_ = <STDIN>; my $db_obj = Bio::DB::SwissProt->new; my $seq_obj = $db_obj->get_Seq_by_acc($_); if( defined $seq->species ) { print "Sequence coming from ",$species->binomial," [",$species->common_name,"]\n"; } exit 0;

but it throws me this error
Name of the protein: Bio::Species=HASH(0x3bb03d8)

Can you help me understand what doesn't work ? Thanks you.

bioperl swissprot • 937 views
ADD COMMENTlink modified 2.5 years ago by Elisabeth Gasteiger1.7k • written 2.6 years ago by anicet.ebou160
 #!/usr/bin/perl  

use strict;   
use warnings;  
use Bio::Seq;  
use Bio::DB::SwissProt;  
use SWISS::Entry;  

print "Please enter the accession number ... ";  
$_ = <STDIN>;  

my $db_obj = Bio::DB::SwissProt->new;   
my $seq_obj = $db_obj->get_Seq_by_acc($_);  

if( defined $seq->species ) {
        print "Sequence coming from ",$species->binomial," [",$species->common_name,"]\n";
        }  

exit 0;
ADD REPLYlink modified 2.6 years ago by WouterDeCoster42k • written 2.6 years ago by anicet.ebou160

I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:

101010 Button

ADD REPLYlink written 2.6 years ago by WouterDeCoster42k

Where is the error message ?

Name of the protein: Bio::Species=HASH(0x3bb03d8)

This doesn't look like an error message but like a variable that wasn't properly dereferenced.

ADD REPLYlink written 2.6 years ago by Jean-Karim Heriche21k
0
gravatar for Elisabeth Gasteiger
2.5 years ago by
Geneva
Elisabeth Gasteiger1.7k wrote:

This doesn't really answer your question, but you could also have a look at the Swissknife PERL package, http://swissknife.sourceforge.net/docs/

ADD COMMENTlink written 2.5 years ago by Elisabeth Gasteiger1.7k

I think the OP is already using it (isn't the module SWISS::Entry part of swissknife ?)

ADD REPLYlink written 2.5 years ago by Jean-Karim Heriche21k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1790 users visited in the last hour