On Mon, 2008-09-22 at 21:21 -0400, ANJAN PURKAYASTHA wrote:
> here is my problem:
> i have to check the entries of a column and write them out to a file if they
> happen to be DNA sequences ie they are exclusively composed of the letters
> A, T, G, C- no spaces or digits.
> the column also happens to have other strings that are made of
> word/digit/space characters.
> i tried
> if($x=~ /[ATGC]/ )then .....
> however this pattern matching expression is unable to filter out the non-DNA
> sequences.
> i have also tried other expressions too convoluted to write out here.
> 
> any ideas?

Your question is not clear.  Do you want to write the line if it has a
DNA sequence or just the sequence?  Are sequences of one letter
acceptable?  When you column, do you mean they appear vertically in a
column when printed in a monospaced font, or is there some other marker
that indicates a column?

To extract sequences from a line:

@sequences = split /[^ATGC]+/, $line;


-- 
Just my 0.00000002 million dollars worth,
  Shawn

Linux is obsolete.
-- Andrew Tanenbaum


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to