[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] More Simplification



> Problem: Convert all characters not in the set [AaTtCcGg] to [Nn],
> preserving case:
>
>[...]
> 
> Solution B (mine)
> 
>          $seq =~ tr/[A-Zatcgn]/n/c;
>          $seq =~ tr/[a-zATCGN]/N/c;
> 
> 
> I thought this was reasonably elegant, especially because the solution
> came to me as I was heading up the on-ramp onto the freeway on the
> way home (good solutions are the ones you don't _need_ the computer for)
> 
> Anyone have a nicer solution?

How about uglier?

           s/([^ATCG])/'N'^' '&$1/egi;

And non-portable...



==== Want to unsubscribe from this list? (Don't you love us anymore?)
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org