Vicki Brown wrote: > > Problem: Convert all characters not in the set [AaTtCcGg] to [Nn], > preserving case What do you mean by characters or by preserving case? Should "_" be converted to "N" or "n"? > Solution A (presented to me) > > $seq =~ s/([^ACTGNactgn])/chr(ord(N) - (ord(uc($1)) - ord($1)))/eg; aka $seq =~ s/([^actgn])/'N' ^ uc($1) ^ $1/eig; > Solution B (mine) > > $seq =~ tr/[A-Zatcgn]/n/c; > $seq =~ tr/[a-zATCGN]/N/c; This ain't quite the same as A. Solution A converts all non-letters (outside the set) to 'N', while B converts all non-letters (outside the set) to 'n' (except for '[' and ']' which for some reason are left alone :-) -- Rick Delaney rick.delaney@home.com