in reply to How do I backtrack while reading a file line-by-line?

Sounds very much like you're trying to read a Fasta format sequence file?

You could use Bio::SeqIO, or if that is giving you problems you might try my crude Fasta load routine. It's the last code snippet in Re^5: Memory Usage in Regex On Large Sequence. That post/thread also shows a problem with the cpan module along with one reason why it's performance is not so good. Though that might have been fixed by now.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: How do I backtrack while reading a file line-by-line?

Replies are listed 'Best First'.
Re^2: How do I backtrack while reading a file line-by-line?
by mdunnbass (Monk) on Oct 18, 2006 at 20:18 UTC
    I am indeed trying to read Fasta files.

    In fact, what I'm doing is creating a search function that, given a variable number of user-input DNA sequences (such as amino acid motifs, or transcription factor binding sites), it searches a user specified Fasta file for all hits, either totally, or within $interval bases of each other, and then outputs all the hits both as .html format and as .fasta format, and the .html would have all the matches highlighted in various colors.

    So far, I haven't read up at all on modules, so I suppose that's the next step in my Perl learning curve.

    Thanks for the pointer. I'll definitely check it out.
    Matt