in reply to Re: Shuffling CODONS
in thread Shuffling CODONS

Thanks for your reply! If I implement it like below. It doesn't change the order of codons.

print "enter sequence and signal end with enter followed by ctrl d\n" +; $sequence = <STDIN>; chomp $sequence; print "sequence inserted : $sequence\n"; @trips = unpack("a3" x (length($sequence)-2), $sequence); @trips = join(" ", @trips); my @shuftrips = &myshuffle( @trips ); print "@shuftrips\n"; sub myshuffle { map $_->[0], sort { $a->[1] <=> $b->[1] } map [ $_, rand ], @_; }

Replies are listed 'Best First'.
Re^3: Shuffling CODONS
by tybalt89 (Monsignor) on Jun 07, 2018 at 14:23 UTC

    Because @trips = join(" ", @trips); joins all codons into ONE string!

      ^^^ THIS