imtakinbioinformatic has asked for the wisdom of the Perl Monks concerning the following question:

I'm given this file with several partial DNA sequences. The first thing I need to do is parse this string into the different sequences at the ">". I want to store these records as variables because in each of the sequences I need to search for a certain pattern. I've been working on the code for the search on the individual sequences, but I can't figure out how to just split these into variables that I can then analyze separately.(And can I keep an identifier on the parsed strings?) Here's the file below. I think I might want to use this? /^>(\w+)\s(. +)$/; Thanks for your help! I know what I want to do but just don't know the language well at all. http://www.med.nyu.edu/rcr/rcr/course/smutans.fas

Replies are listed 'Best First'.
Re: Parse and store as variables
by marto (Cardinal) on Mar 06, 2012 at 15:59 UTC

      I seriously doubt that the first part of this reply (as well as the last...) could possibly be over-emphasized.   No matter what, exactly, you are doing, of this you can be quite sure:   you are not the first.   Sure, Perl’s a great language ... a Swiss Army® Knife ... but the real excitement of it (IMHO) is not “the cool things that you can do with it now,” but instead “the cool things that you don’t have to do because somebody else out there has already done it (better).”

      Therefore, your very first step ought to be to search diligently for “prior art.”   For PerlMonks postings that were written before you found us; for CPAN packages (http://search.cpan.org) that you can “simply use.”   (And, the more you look at what is out there for the taking in CPAN, the more astonished you will be.)

      If you are at all like Yours Truly, that takes practice.   It is not my knee-jerk reaction to do look before I leap.   I tend to, when presented with a problem, want to “dive right in.”   But, every time I have forced myself to look-first, at PerlMonks (first)and at CPAN (next), I have been immensely glad that I did so.   The bit about Perl “Monks,” and about “Wisdom,” are much more than merely fun-n-games.   This is no ordinary WWW water-cooler...

Re: Parse and store as variables
by nemesdani (Friar) on Mar 06, 2012 at 15:52 UTC
    $1 and $2 will contain your matches (if I understand the question correctly, which I am nor sure of).
Re: Parse and store as variables
by imtakinbioinformatic (Initiate) on Mar 07, 2012 at 14:42 UTC
    Thank you!