[Bioperl-l] Using SeqIO
Hilmar Lapp
hlapp at gnf.org
Thu Mar 13 11:27:21 EST 2003
Could it be that what you want is an indexed fasta file providing
random access? There is bpindex.pl and bpfetch.pl to do that, and there
are modules supporting locally indexed flat files under Bio::Index and
Bio::DB. Can please someone who knows better than I do fill in the
details :)
-hilmar
On Thursday, March 13, 2003, at 09:40 AM, Brian Carlson wrote:
>
> I have the need to extract 1000's of 36bp sequences from a fasta file.
>> From previous help, I've have this sample code (snippet) extracting
>> some
> sequence:
>
> $in = new Bio::SeqIO ( -format=>'fasta', -file=>'mouse_T3.fasta');
> while (my $seq = $in->next_seq)
> {
> if ($seq->desc eq $target_description)
> {
> print "Description : " . $seq->desc . "\n";
> $seq = $seq->trunc($start, $stop);
> print "BP $start-$stop : " . $seq->seq . "\n";
> last;
> }
> }
>
>
> But it would seem slow to keep re-reading the fasta each time I wanted
> to extract the sequence. How do you just "rewind" it back to the
> beginning? Or do I have to just re-read it?
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>
--
-------------------------------------------------------------
Hilmar Lapp email: lapp at gnf.org
GNF, San Diego, Ca. 92121 phone: +1-858-812-1757
-------------------------------------------------------------
More information about the Bioperl-l
mailing list