{"id":17406202,"url":"https://github.com/amagash/dna_encoding","last_synced_at":"2025-04-05T21:07:34.328Z","repository":{"id":129521185,"uuid":"556689918","full_name":"Amagash/dna_encoding","owner":"Amagash","description":"Convert digital information into DNA a sequence","archived":false,"fork":false,"pushed_at":"2024-10-29T23:54:43.000Z","size":37,"stargazers_count":110,"open_issues_count":1,"forks_count":20,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-29T20:05:11.771Z","etag":null,"topics":["hacktoberfest","hacktoberfest-accepted"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Amagash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-24T10:24:30.000Z","updated_at":"2025-02-14T12:04:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"42b3c3c7-536c-4fec-a313-93aad8ce3643","html_url":"https://github.com/Amagash/dna_encoding","commit_stats":{"total_commits":37,"total_committers":2,"mean_commits":18.5,"dds":"0.027027027027026973","last_synced_commit":"5d7795afdda10d70ec92fd624718579c87551926"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amagash%2Fdna_encoding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amagash%2Fdna_encoding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amagash%2Fdna_encoding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amagash%2Fdna_encoding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Amagash","download_url":"https://codeload.github.com/Amagash/dna_encoding/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399877,"owners_count":20932876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","hacktoberfest-accepted"],"created_at":"2024-10-16T21:06:11.648Z","updated_at":"2025-04-05T21:07:34.310Z","avatar_url":"https://github.com/Amagash.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DNA ENCODING\n\nThis project allows to convert a string into a DNA sequence and vice versa. This is to showcase the possibility of storing digital information inside a string of DNA. \n\n⚠ Disclaimer: This project is just a POC and is not intended for research or production work. This project only as educational purposes.\n\n## I. Conversion String to DNA\n### 1. Craft a secret message\nThe first step is to find the secret message you want to encode in a DNA strand. There are some guidelines to follow:\n1. The message should only contains alphanumeric characters and spaces (e.i 0-9, a-z and A-Z), no special characters or punctuation allowed.\n2. Although upper-cased letters are accepted, the final message will be retrieved in lower-case meaning that acronyms might be less obvious.\n\n### 2. Secret message =\u003e Formatted secret message\nOnce you have your secret message there is a first step of message formatting. It is not possible to directly convert the sentence into binary because the DNA won't be synthesizable. Indeed, when encoding txt into DNA by directly transforming bits to ATCG, we end up with high GC content and repeated patterns. This makes sense because a sentence contains a lot of repeated characters (e.g spaces ' ' or frequent letters like 'e'). It is therefore necessary to add some randomness into the sentence. To bypass this issue, we alternate between lowercase and uppercase of the same letter and sequencially assign a special character to spaces (that is the reason why special characters are not allowed).\n\nThe formatted sentence of `\"This is a secret message\"` becomes `\"This IS#a\u0026secrEt§meSsAgE\"`.\n\nAlso to make sure we know where the message starts and stops, I encapsulated the message between \"START\" and \"STOP\". Therefore the previous sentence `\"This is a secret message\"` actually becomes `\"STARTThis IS#a\u0026secrEt§meSsAgESTOP\"`.\n\n### 3. Formatted secret message =\u003e Binary sequence \nOnce the message is formatted, we simply convert it into Binary so `\"STARTThis IS#a\u0026secrEt§meSsAgESTOP\"` becomes `\"010100110101010001000001010100100101010001010100011010000110100101110011001000000100100101010011001000110110000100100110011100110110010101100011011100100100010101110100101001110110110101100101010100110111001101000001011001110100010101010011010101000100111101010000\"`.\n\n### 4. Binary sequence =\u003e DNA Sequence\nFor now, the conversion relies on naive bit encoding meaning :\n\n| DNA | Binary |\n| :---: | :---: |\n| A | 00 |\n| C | 01 |\n| G | 10 |\n| T | 11 |\n\nOther data compression algorithms exist like the Huffman Code but for this Proof of concept (POC) we will keep it as simple as possible. Therefore the previous binary sequence becomes `\"CCATCCCACAACCCAGCCCACCCACGGACGGCCTATAGAACAGCCCATAGATCGACAGCGCTATCGCCCGATCTAGCACCCTCAGGCTCGTCCGCCCCATCTATCAACCGCTCACCCCATCCCACATTCCAA\"`\n\nThere it is, you have your DNA sequence ready to be synthetized.\n\n## II. Conversion DNA to String\nIf you have a DNA strand containing a secret message and you want to read it, you'll first have to find a sequencing machine. \nFor this POC, we partnered with the Pasteur institute to use a [MinION](https://nanoporetech.com/products/minion). \nThe MinION reads the DNA and generates a file in the [FASTA format](minion_sequence.fasta) where it is possible to read the DNA sequence. From the DNA sequence it is possible to work backward from the conversion steps we saw above. \n\nHave fun encoding your own secret messages into DNA strands :smiley:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famagash%2Fdna_encoding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famagash%2Fdna_encoding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famagash%2Fdna_encoding/lists"}