How to retrieve record from Uniprot with BioPerl
1
1
Entering edit mode
7.9 years ago

Hello

I am new here and I face a problem about retrieving data from Uniprot. I use bioperl and I want to retrieve a specific fasta sequence by id from uniprot. I tried the classic code like get_seq_by_id or use BIO::DB::SwissProt but it doesn't work. Any advice?

BioPerl Uniprot • 3.2k views
ADD COMMENT
1
Entering edit mode

Can you show us the code? This type of thing is very hard to solve without seeing the IDs, the database(s) you are trying to query and the actual syntax you are using.

ADD REPLY
0
Entering edit mode

Of course. As i read in some Perl's tutorials the code have to be like this: script1: $gb = new Bio::DB::SwissProt(); $seq = $gb->get_Seq_by_id('Q6GZW6'); script2: use Bio::DB::Fasta; use strict; my $seqobj = $db->get_Seq_by_id($Q6GZW6);

I have to compine the 2 scripts to retrieve the fasta form of this protein. *i have to mention that i am new on Perl Scripting. Maybe there are more available scripts.

ADD REPLY
1
Entering edit mode
#!/usr/bin/perl

use strict;
use warnings;
use Bio::DB::SwissProt; 

my $gb = new Bio::DB::SwissProt(); 
# Retrieve Bio::Seq object
my $seq = $gb->get_Seq_by_id('Q6GZW6');
# Output FASTA
print ">Q6GZW6\n",$seq->seq(),"\n";
ADD REPLY
0
Entering edit mode

It shows an error: "Stack top level". Could it be an erron in my Bio Library? and if yes, should i reinstall the packages?

ADD REPLY
0
Entering edit mode

Do you have the full error message ? Stack top level doesn't mean much.

ADD REPLY
0
Entering edit mode

Stack Bio::DB::WevDBSeqI::get_Seq_by_id C:/Perl/site/lib/Bio/DV/WevDBSeqI.pm

Do you need the whole script? Because there are more after that. It is a homework about my University: "you have to insert an ID (protein, gene etc) and returns back a file which contains the places of the sequence where take place a motif".

ADD REPLY
1
Entering edit mode

This is still only a small part of the error message. Read the whole error message, it will tell you what doesn't work. Most likely it is a connection issue, i.e. you'll see something like "Can't connect to www.ebi.ac.uk:80".

ADD REPLY
0
Entering edit mode

Excuse me for my delay but this site restricts new members to 6 posts. I sent an e-mail to you but you did not respond. I get this message-error when i run the script: "--------------EXCEPTION-------------- MSG: WebDBSeqI Error - check query sequences! STACK Bio::DB::WebDBSeqI::get_seq_stream C:/Perl/site/lib/Bio/DB/WebDBSeqI.pm:50 STACK Bio::DB::WebDBSeqI::get_Stream_by_id C:/Perl/site/lib/Bio/DB/WebDBSeqI.pm:289 STACK Bio::DB::WebDBSeqI::get_Seq_by_id C:/Perl/site/lib/Bio/DB/WebDBSeqI.pm:159 STACK toplevel filename.pl:40"

ADD REPLY
0
Entering edit mode

I sometimes sleep at night ;) The error seems to come from a failed request. First make sure that you're using the latest version of Bioperl. Then check that it's querying the right URL and database. You can get this info using

my $gb = new Bio::DB::SwissProt(-verbose=>1);
ADD REPLY
0
Entering edit mode

Now i take back 2 messages. The first one is that the request is POST https://www.ebi.ac.uk/cgi-bin/dbfetch. the second is the same exception but this time the STACK toplevel is 7

ADD REPLY
0
Entering edit mode

Show us the whole thing. We can't help you if you keep on only showing bits of info.

ADD REPLY
0
Entering edit mode

request is POST http://www.ebi.ac.uk/cgi-bin/dbfetch Content-Length: 49 Content-Type: application/x-www-form-urlencoded

style=raw&id=Q6GZW6&format=swissprot&db=UniProtKB content is --------------EXCEPTION-------------- MSG: WebDBSeqI Error - check query sequences! STACK Bio::DB::WebDBSeqI::get_seq_stream C:/Perl/site/lib/Bio/DB/WebDBSeqI.pm:50 STACK Bio::DB::WebDBSeqI::get_Stream_by_id C:/Perl/site/lib/Bio/DB/WebDBSeqI.pm:289 STACK Bio::DB::WebDBSeqI::get_Seq_by_id C:/Perl/site/lib/Bio/DB/WebDBSeqI.pm:159 STACK toplevel filename.pl:7

ADD REPLY
0
Entering edit mode

The request looks fine and works for me. What do you get when you type the following in a browser:
http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?style=raw&id=Q6GZW6&format=swissprot&db=UniProtKB

ADD REPLY
0
Entering edit mode

when i type it in the browser it shows the motif. and the places where the motif exists. so my script has access in uniprot db and the problem is in the rest script?

ADD REPLY
0
Entering edit mode

You shouldn't get a motif, you should get the entire Uniprot record for accession Q6GZW6, a text page that starts like this:

ID 009L_FRG3G Reviewed; 948 AA.
AC Q6GZW6;
DT 28-JUN-2011, integrated into UniProtKB/Swiss-Prot.
DT 19-JUL-2004, sequence version 1.
DT 14-OCT-2015, entry version 47.
DE RecName: Full=Putative helicase 009L;
DE EC=3.6.4.-;
GN ORFNames=FV3-009L;
OS Frog virus 3 (isolate Goorha) (FV-3).
OC Viruses; dsDNA viruses, no RNA stage; Iridoviridae; Ranavirus.
....

ADD REPLY
0
Entering edit mode

yes i get the entire record. My problem is that i must make a script that has access in Uniprot, find the specific ID and then creates a file which contains the places where the motif exists. I just cannot figure out why it stops there and shows me those messages.

ADD REPLY
0
Entering edit mode

I suspect the problem is in your script then. Do you use strict and use warnings ? If not please do, this will catch a number of mistakes including most typos. Also please try the example code I gave above.

ADD REPLY
0
Entering edit mode
7.9 years ago

i use it in every sub-script that i have in my script but i get the same errors. Nevermind, i will reiinstall Perl and packages and see what happens. Dear Heriche i would like to highlight my gratidute for your help and time spent on my case.

ADD COMMENT

Login before adding your answer.

Traffic: 1967 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