Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: RFC: Is the Bible encoded in DNA?

by wstryder (Novice)
on May 16, 2018 at 18:47 UTC ( #1214685=note: print w/replies, xml ) Need Help??


in reply to RFC: Is the Bible encoded in DNA?

I have received some great tips from here and on other forums. Some have suggested I should also read the DNA backwards, which is what I'll certainly do. That's easy with perl:

#!/usr/bin/perl # # Print a file backwards # open( FILE, "test.txt" ) or die( "Can't open file file_to_reverse: $!" ); @lines = reverse <FILE>; foreach $line (@lines) { $line = reverse $line; print $line; }

The claim that you can find any text in DNA, the Communist Manifesto or the entire works of Shakespeare is simply not true. When looking for a pattern, you simply can't find any text you want. You can prove it by writing a script that finds the entire works of Shakespeare in DNA. That should be easy to do in perl. You are not allowed to use a one time encryption pad, that is simply cheating. No algorithm can find the entire works of Shakespeare in DNA, no matter what encoding is used.

Some have suggested I should convert the DNA to bits and look there. That is a great idea, and I already wrote a script that converts DNA to bits. It reads A and T as a one and C and G as a zero and then adds up 7 bits at a time and outputs ascii characters. The challenge is to then find information in those characters which I have not yet done. Here's my script so far, I'm now using strict and warnings, learning all the time.

#!/usr/bin/perl # # Convert DNA to bits and see what comes out # use strict; use warnings; open my $fh, "<:encoding(UTF-8)", "Homo_sapiens.GRCh38.dna.chromosome. +2.fa" or die "$!\n"; # open my $fh, "<:encoding(UTF-8)", "test.txt" or die "$!\n"; my $bit = "0"; my $byte = ""; my $i = 0; while (read($fh, my $char, 1)) { # ignore all other characters, escpecially those annoying NNNNNNNN, + what are they anyway? if ($char =~ m/[ACGT]/ ) { # convert bases to bits, 6 possible way to do this if ($char eq "A") { $bit = "0"; } if ($char eq "C") { $bit = "1"; } if ($char eq "G") { $bit = "0"; } if ($char eq "T") { $bit = "1"; } # add one bit at a time up to a byte if ($i < 7) { $i++; $byte .= $bit; } else { $i = 0; # convert the byte to a string my $chars = length($byte); my @packArray = pack("B$chars",$byte); my $print = "@packArray"; # only print alphanumeric characters if ($print =~/[a-z]|[A-Z]/) { print "$print"; } $byte = ""; } } } print "\n";

Replies are listed 'Best First'.
Re^2: RFC: Is the Bible encoded in DNA?
by morgon (Curate) on May 16, 2018 at 19:40 UTC
    The claim that you can find any text in DNA, the Communist Manifesto or the entire works of Shakespeare is simply not true.
    I believe you are right there. The downside is that I also believe that you won't find a large part of the bible either.

    And reading a file backwards is not quite as simple as simply calling reverse, because what you do in your example reads the whole file into memory and that will not work with very large files.

    And as you still seem to be in the brainstorming phase:

    You probably know that only a small part of the dna is actually encoding proteins, so you may consider restricting your search to these areas (or maybe a restrict your search to the non-coding parts).

    Lots of parameters you can tweak, so you'll bound to find something...

      OK thanks for letting me know that that script reads the whole file into memory. What would be a good solution to reverse each FASTA file, they are about 200MB each, without crashing my computer?

      Only a small part of DNA codes for proteins, but why the assumption that God would have coded the Bible in those regions? He could have done that anywhere is my guess. But there is no way of knowing how the mind of God works.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1214685]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2018-08-14 17:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (153 votes). Check out past polls.

    Notices?