Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
No such thing as a small change
 
PerlMonks  

Re: DNA that is a JAPH

by patgas (Friar)
on Jan 14, 2002 at 19:53 UTC ( [id://138698]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to DNA that is a JAPH

I think this oughta do it...

foreach $letter ( split //, shift @ARGV ) { @digits = (); $num = ord $letter; while ( $num ) { unshift @digits, $num % 4; $num = int $num / 4; } unshift @digits, 0 while @digits < 4; $base4 = join '', @digits; $base4 =~ tr/0123/ATCG/; $string .= $base4; } print $string;

Using this, I get 'perl' to be TGAATCTTTGACTCGA. This was fun, thanks!

"We're experiencing some Godzilla-related turbulence..."

Replies are listed 'Best First'.
Re: Re: DNA that is a JAPH
by theorbtwo (Prior) on Jan 14, 2002 at 19:59 UTC

    Cool, the elegant solution. patgas++. BTW, you both forgot the newline. <G>

    Thanks,
    James Mastros,
    Just Another Perl Scribe

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://138698]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.