Perl script to retrieve species name from Swissprot
1
0
Entering edit mode
7.4 years ago
anicet.ebou ▴ 170

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 • 2.1k views
ADD COMMENT
0
Entering edit mode
 #!/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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode
7.4 years ago

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 COMMENT
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 2544 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6