[Bioperl-l] Bio::DB::SwissProt
Jason Stajich
jason.stajich at gmail.com
Wed Jul 20 16:52:07 UTC 2011
Please keep asking your questions on the mailing list - I can't answer everyone's questions and others learn from this exchange.
You do it just like it says in the documentation, here's a loop showing you can retrieve the same sequence by two different IDs, swissprot ID and accession number:
#!/usr/bin/perl -w
use strict;
use Bio::DB::GenPept;
use Bio::SeqIO;
my $db = Bio::DB::GenPept->new;
my $out = Bio::SeqIO->new(-format => 'swiss', -fh => \*STDOUT);
for my $id ( qw(P22815 BOSS_DROME) ) {
my $seq = $db->get_Seq_by_acc($id);
if( $seq ) {
$out->write_seq($seq);
} else {
warn("no seq $id\n");
}
}
Alternatively you can do this to get the sequence and turn it into an object but you have to use accession number:
(curl or GET as part of libwwww perl will work)
open(my $fh => 'curl http://www.uniprot.org/uniprot/P22815.txt') || die $!;
my $seqio = Bio::SeqIO->new(-fh => $fh, -format => 'swiss');
while(my $seq = $seqio->next_seq ) {
print $seq->id, "\n";
}
-jason
On Jul 20, 2011, at 9:21 AM, Oliver Schilling wrote:
> Thanks a lot for your reply!
>
> Sorry for asking - but do you have an example on how to retrieve Swissprot data via a genbank DB handle?
>
> Thanks
>
> Oliver
>
>
> On Jul 20, 2011, at 18:00 PM, Jason Stajich wrote:
>
>> It is just waiting for someone to code it up. It requires a different, simpler approach.
>>
>> I don't have any time to do this but we welcome volunteers.
>>
>> The simple approach is just to open a file handle and use GET cmd to open the URL with the accession number per the msg I sent before. That filehandle goes to SeqIO and you don't need the Bio::DB module.
>>
>> You can also get Swissprot data via genbank DB handle.
>>
>> Jason Stajich
>>
>>
>> On Jul 20, 2011, at 4:23 AM, Oliver Schilling <oliver.schilling at mol-med.uni-freiburg.de> wrote:
>>
>>> Dear Jason,
>>>
>>> as thankfully pointed out by you on http://old.nabble.com/Fwd%3A-URGENT%21-Update-of-Bio%3A%3ADB%3A%3ASwissProt-td32059436.html#a32059436,
>>>
>>> it seems that Bio::DB::SwissProt is not supported by expasy any more. In a perl script, I used to access Swissprot data and annotations by
>>>
>>> $sp = Bio::DB::SwissProt->new('-servertype' => 'expasy',
>>> '-hostlocation' => 'switzerland');
>>> $seq = $sp->get_Seq_by_id($id_swiss);
>>>
>>> This of course does not work any more. Will Bio::DB::SwissProt be adapted to the new expasy site in the near future?
>>>
>>> Thanks a lot!
>>>
>>> Oliver
>>>
>>>
>>> Dr. Oliver Schilling
>>> Group Leader & Emmy-Noether Research Fellow
>>> Institute for Molecular Medicine and Cell Research
>>> University of Freiburg
>>> Stefan-Meier-Str. 17, Room 02 027
>>> D-79104 Freiburg, Germany
>>> Tel: +49 761 203 9615
>>> email: oliver.schilling at mol-med.uni-freiburg.de
>
More information about the Bioperl-l
mailing list