Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

DNA that is a JAPH

by theorbtwo (Prior)
on Jan 14, 2002 at 22:16 UTC ( [id://138642]=obfuscated: print w/replies, xml ) Need Help??

Just to compliment the DNA Obfu of Ranna, here's my own first obfu, dnareader.pl:

#!/usr/bin/perl # Run as dnareader.pl TCCCTCATTGAATCCAAACC # You'll get a ++ from me if you can make it say "perl" # instead. $"='ATCG'; foreach (split '', shift) { $;++;$,=$,<<2|index $",$_; next if $;&3;$,=print chr $,;$,--; }

I know, the obfuscation isn't that hard, but I think it's a cool idea anyway.

Thanks,
James Mastros,
Just Another Perl Scribe

Replies are listed 'Best First'.
Re: DNA that is a JAPH
by grinder (Bishop) on Jan 15, 2002 at 00:04 UTC
    Nifty!

    perl dna TGAATCTTTGACTCGA

    Hope I transcribed that correctly. I just hacked the following out of your code. Ugly, but does the job

    #!/usr/bin/perl # Run as dnareader.pl TCCCTCATTGAATCCAAACC # You'll get a ++ from me if you can make it say "perl" # instead. for my $g1 ( 'A', 'C', 'T', 'G' ) { for my $g2 ( 'A', 'C', 'T', 'G' ) { for my $g3 ( 'A', 'C', 'T', 'G' ) { for my $g4 ( 'A', 'C', 'T', 'G' ) { print( "$g1$g2$g3$g4 - " ); letter( "$g1$g2$g3$g4" ); print "\n"; }}}} sub letter { $"='ATCG'; foreach (split '', shift) { $;++;$,=$,<<2|index $",$_; next if $;&3;$,=print chr $,;$,--; } }

    From there it's a simple matter of working backwards...

    --
    g r i n d e r
    TACCTGTTTGAGTGTAACAATCATTCGCTCGGTGTATCCATCTTTGACACAATCACTCGGTCTCTCCA

      Hey, that's cheating; I was hoping sombody would figure out the encoding and do it the hard way... nonetheless, it's certianly valid. grinder++

      Thanks,
      James Mastros,
      Just Another Perl Scribe

        Yeah, but you said:
        You'll get a ++ from me if you can make it say "perl"
        That's "perl", not "perl\n"! :)

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

Re: DNA that is a JAPH
by patgas (Friar) on Jan 15, 2002 at 00:53 UTC

    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..."

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

      Thanks,
      James Mastros,
      Just Another Perl Scribe

Re: DNA that is a JAPH
by Ranna (Acolyte) on Jan 16, 2002 at 09:44 UTC
    Erf.. bit late, oh well. TGAATCTTTGACTCGA. I figured out how to work through the letters eventually, that speeded things up.
Re: DNA that is a JAPH
by o(o_o)o (Scribe) on Jan 15, 2002 at 01:12 UTC
    TTAATATTTTACTAGAAACC ;-)

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    i would slit my wrists for you
Re: DNA that is a JAPH
by theorbtwo (Prior) on Sep 11, 2004 at 16:32 UTC

    I was just looking back on this code, much, much later, and found the matching "dnawriter.pl". It's past the readme below:


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://138642]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found