Question: Perl script to retrieve species name from Swissprot
0
gravatar for anicet.ebou
21 months ago by
anicet.ebou140
anicet.ebou140 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 • 731 views
ADD COMMENTlink modified 21 months ago by Elisabeth Gasteiger1.6k • written 21 months ago by anicet.ebou140
 #!/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 21 months ago by WouterDeCoster38k • written 21 months ago by anicet.ebou140

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 21 months ago by WouterDeCoster38k

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 21 months ago by Jean-Karim Heriche18k
0
gravatar for Elisabeth Gasteiger
21 months ago by
Geneva
Elisabeth Gasteiger1.6k 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 21 months ago by Elisabeth Gasteiger1.6k

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

ADD REPLYlink written 21 months ago by Jean-Karim Heriche18k
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: 641 users visited in the last hour