Question: How to retrieve record from Uniprot with BioPerl
1
gravatar for tpapamitrou
3.4 years ago by
tpapamitrou0 wrote:

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

retrieve uniprot bioperl id • 1.4k views
ADD COMMENTlink modified 3.4 years ago by SES8.2k • written 3.4 years ago by tpapamitrou0
1

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 REPLYlink modified 3.4 years ago • written 3.4 years ago by SES8.2k

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 REPLYlink written 3.4 years ago by tpapamitrou0
1
#!/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 REPLYlink modified 3.4 years ago • written 3.4 years ago by Jean-Karim Heriche21k

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 REPLYlink written 3.4 years ago by tpapamitrou0

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

ADD REPLYlink written 3.4 years ago by Jean-Karim Heriche21k

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 REPLYlink modified 3.4 years ago • written 3.4 years ago by tpapamitrou0
1

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 REPLYlink written 3.4 years ago by Jean-Karim Heriche21k

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 REPLYlink written 3.4 years ago by tpapamitrou0

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 REPLYlink written 3.4 years ago by Jean-Karim Heriche21k

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 REPLYlink written 3.4 years ago by tpapamitrou0

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

ADD REPLYlink written 3.4 years ago by Jean-Karim Heriche21k

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 REPLYlink written 3.4 years ago by tpapamitrou0

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 REPLYlink written 3.4 years ago by Jean-Karim Heriche21k

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 REPLYlink written 3.4 years ago by tpapamitrou0

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 REPLYlink modified 3.4 years ago • written 3.4 years ago by Jean-Karim Heriche21k

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 REPLYlink written 3.4 years ago by tpapamitrou0

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 REPLYlink written 3.4 years ago by Jean-Karim Heriche21k
0
gravatar for tpapamitrou
3.4 years ago by
tpapamitrou0 wrote:

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 COMMENTlink written 3.4 years ago by tpapamitrou0
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: 1612 users visited in the last hour