in reply to DNA that is a JAPH

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

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

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