GATC_note – convert text to DNA

Modified: 2018 Jun 30

Many years ago I saw a movie named “GATTACA”. The film was based on a novel where a man with some “defects” in his DNA was excluded from the crew of a stellar mission (due to such defects). That man, using a trick (exchanging his DNA with another one coming from a friend genetically perfect, but unable to walk after an accident) finally was accepted and started his journey to the stars.

Why “GATTACA” ? The answer is simple: the DNA has only 4 elements (I don’t know their exact names, try Google search for full information) named A, C, G, T. Such four elements, sequentially disposed on a “string”, are able to describe THE LIFE. The DNA is like a program with all the instructions to build the life in its wide range of forms.

When I discovered that just 4 letters are used for the “strings of life”, I immediatly thought about a byte. In one byte (8 bit) I can save four symbols. Many years later (three years ago) I realized a small Internet connected device and decided to use a special coding to transmit the data from the microcontroller to the webserver and so I encoded every byte as a string of 4 characters “A”,”C”,”G”,”T” sending the packet as simple ASCII string. Obviously, the byte array was small and was previously encoded with my own key. It was just an experiment, easy to implement in the microcontroller C program and in the receiving PHP script on the server.

Well, last week I have seen on TV that some scientist are studying the way to save huge amount of information on molecular support, using the DNA structure! So, we will have many terabytes of data on a very small organic  support. I don’t know when it can be ready for the public, but is a very exciting idea for data storing. I just can’t imagine how a “reader” for such data can be realized, but in the meantime I decided to write a small App for Android to “translate” a text in “DNA code” form. This is the App icon:

The App is simply a text editor that can convert from text to “DNA code” and viceversa pressing a button. It’s funny and you can save some “sensitive” data on your smartphone with this special encoding. Note that the coding / decoding algorithm is VERY easy and any “decent” programmer will break and decode the text in few minutes, so don’t use this way to store your precious bank accounts! It’s just a funny way to save the data with a “futuristic” look.

Here is the screenshot of a text written in the edit box:

And now, look what happens when I press the button “GATC it !”:

The operation is reversible: if I tap again the button “GATC it!” the “DNA code” reverts to normal text. There are buttons to save / load the files to / from the smartphone’s memory. The files are saved in the program directory that is named GATC_note/. You can save or retrieve files to / from the directory connecting the smartphone to the computer as an USB memory. Note that the files are in Android format, so the line terminator is simply LF and not CRLF as in Windows Notepad.

Modified in GATC_note V0.2 >> Note the “double colon” at the end of the “DNA code”: this is appended by the program as a marker in order to recognize that the text is “GATC code”. I changed such marker from “Black Star” (Unicode 9733 decimal) of previous release to “double colon” in order to make easier editing GATC text (for experiments). I added also a check for the text length (in GATC mode) ‘cause such text must be multiple of 4 in length (4 GATC symbols = 1 Byte). Finally, I modified the text entry in order to avoid that the keyboard can overlap the text (in case of long strings).

Using just one byte for character has a limit: not all the characters in the edit text can’t be decoded. Only the characters with code from 0 to 255 can be represented with 4 characters ACGT. In case of characters out-of-bounds, the program will set a message dialog asking you if you want to accept the limits (changing the extra characters in blanks) or if you refuse to exchange. This is the screenshot of the dialog:

The “load” and “save” buttons are used to save and load files. You can save files in text or DNA format. The only difference is that ANY file that ends with the “black star” is considered as “DNA”, otherways is a text file. Pressing a file name for long time calls the “delete” procedure and you can decide to erase a file from your smartphone’s memory.

The App has been published on my Google Play developer page at this link: It’s absolutely free and without any advertisement. If you find some error or if you wish for new features to add, send me a message. I will try to improve / debug the program in my free time.

If someone has a true DNA to convert with the program and then discovers that the converted data contains some useful instructions to develop a special anti-gravitational machine, please invite me (for free) to the first interstellar journey on a starship that uses such new technology, thank you.