[Bioperl-l] Using SeqIO

Brian Osborne brian_osborne at cognia.com
Thu Mar 13 13:34:55 EST 2003


Brian,

So you want code that gets multiple 36 bp sequences from 1 sequence so you
don't have to rewind?

Brian O.


-----Original Message-----
From: bioperl-l-bounces at bioperl.org [mailto:bioperl-l-bounces at bioperl.org]On
Behalf Of Brian Carlson
Sent: Thursday, March 13, 2003 12:40 PM
To: bioperl
Subject: [Bioperl-l] Using SeqIO


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




More information about the Bioperl-l mailing list