So you have an NCBI Entrez uid and you want to grab that sequence from NCBI and convert it directly to a Bio::Seq object? Try this.
use strict; use Bio::SeqIO; use IO::String; use LWP; # the URL for fasta as plain text looks like this my $url='http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?'. 'db=protein&dopt=fasta&sendto=t&list_uids=47157325'; my $fasta = get($url); # open filehandle on string my $seqio = Bio::SeqIO->new('-fh' => IO::String->new($fasta), '-format' => 'fasta'); # voila! my $seqobj = $seqio->next_seq; # do whatever with the object
It’s easy to have a base URL, loop through a bunch of UIDs, append to the end and fetch.