aboutsummaryrefslogtreecommitdiff
path: root/docs/encoding-binary-data-into-dna-sequence.html
blob: e89e5c4c280a5e4c1b444f947881581c7eb1af4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta http-equiv=X-UA-Compatible content="ie=edge"><meta name=theme-color content=#ffffff><meta name=google-site-verification content=EwUGW1WlCkRIQuyQ9AE1-bLitWthw-eVMZFTAMZVZaA><title>Encoding binary data into DNA sequence</title><meta name=author content="Mitja Felicijan"><meta name=description content="Imagine a world where you could go outside and take a leaf from a tree and put it through your personal DNA sequencer and get data like music, videos or computer programs from it."><meta name=og:url content=https://mitjafelicijan.com/encoding-binary-data-into-dna-sequence><meta name=og:type content=website><meta name=og:title content="Encoding binary data into DNA sequence"><meta name=og:description content="Imagine a world where you could go outside and take a leaf from a tree and put it through your personal DNA sequencer and get data like music, videos or computer programs from it."><meta name=og:image content="https://mitjafelicijan.com/assets/avatar.gif?ver=1550436635"><meta name=twitter:card content=summary><meta name=twitter:site content=@mitjafelicijan><meta name=twitter:title content="Encoding binary data into DNA sequence"><meta name=twitter:description content="Imagine a world where you could go outside and take a leaf from a tree and put it through your personal DNA sequencer and get data like music, videos or computer programs from it."><meta name=twitter:image content="https://mitjafelicijan.com/assets/avatar.gif?ver=1550436635"><style>@charset "utf-8";@import url('https://fonts.googleapis.com/css?family=Heebo:100,300,400,500,700,800,900 rel="stylesheet">');@import url('https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600,700,900 rel="stylesheet">');*{box-sizing:border-box;-moz-osx-font-smoothing:grayscale!important;text-rendering:optimizeLegibility!important;-webkit-font-smoothing:antialiased!important}body{font-family:Heebo,sans-serif;font-size:18px;line-height:170%}a{color:inherit;text-decoration:underline;text-decoration-color:#f0f;text-decoration-style:wavy;border:2px dotted transparent;display:inline-block}a:active{border-color:#000}ol a{text-decoration:none}ol a:hover{text-decoration:underline}h1{line-height:140%;font-weight:900;font-size:250%}h2,h3,h4,h5{margin-top:50px}img{max-width:100%;margin:0 auto;display:block}.wrapper{max-width:750px;margin:0 auto}blockquote{margin:50px 0 50px 50px}.pubdate{font-size:80%;color:#666}code,pre{font-family:'Source Code Pro',monospace!important;font-weight:500}pre{font-size:80%;margin:20px;background:#eee}p>code{background:#302e2e;padding:1px .95rem 2px;border-radius:1em;font-size:70%;font-weight:600;color:#fff;display:inline;-webkit-box-decoration-break:clone;cursor:crosshair}p>code:hover{background:#f0f}ol{list-style:none;counter-reset:li}ol li{counter-increment:li}ol li::before{content:counter(li) ".";color:#ccc;font-weight:500;display:inline-block;width:1em;margin-left:-1.5em;margin-right:.9em;text-align:right}ol li a{text-decoration:none}table{width:100%;border-collapse:collapse;border-spacing:0;font-size:90%;text-align:left;margin-top:50px;margin-bottom:50px}td,th{border-bottom:2px solid #888;padding:10px}th{font-size:130%}tr:last-child td{border-width:0}.footnotes p{padding:0;display:inline-block;margin:0}.footnotes-sep{border:0}::selection{background:#ff0;color:#000}::-moz-selection{background:#ff0;color:#000}pre::-webkit-scrollbar{width:5px;height:8px;background-color:transparent}pre::-webkit-scrollbar-thumb{background:#ddd}menu{display:grid;grid-template-columns:1fr 1fr;font-size:80%;padding:0;padding-top:10px}menu a.logo{background:#000;color:#fff;font-weight:800;text-decoration:none;padding:3px 15px}menu a.logo:hover{background:#f0f;color:#fff}menu nav{text-align:right;margin-top:3px}menu nav a{padding-top:8px;margin-left:25px}menu nav a svg{width:20px;height:20px}footer{padding-top:50px;padding-bottom:50px;font-weight:500;font-size:80%}footer>*{text-decoration:none;margin-right:20px;color:#333}@media only screen and (max-width:800px){body{font-size:16px}.wrapper{padding:10px 20px!important}h1{font-size:200%}}.article-list a{text-decoration:none}.article-list a h2{margin-bottom:5px}code[class*=language-],pre[class*=language-]{color:#000;font-family:monospace;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#999}.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#690}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url{color:#9a6e3a}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.class-name,.token.function{color:#dd4a68}.token.important,.token.regex,.token.variable{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}pre[class*=language-].line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}</style></head><body><main class=wrapper><menu><div><a href=/ class=logo>mitja felicijan</a></div><nav><a href=//github.com/mitjafelicijan><svg version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink x=0px y=0px viewBox="0 0 92 92"style="enable-background:new 0 0 92 92;"xml:space=preserve><g><path style=fill:#030104; d="M61.896,52.548c-3.59,0-6.502,4.026-6.502,8.996c0,4.971,2.912,8.999,6.502,8.999
            c3.588,0,6.498-4.028,6.498-8.999C68.395,56.574,65.484,52.548,61.896,52.548z M84.527,29.132c0.74-1.826,0.777-12.201-3.17-22.132
            c0,0-9.057,0.993-22.76,10.396c-2.872-0.793-7.736-1.19-12.597-1.19s-9.723,0.396-12.598,1.189C19.699,7.993,10.645,7,10.645,7
            c-3.948,9.931-3.913,20.306-3.172,22.132C2.834,34.169,0,40.218,0,48.483c0,35.932,29.809,36.508,37.334,36.508
            c1.703,0,5.088,0.004,8.666,0.009c3.578-0.005,6.965-0.009,8.666-0.009C62.191,84.991,92,84.415,92,48.483
            C92,40.218,89.166,34.169,84.527,29.132z M46.141,80.574H45.86c-18.859,0-33.545-2.252-33.545-20.58
            c0-4.389,1.549-8.465,5.229-11.847c6.141-5.636,16.527-2.651,28.316-2.651c0.045,0,0.093-0.001,0.141-0.003
            c0.049,0.002,0.096,0.003,0.141,0.003c11.789,0,22.178-2.984,28.316,2.651c3.68,3.382,5.229,7.458,5.229,11.847
            C79.686,78.322,65,80.574,46.141,80.574z M30.104,52.548c-3.588,0-6.498,4.026-6.498,8.996c0,4.971,2.91,8.999,6.498,8.999
            c3.592,0,6.502-4.028,6.502-8.999C36.605,56.574,33.695,52.548,30.104,52.548z"/></g></svg> </a><a href=//twitter.com/mitjafelicijan><svg version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink x=0px y=0px viewBox="0 0 612 612"style="enable-background:new 0 0 612 612;"xml:space=preserve><g><path style=fill:#010002; d="M612,116.258c-22.525,9.981-46.694,16.75-72.088,19.772c25.929-15.527,45.777-40.155,55.184-69.411
            c-24.322,14.379-51.169,24.82-79.775,30.48c-22.907-24.437-55.49-39.658-91.63-39.658c-69.334,0-125.551,56.217-125.551,125.513
            c0,9.828,1.109,19.427,3.251,28.606C197.065,206.32,104.556,156.337,42.641,80.386c-10.823,18.51-16.98,40.078-16.98,63.101
            c0,43.559,22.181,81.993,55.835,104.479c-20.575-0.688-39.926-6.348-56.867-15.756v1.568c0,60.806,43.291,111.554,100.693,123.104
            c-10.517,2.83-21.607,4.398-33.08,4.398c-8.107,0-15.947-0.803-23.634-2.333c15.985,49.907,62.336,86.199,117.253,87.194
            c-42.947,33.654-97.099,53.655-155.916,53.655c-10.134,0-20.116-0.612-29.944-1.721c55.567,35.681,121.536,56.485,192.438,56.485
            c230.948,0,357.188-191.291,357.188-357.188l-0.421-16.253C573.872,163.526,595.211,141.422,612,116.258z"/></g></svg></a></nav></menu><article><header><h1>Encoding binary data into DNA sequence</h1><p class=pubdate>Published on <time pubdate=2019-01-03>January 3, 2019</time> by Mitja Felicijan</p></header><p><strong>Table of contents</strong></p><ol><li><a href=#initial-thoughts>Initial thoughts</a></li><li><a href=#glossary>Glossary</a></li><li><a href=#data-encoding>Data encoding</a></li><li><a href=#quick-history-of-dna>Quick history of DNA</a></li><li><a href=#what-is-dna>What is DNA?</a></li><li><a href=#encode-binary-data-into-dna-sequence>Encode binary data into DNA sequence</a><ol><li><a href=#basic-encoding>Basic Encoding</a></li><li><a href=#fasta-file-format>FASTA file format</a></li><li><a href=#png-encoded-dna-sequence>PNG encoded DNA sequence</a></li></ol></li><li><a href=#encoding-text-file-in-practice>Encoding text file in practice</a></li><li><a href=#toolkit-for-encoding-data>Toolkit for encoding data</a><ol><li><a href=#dnae-encode>dnae-encode</a></li><li><a href=#dnae-png>dnae-png</a></li></ol></li><li><a href=#benchmarks>Benchmarks</a></li><li><a href=#references>References</a></li></ol><h2 id=initial-thoughts>Initial thoughts</h2><p>Imagine a world where you could go outside and take a leaf from a tree and put it through your personal DNA sequencer and get data like music, videos or computer programs from it. Well, this is all possible now. It was not done on a large scale because it is quite expensive to create DNA strands but it’s possible.</p><p>Encoding data into DNA sequence is relatively simple process once you understand the relationship between binary data and nucleotides and scientists have been making large leaps in this field in order to provide viable long-term storage solution for our data that would potentially survive our specie if case of global disaster. We could imprint all the world’s knowledge into plants and ensure the survival of our knowledge.</p><p>More optimistic usage for this technology would be easier storage of ever growing data we produce every day. Once machines for sequencing DNA become fast enough and cheaper this could mean the next evolution of storing data and abandoning classical hard and solid state drives in data warehouses.</p><p>As we currently stand this is still not viable but it is quite an amazing and cool technology.</p><p>My interests in this field are purely in encoding processes and experimental testing mainly because I don’t have the access to this expensive machines. My initial goal was to create a toolkit that can be used by everybody to encode their data into a proper DNA sequence.</p><h2 id=glossary>Glossary</h2><dl><dt><strong>deoxyribose</strong></dt><dd>A five-carbon sugar molecule with a hydrogen atom rather than a hydroxyl group in the 2′ position; the sugar component of DNA nucleotides.</dd><dt><strong>double helix</strong></dt><dd>The molecular shape of DNA in which two strands of nucleotides wind around each other in a spiral shape.</dd><dt><strong>nitrogenous base</strong></dt><dd>A nitrogen-containing molecule that acts as a base; often referring to one of the purine or pyrimidine components of nucleic acids.</dd><dt><strong>phosphate group</strong></dt><dd>A molecular group consisting of a central phosphorus atom bound to four oxygen atoms.</dd><dt><strong>RGB</strong></dt><dd>The RGB color model is an additive color model in which red, green and blue light are added together in various ways to reproduce a broad array of colors.</dd><dt><strong>GCC</strong></dt><dd>The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages.</dd></dl><h2 id=data-encoding>Data encoding</h2><p><strong>TL;DR:</strong> Encoding involves the use of a code to change original data into a form that can be used by an external process <sup class=footnote-ref><a href=#fn1 id=fnref1>[1]</a></sup>.</p><p>Encoding is the process of converting data into a format required for a number of information processing needs, including:</p><ul><li>Program compiling and execution</li><li>Data transmission, storage and compression/decompression</li><li>Application data processing, such as file conversion</li></ul><p>Encoding can have two meanings<sup class=footnote-ref><a href=#fn1 id=fnref1:1>[1:1]</a></sup>:</p><ul><li>In computer technology, encoding is the process of applying a specific code, such as letters, symbols and numbers, to data for conversion into an equivalent cipher.</li><li>In electronics, encoding refers to analog to digital conversion.</li></ul><h2 id=quick-history-of-dna>Quick history of DNA</h2><ul><li><strong>1869</strong> - Friedrich Miescher identifies “nuclein”.</li><li><strong>1900s</strong> - The Eugenics Movement.</li><li><strong>1900</strong> – Mendel’s theories are rediscovered by researchers.</li><li><strong>1944</strong> - Oswald Avery identifies DNA as the ‘transforming principle’.</li><li><strong>1952</strong> - Rosalind Franklin photographs crystallized DNA fibres.</li><li><strong>1953</strong> - James Watson and Francis Crick discover the double helix structure of DNA.</li><li><strong>1965</strong> - Marshall Nirenberg is the first person to sequence the bases in each codon.</li><li><strong>1983</strong> - Huntington’s disease is the first mapped genetic disease.</li><li><strong>1990</strong> - The Human Genome Project begins.</li><li><strong>1995</strong> - Haemophilus Influenzae is the first bacterium genome sequenced.</li><li><strong>1996</strong> - Dolly the sheep is cloned.</li><li><strong>1999</strong> - First human chromosome is decoded.</li><li><strong>2000</strong> – Genetic code of the fruit fly is decoded.</li><li><strong>2002</strong> – Mouse is the first mammal to have its genome decoded.</li><li><strong>2003</strong> – The Human Genome Project is completed.</li><li><strong>2013</strong> – DNA Worldwide and Eurofins Forensic discover identical twins have differences in their genetic makeup <sup class=footnote-ref><a href=#fn2 id=fnref2>[2]</a></sup>.</li></ul><h2 id=what-is-dna%3F>What is DNA?</h2><p>Deoxyribonucleic acid, a self-replicating material which is <strong>present in nearly all living organisms</strong> as the main constituent of chromosomes. It is the <strong>carrier of genetic information</strong>.</p><blockquote><p>The nitrogen in our DNA, the calcium in our teeth, the iron in our blood, the carbon in our apple pies were made in the interiors of collapsing stars. We are made of starstuff.</p><p><strong>– Carl Sagan, Cosmos</strong></p></blockquote><p>The nucleotide in DNA consists of a sugar (deoxyribose), one of four bases (cytosine ©, thymine (T), adenine (A), guanine (G)), and a phosphate. Cytosine and thymine are pyrimidine bases, while adenine and guanine are purine bases. The sugar and the base together are called a nucleoside.</p><p><img src=/files/dna-sequence/dna-basics.jpg#center alt=DNA></p><p><em>DNA (a) forms a double stranded helix, and (b) adenine pairs with thymine and cytosine pairs with guanine. (credit a: modification of work by Jerome Walker, Dennis Myts) <sup class=footnote-ref><a href=#fn3 id=fnref3>[3]</a></sup></em></p><h2 id=encode-binary-data-into-dna-sequence>Encode binary data into DNA sequence</h2><p>As an input file you can use any file you want:</p><ul><li>ASCII files,</li><li>Compiled programs,</li><li>Multimedia files (MP3, MP4, MVK, etc),</li><li>Images,</li><li>Database files,</li><li>etc.</li></ul><p>Note: If you would copy all the bytes from RAM to file or pipe data to file you could encode also this data as long as you provide file pointer to the encoder.</p><h3 id=basic-encoding>Basic Encoding</h3><p>As already mentioned, the Basic Encoding is based on a simple mapping. Since DNA is composed of 4 nucleotides (Adenine, Cytosine, Guanine, Thymine; usually referred using the first letter). Using this technique we can encode</p><p>$$ log_2(4) = log_2(2^2) = 2 bits $$</p><p>using a single nucleotide. In this way, we are able to use the 4 bases that compose the DNA strand to encode each byte of data.</p><table><thead><tr><th>Two bits</th><th>Nucleotides</th></tr></thead><tbody><tr><td>00</td><td><strong>A</strong> (Adenine)</td></tr><tr><td>10</td><td><strong>G</strong> (Guanine)</td></tr><tr><td>01</td><td><strong>C</strong> (Cytosine)</td></tr><tr><td>11</td><td><strong>T</strong> (Thymine)</td></tr></tbody></table><p>With this in mind we can simply encode any data by using two-bit to Nucleotides conversion</p><pre class=language-pascal><code class=language-pascal><span class="token comment">{ Algorithm 1: Naive byte array to DNA encode }</span>
<span class="token keyword">procedure</span> EncodeToDNASequence<span class="token punctuation">(</span>f<span class="token punctuation">)</span> <span class="token keyword">string</span>
<span class="token keyword">begin</span>
  enc <span class="token keyword">string</span>
  <span class="token keyword">while</span> <span class="token operator">not</span> eof<span class="token punctuation">(</span>f<span class="token punctuation">)</span> <span class="token keyword">do</span>
    c byte <span class="token operator">:=</span> buffer<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>                             <span class="token comment">{ Read 1 byte from buffer }</span>
    bin integer <span class="token operator">:=</span> sprintf<span class="token punctuation">(</span><span class="token string">'08b'</span><span class="token punctuation">,</span> c<span class="token punctuation">)</span>                <span class="token comment">{ Convert to string binary }</span>
    <span class="token keyword">for</span> e <span class="token operator">in</span> range<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">6</span><span class="token punctuation">]</span> <span class="token keyword">do</span>
      <span class="token keyword">if</span> e<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> <span class="token operator">=</span><span class="token operator">=</span> <span class="token number">48</span> <span class="token operator">and</span> e<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span> <span class="token operator">=</span><span class="token operator">=</span> <span class="token number">48</span> <span class="token keyword">then</span>             <span class="token comment">{ 0x00 - A (Adenine) }</span>
        enc <span class="token operator">+=</span> <span class="token string">'A'</span>
      <span class="token keyword">else</span> <span class="token keyword">if</span> e<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> <span class="token operator">=</span><span class="token operator">=</span> <span class="token number">48</span> <span class="token operator">and</span> e<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span> <span class="token operator">=</span><span class="token operator">=</span> <span class="token number">49</span> <span class="token keyword">then</span>        <span class="token comment">{ 0x01 - G (Guanine) }</span>
        enc <span class="token operator">+=</span> <span class="token string">'G'</span>
      <span class="token keyword">else</span> <span class="token keyword">if</span> e<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> <span class="token operator">=</span><span class="token operator">=</span> <span class="token number">49</span> <span class="token operator">and</span> e<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span> <span class="token operator">=</span><span class="token operator">=</span> <span class="token number">48</span> <span class="token keyword">then</span>        <span class="token comment">{ 0x10 - C (Cytosine) }</span>
        enc <span class="token operator">+=</span> <span class="token string">'C'</span>
      <span class="token keyword">else</span> <span class="token keyword">if</span> e<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> <span class="token operator">=</span><span class="token operator">=</span> <span class="token number">49</span> <span class="token operator">and</span> e<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span> <span class="token operator">=</span><span class="token operator">=</span> <span class="token number">49</span> <span class="token keyword">then</span>        <span class="token comment">{ 0x11 - T (Thymine) }</span>
        enc <span class="token operator">+=</span> <span class="token string">'T'</span>
  return enc                                        <span class="token comment">{ Return DNA sequence }</span>
<span class="token keyword">end</span>
</code></pre><p>Another encoding would be <strong>Goldman encoding</strong>. Using this encoding helps with Nonsense mutation (amino acids replaced by a stop codon) that occurs and is the most problematic during translation because it leads to truncated amino acid sequences, which in turn results in truncated proteins. <sup class=footnote-ref><a href=#fn4 id=fnref4>[4]</a></sup></p><p><a href="https://www.youtube.com/watch?v=a4PiGWNsIEU">Where to store big data? In DNA: Nick Goldman at TEDxPrague</a></p><h3 id=fasta-file-format>FASTA file format</h3><p>In bioinformatics, FASTA format is a text-based format for representing either nucleotide sequences or peptide sequences, in which nucleotides or amino acids are represented using single-letter codes. The format also allows for sequence names and comments to precede the sequences. The format originates from the FASTA software package, but has now become a standard in the field of bioinformatics. <sup class=footnote-ref><a href=#fn5 id=fnref5>[5]</a></sup></p><p>The first line in a FASTA file started either with a “&gt;” (greater-than) symbol or, less frequently, a “;” (semicolon) was taken as a comment. Subsequent lines starting with a semicolon would be ignored by software. Since the only comment used was the first, it quickly became used to hold a summary description of the sequence, often starting with a unique library accession number, and with time it has become commonplace to always use “&gt;” for the first line and to not use “;” comments (which would otherwise be ignored).</p><pre class=language-text><code class=language-text>;LCBO - Prolactin precursor - Bovine
; a sample sequence in FASTA format
MDSKGSSQKGSRLLLLLVVSNLLLCQGVVSTPVCPNGPGNCQVSLRDLFDRAVMVSHYIHDLSS
EMFNEFDKRYAQGKGFITMALNSCHTSSLPTPEDKEQAQQTHHEVLMSLILGLLRSWNDPLYHL
VTEVRGMKGAPDAILSRAIEIEEENKRLLEGMEMIFGQVIPGAKETEPYPVWSGLPSLQTKDED
ARYSAFYNLLHCLRRDSSKIDTYLKLLNCRIIYNNNC*

&gt;MCHU - Calmodulin - Human, rabbit, bovine, rat, and chicken
ADQLTEEQIAEFKEAFSLFDKDGDGTITTKELGTVMRSLGQNPTEAELQDMINEVDADGNGTID
FPEFLTMMARKMKDTDSEEEIREAFRVFDKDGNGYISAAELRHVMTNLGEKLTDEEVDEMIREA
DIDGDGQVNYEEFVQMMTAK*

&gt;gi|5524211|gb|AAD44166.1| cytochrome b [Elephas maximus maximus]
LCLYTHIGRNIYYGSYLYSETWNTGIMLLLITMATAFMGYVLPWGQMSFWGATVITNLFSAIPYIGTNLV
EWIWGGFSVDKATLNRFFAFHFILPFTMVALAGVHLTFLHETGSNNPLGLTSDSDKIPFHPYYTIKDFLG
LLILILLLLLLALLSPDMLGDPDNHMPADPLNTPLHIKPEWYFLFAYAILRSVPNKLGGVLALFLSIVIL
GLMPFLHTSKHRSMMLRPLSQALFWTLTMDLLTLTWIGSQPVEYPYTIIGQMASILYFSIILAFLPIAGX
IENY
</code></pre><p>FASTA format was extended by <a href=https://en.wikipedia.org/wiki/FASTQ_format>FASTQ</a> format from the <a href=https://www.sanger.ac.uk/ >Sanger Centre</a> in Cambridge.</p><h3 id=png-encoded-dna-sequence>PNG encoded DNA sequence</h3><p>| Nucleotides | RGB | Color name |<br>| | – | - |<br>| A (Adenine) | (0,0,255) | Blue |<br>| G (Guanine) | (0,100,0) | Green |<br>| C (Cytosine) | (255,0,0) | Red |<br>| T (Thymine) | (255,255,0) | Yellow |</p><p>With this in mind we can create a simple algorithm to create PNG representation of a DNA sequence.</p><pre class=language-pascal><code class=language-pascal><span class="token comment">{ Algorithm 2: Naive DNA to PNG encode from FASTA file }</span>
<span class="token keyword">procedure</span> EncodeDNASequenceToPNG<span class="token punctuation">(</span>f<span class="token punctuation">)</span>
<span class="token keyword">begin</span>
  i image
  <span class="token keyword">while</span> <span class="token operator">not</span> eof<span class="token punctuation">(</span>f<span class="token punctuation">)</span> <span class="token keyword">do</span>
    c char <span class="token operator">:=</span> buffer<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>                             <span class="token comment">{ Read 1 char from buffer }</span>
    <span class="token keyword">case</span> c <span class="token keyword">of</span>
      <span class="token string">'A'</span><span class="token punctuation">:</span> color <span class="token operator">:=</span> RGB<span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">255</span><span class="token punctuation">)</span>                  <span class="token comment">{ Blue }</span>
      <span class="token string">'G'</span><span class="token punctuation">:</span> color <span class="token operator">:=</span> RGB<span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span>                  <span class="token comment">{ Green }</span>
      <span class="token string">'C'</span><span class="token punctuation">:</span> color <span class="token operator">:=</span> RGB<span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span>                  <span class="token comment">{ Red }</span>
      <span class="token string">'T'</span><span class="token punctuation">:</span> color <span class="token operator">:=</span> RGB<span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">,</span> <span class="token number">255</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span>                <span class="token comment">{ Yellow }</span>
    drawRect<span class="token punctuation">(</span>i<span class="token punctuation">,</span> <span class="token punctuation">[</span>x<span class="token punctuation">,</span> y<span class="token punctuation">]</span><span class="token punctuation">,</span> color<span class="token punctuation">)</span>
  save<span class="token punctuation">(</span>i<span class="token punctuation">)</span>                                           <span class="token comment">{ Save PNG image }</span>
<span class="token keyword">end</span>
</code></pre><h2 id=encoding-text-file-in-practice>Encoding text file in practice</h2><p>In this example we will take a simple text file as our input stream for encoding. This file will have a quote from Niels Bohr and saved as txt file.</p><blockquote><p>How wonderful that we have met with a paradox. Now we have some hope of making progress.<br>― Niels Bohr</p></blockquote><p>First we encode text file into FASTA file.</p><pre class=language-bash><code class=language-bash>./dnae-encode -i quote.txt -o quote.fa
2019/01/10 00:38:29 Gathering input <span class="token function">file</span> stats
2019/01/10 00:38:29 Starting encoding <span class="token punctuation">..</span>.
 106 B / 106 B <span class="token punctuation">[</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token punctuation">]</span> 100.00% 0s
2019/01/10 00:38:29 Saving to FASTA <span class="token function">file</span> <span class="token punctuation">..</span>.
2019/01/10 00:38:29 Output FASTA <span class="token function">file</span> length is 438 B
2019/01/10 00:38:29 Process took 987.263µs
2019/01/10 00:38:29 Done <span class="token punctuation">..</span>.
</code></pre><p>Output of <code>quote.fa</code> file contains the encoded DNA sequence in ASCII format.</p><pre class=language-text><code class=language-text>&gt;SEQ1
GACAGCTTGTGTACAAGTGTGCTTGCTCGCGAGCGGGTACGCGCGTGGGCTAACAAGTGA
GCCAGCAGGTGAACAAGTGTGCGGACAAGCCAGCAGGTGCGCGGACAAGCTGGCGGGTGA
ACAAGTGTGCCGGTGAGCCAACAAGCAGACAAGTAAGCAGGTACGCAGGCGAGCTTGTCA
ACTCACAAGATCGCTTGTGTACAAGTGTGCGGACAAGCCAGCAGGTGCGCGGACAAGTAT
GCTTGCTGGCGGACAAGCCAGCTTGTAAGCGGACAAGCTTGCGCACAAGCTGGCAGGCCT
GCCGGCTCGCGTACAAATTCACAAGTAAGTACGCTTGCGTGTACGCGGGTATGTATACTC
AACCTCACCAAACGGGACAAGATCGCCGGCGGGCTAGTATACAAGAACGCTTGCCAGTAC
AACC
</code></pre><p>Then we encode FASTA file from previous operation to encode this data into PNG.</p><pre class=language-bash><code class=language-bash>./dnae-png -i quote.fa -o quote.png
2019/01/10 00:40:09 Gathering input <span class="token function">file</span> stats <span class="token punctuation">..</span>.
2019/01/10 00:40:09 Deconstructing FASTA <span class="token function">file</span> <span class="token punctuation">..</span>.
2019/01/10 00:40:09 Compositing image <span class="token function">file</span> <span class="token punctuation">..</span>.
 424 / 424 <span class="token punctuation">[</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token punctuation">]</span> 100.00% 0s
2019/01/10 00:40:09 Saving output <span class="token function">file</span> <span class="token punctuation">..</span>.
2019/01/10 00:40:09 Output image <span class="token function">file</span> length is 1.1 kB
2019/01/10 00:40:09 Process took 19.036117ms
2019/01/10 00:40:09 Done <span class="token punctuation">..</span>.
</code></pre><p>After encoding into PNG format this file looks like this.</p><p><img src=/files/dna-sequence/quote.png alt="Encoded Quote in PNG format"></p><p>The larger the input stream is the larger the PNG file would be.</p><p>Compiled basic Hello World C program with <a href=https://www.gnu.org/software/gcc/ >GCC</a> would <a href=/files/dna-sequence/sample.png>look like</a>.</p><pre class=language-c><code class=language-c><span class="token comment">// gcc -O3 -o sample sample.c</span>
<span class="token macro property">#<span class="token directive keyword">include</span> <span class="token string">&lt;stdio.h></span></span>

<span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"Hello, world!\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">return</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre><h2 id=toolkit-for-encoding-data>Toolkit for encoding data</h2><p>I have created a toolkit with two main programs:</p><ul><li>dnae-encode (encodes file into FASTA file)</li><li>dnae-png (encodes FASTA file into PNG)</li></ul><p>Toolkit with full source code is available on <a href=https://github.com/mitjafelicijan/dna-encoding>github.com/mitjafelicijan/dna-encoding</a>.</p><h3 id=dnae-encode>dnae-encode</h3><pre class=language-bash><code class=language-bash><span class="token operator">></span> ./dnae-encode --help
usage: dnae-encode --input<span class="token operator">=</span>INPUT <span class="token punctuation">[</span><span class="token operator">&lt;</span>flags<span class="token operator">></span><span class="token punctuation">]</span>

A command-line application that encodes <span class="token function">file</span> into DNA sequence.

Flags:
      --help             Show context-sensitive <span class="token function">help</span> <span class="token punctuation">(</span>also try --help-long and --help-man<span class="token punctuation">)</span>.
  -i, --input<span class="token operator">=</span>INPUT      Input <span class="token function">file</span> <span class="token punctuation">(</span>ASCII or binary<span class="token punctuation">)</span> <span class="token function">which</span> will be encoded into DNA sequence.
  -o, --output<span class="token operator">=</span><span class="token string">"out.fa"</span>  Output <span class="token function">file</span> <span class="token function">which</span> stores DNA sequence <span class="token keyword">in</span> FASTA format.
  -s, --sequence<span class="token operator">=</span>SEQ1    The description line <span class="token punctuation">(</span>defline<span class="token punctuation">)</span> or header/identifier line, gives a name and/or a unique identifier <span class="token keyword">for</span> the sequence.
  -c, --columns<span class="token operator">=</span>60       Row characters length <span class="token punctuation">(</span>no <span class="token function">more</span> than 120 characters<span class="token punctuation">)</span>. Devices preallocate fixed line sizes <span class="token keyword">in</span> software.
      --version          Show application version.
</code></pre><h3 id=dnae-png>dnae-png</h3><pre class=language-bash><code class=language-bash><span class="token operator">></span> ./dnae-png --help
usage: dnae-png --input<span class="token operator">=</span>INPUT <span class="token punctuation">[</span><span class="token operator">&lt;</span>flags<span class="token operator">></span><span class="token punctuation">]</span>

A command-line application that encodes FASTA <span class="token function">file</span> into PNG image.

Flags:
      --help              Show context-sensitive <span class="token function">help</span> <span class="token punctuation">(</span>also try --help-long and --help-man<span class="token punctuation">)</span>.
  -i, --input<span class="token operator">=</span>INPUT       Input FASTA <span class="token function">file</span> <span class="token function">which</span> will be encoded into PNG image.
  -o, --output<span class="token operator">=</span><span class="token string">"out.png"</span>  Output <span class="token function">file</span> <span class="token keyword">in</span> PNG <span class="token function">format</span> that represents DNA sequence <span class="token keyword">in</span> graphical way.
  -s, --size<span class="token operator">=</span>10           Size of pairings of DNA bases on image <span class="token keyword">in</span> pixels <span class="token punctuation">(</span>lower resolution lower <span class="token function">file</span> size<span class="token punctuation">)</span>.
      --version           Show application version.
</code></pre><h2 id=benchmarks>Benchmarks</h2><p>First we generate some binary sample data with dd.</p><pre class=language-bash><code class=language-bash><span class="token function">dd</span> if<span class="token operator">=</span><span class="token operator">&lt;</span><span class="token punctuation">(</span>openssl enc -aes-256-ctr  -pass pass:<span class="token string">"<span class="token variable"><span class="token variable">$(</span><span class="token function">dd</span> if<span class="token operator">=</span>/dev/urandom bs<span class="token operator">=</span>128 count<span class="token operator">=</span>1 2<span class="token operator">></span>/dev/null <span class="token operator">|</span> base64<span class="token variable">)</span></span>"</span> -nosalt <span class="token operator">&lt;</span> /dev/zero<span class="token punctuation">)</span> of<span class="token operator">=</span>1KB.bin bs<span class="token operator">=</span>1KB count<span class="token operator">=</span>1 iflag<span class="token operator">=</span>fullblock
</code></pre><p>Our freshly generated 1KB file looks something like this (its full of garbage data as intended).</p><p><img src=/files/dna-sequence/sample-binary-file.png alt="Sample binary file 1KB"></p><p>We create following binary files:</p><ul><li>1KB.bin</li><li>10KB.bin</li><li>100KB.bin</li><li>1MB.bin</li><li>10MB.bin</li><li>100MB.bin</li></ul><p>After this we create FASTA files for all the binary files by encoding them into DNA sequence.</p><pre class=language-bash><code class=language-bash>./dnae-encode -i 100MB.bin -o 100MB.fa
</code></pre><p>Then we GZIP all the FASTA files to see how much the can be compressed.</p><pre class=language-bash><code class=language-bash><span class="token function">gzip</span> -9 <span class="token operator">&lt;</span> 10MB.fa <span class="token operator">></span> 10MB.fa.gz
</code></pre><script src=//cdn.plot.ly/plotly-latest.min.js></script><p><strong>Speed of encoding binary file into FASTA format.</strong></p><div id=encoding-benchmarks></div><script>(function(){
  var trace1 = {
    x: ['1KB.bin', '10KB.bin', '100KB.bin', '1MB.bin', '10MB.bin', '100MB.bin'],
    y: [5.625224, 32.679975, 112.864416, 872.887675, 8472.693202, 85525.178217],
    type: 'scatter',
  };
  var data = [trace1];
  Plotly.newPlot("encoding-benchmarks", data, {
    legend: {"orientation": "h"},
    height: 300,
    margin: { l: 50, r: 0, b: 50, t: 30, pad: 0 },
    yaxis: { title: "execution time in milliseconds", titlefont: { size: 12 } },
    });
})();</script><p><strong>File sizes of encoded files and also GZIP-ed variations.</strong></p><div id=size-benchmarks></div><script>(function(){
  var trace1 = {
    x: ['1KB.bin', '10KB.bin', '100KB.bin', '1MB.bin', '10MB.bin', '100MB.bin'],
    y: [4.1, 40.7, 406.7, 4100, 40700, 406700],
    name: 'FASTA file size',
    type: 'bar',
  };
  var trace2 = {
    x: ['1KB.bin', '10KB.bin', '100KB.bin', '1MB.bin', '10MB.bin', '100MB.bin'],
    y: [1.4, 13, 121, 1200, 12000, 118000],
    name: 'FASTA GZIPPED file size',
    type: 'bar',
  };
  var data = [trace1, trace2];
  Plotly.newPlot("size-benchmarks", data, {
    legend: {"orientation": "h"},
    height: 300,
    margin: { l: 50, r: 0, b: 50, t: 30, pad: 0 },
    yaxis: { title: "size in kilobytes", titlefont: { size: 12 } },
    barmode: 'stack'
    });
})();</script><p><a href=/files/dna-sequence/benchmarks.ods>Download ODS file with benchmarks.</a>.</p><h2 id=references>References</h2><hr class=footnotes-sep><section class=footnotes><ol class=footnotes-list><li id=fn1 class=footnote-item><p>https://www.techopedia.com/definition/948/encoding <a href=#fnref1 class=footnote-backref>↩︎</a> <a href=#fnref1:1 class=footnote-backref>↩︎</a></p></li><li id=fn2 class=footnote-item><p>https://www.dna-worldwide.com/resource/160/history-dna-timeline <a href=#fnref2 class=footnote-backref>↩︎</a></p></li><li id=fn3 class=footnote-item><p>https://opentextbc.ca/biology/chapter/9-1-the-structure-of-dna/ <a href=#fnref3 class=footnote-backref>↩︎</a></p></li><li id=fn4 class=footnote-item><p>https://arxiv.org/abs/1801.04774 <a href=#fnref4 class=footnote-backref>↩︎</a></p></li><li id=fn5 class=footnote-item><p>https://en.wikipedia.org/wiki/FASTA_format <a href=#fnref5 class=footnote-backref>↩︎</a></p></li></ol></section></article><script>var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-([\w-]+)\b/i,t=0,a=_self.Prism={manual:_self.Prism&&_self.Prism.manual,disableWorkerMessageHandler:_self.Prism&&_self.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof r?new r(e.type,a.util.encode(e.content),e.alias):"Array"===a.util.type(e)?e.map(a.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function(e,t){var r=a.util.type(e);switch(t=t||{},r){case"Object":if(t[a.util.objId(e)])return t[a.util.objId(e)];var s={};for(var i in t[a.util.objId(e)]=s,e)e.hasOwnProperty(i)&&(s[i]=a.util.clone(e[i],t));return s;case"Array":if(t[a.util.objId(e)])return t[a.util.objId(e)];s=[];return t[a.util.objId(e)]=s,e.forEach(function(e,r){s[r]=a.util.clone(e,t)}),s}return e}},languages:{extend:function(e,t){var r=a.util.clone(a.languages[e]);for(var s in t)r[s]=t[s];return r},insertBefore:function(e,t,r,s){var i=(s=s||a.languages)[e],n={};for(var o in i)if(i.hasOwnProperty(o)){if(o==t)for(var l in r)r.hasOwnProperty(l)&&(n[l]=r[l]);r.hasOwnProperty(o)||(n[o]=i[o])}var c=s[e];return s[e]=n,a.languages.DFS(a.languages,function(t,a){a===c&&t!=e&&(this[t]=n)}),n},DFS:function(e,t,r,s){for(var i in s=s||{},e)e.hasOwnProperty(i)&&(t.call(e,i,e[i],r||i),"Object"!==a.util.type(e[i])||s[a.util.objId(e[i])]?"Array"!==a.util.type(e[i])||s[a.util.objId(e[i])]||(s[a.util.objId(e[i])]=!0,a.languages.DFS(e[i],t,i,s)):(s[a.util.objId(e[i])]=!0,a.languages.DFS(e[i],t,null,s)))}},plugins:{},highlightAll:function(e,t){a.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,r){var s={callback:r,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};a.hooks.run("before-highlightall",s);for(var i,n=s.elements||e.querySelectorAll(s.selector),o=0;i=n[o++];)a.highlightElement(i,!0===t,s.callback)},highlightElement:function(t,r,s){for(var i,n,o=t;o&&!e.test(o.className);)o=o.parentNode;o&&(i=(o.className.match(e)||[,""])[1].toLowerCase(),n=a.languages[i]),t.className=t.className.replace(e,"").replace(/\s+/g," ")+" language-"+i,t.parentNode&&(o=t.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+i));var l={element:t,language:i,grammar:n,code:t.textContent},c=function(e){l.highlightedCode=e,a.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,a.hooks.run("after-highlight",l),a.hooks.run("complete",l),s&&s.call(l.element)};if(a.hooks.run("before-sanity-check",l),l.code)if(a.hooks.run("before-highlight",l),l.grammar)if(r&&_self.Worker){var u=new Worker(a.filename);u.onmessage=function(e){c(e.data)},u.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else c(a.highlight(l.code,l.grammar,l.language));else c(a.util.encode(l.code));else a.hooks.run("complete",l)},highlight:function(e,t,s){var i={code:e,grammar:t,language:s};return a.hooks.run("before-tokenize",i),i.tokens=a.tokenize(i.code,i.grammar),a.hooks.run("after-tokenize",i),r.stringify(a.util.encode(i.tokens),i.language)},matchGrammar:function(e,t,r,s,i,n,o){var l=a.Token;for(var c in r)if(r.hasOwnProperty(c)&&r[c]){if(c==o)return;var u=r[c];u="Array"===a.util.type(u)?u:[u];for(var p=0;p<u.length;++p){var d=u[p],g=d.inside,_=!!d.lookbehind,m=!!d.greedy,f=0,h=d.alias;if(m&&!d.pattern.global){var b=d.pattern.toString().match(/[imuy]*$/)[0];d.pattern=RegExp(d.pattern.source,b+"g")}d=d.pattern||d;for(var y=s,k=i;y<t.length;k+=t[y].length,++y){var x=t[y];if(t.length>e.length)return;if(!(x instanceof l)){if(m&&y!=t.length-1){if(d.lastIndex=k,!(z=d.exec(e)))break;for(var v=z.index+(_?z[1].length:0),w=z.index+z[0].length,F=y,P=k,A=t.length;F<A&&(P<w||!t[F].type&&!t[F-1].greedy);++F)v>=(P+=t[F].length)&&(++y,k=P);if(t[y]instanceof l)continue;S=F-y,x=e.slice(k,P),z.index-=k}else{d.lastIndex=0;var z=d.exec(x),S=1}if(z){_&&(f=z[1]?z[1].length:0);w=(v=z.index+f)+(z=z[0].slice(f)).length;var $=x.slice(0,v),j=x.slice(w),E=[y,S];$&&(++y,k+=$.length,E.push($));var N=new l(c,g?a.tokenize(z,g):z,h,z,m);if(E.push(N),j&&E.push(j),Array.prototype.splice.apply(t,E),1!=S&&a.matchGrammar(e,t,r,y,k,!0,c),n)break}else if(n)break}}}}},tokenize:function(e,t){var r=[e],s=t.rest;if(s){for(var i in s)t[i]=s[i];delete t.rest}return a.matchGrammar(e,r,t,0,0,!1),r},hooks:{all:{},add:function(e,t){var r=a.hooks.all;r[e]=r[e]||[],r[e].push(t)},run:function(e,t){var r=a.hooks.all[e];if(r&&r.length)for(var s,i=0;s=r[i++];)s(t)}}},r=a.Token=function(e,t,a,r,s){this.type=e,this.content=t,this.alias=a,this.length=0|(r||"").length,this.greedy=!!s};if(r.stringify=function(e,t,s){if("string"==typeof e)return e;if("Array"===a.util.type(e))return e.map(function(a){return r.stringify(a,t,e)}).join("");var i={type:e.type,content:r.stringify(e.content,t,s),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:s};if(e.alias){var n="Array"===a.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,n)}a.hooks.run("wrap",i);var o=Object.keys(i.attributes).map(function(e){return e+'="'+(i.attributes[e]||"").replace(/"/g,"&quot;")+'"'}).join(" ");return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+(o?" "+o:"")+">"+i.content+"</"+i.tag+">"},!_self.document)return _self.addEventListener?(a.disableWorkerMessageHandler||_self.addEventListener("message",function(e){var t=JSON.parse(e.data),r=t.language,s=t.code,i=t.immediateClose;_self.postMessage(a.highlight(s,a.languages[r],r)),i&&_self.close()},!1),_self.Prism):_self.Prism;var s=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return s&&(a.filename=s.src,a.manual||s.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(a.highlightAll):window.setTimeout(a.highlightAll,16):document.addEventListener("DOMContentLoaded",a.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism),Prism.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:/<!DOCTYPE[\s\S]+?>/i,cdata:/<!\[CDATA\[[\s\S]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/(^|[^\\])["']/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))}),Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?[\s\S]*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^{}\s][^{};]*?(?=\s*\{)/,string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},Prism.languages.css.atrule.inside.rest=Prism.languages.css,Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css",greedy:!0}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)),Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},/\b(?:as|async|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/],number:/\b(?:(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+)n?|\d+n|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,function:/[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\(|\.(?:apply|bind|call)\()/,operator:/-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^\/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z][A-Z\d_]*\b/}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/,greedy:!0,inside:{interpolation:{pattern:/\${[^}]+}/,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript",greedy:!0}}),Prism.languages.js=Prism.languages.javascript,"undefined"!=typeof self&&self.Prism&&self.document&&document.querySelector&&(self.Prism.fileHighlight=function(e){e=e||document;var t={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"};Array.prototype.slice.call(e.querySelectorAll("pre[data-src]")).forEach(function(e){if(!e.hasAttribute("data-src-loaded")){for(var a,r=e.getAttribute("data-src"),s=e,i=/\blang(?:uage)?-([\w-]+)\b/i;s&&!i.test(s.className);)s=s.parentNode;if(s&&(a=(e.className.match(i)||[,""])[1]),!a){var n=(r.match(/\.(\w+)$/)||[,""])[1];a=t[n]||n}var o=document.createElement("code");o.className="language-"+a,e.textContent="",o.textContent="Loading…",e.appendChild(o);var l=new XMLHttpRequest;l.open("GET",r,!0),l.onreadystatechange=function(){4==l.readyState&&(l.status<400&&l.responseText?(o.textContent=l.responseText,Prism.highlightElement(o),e.setAttribute("data-src-loaded","")):l.status>=400?o.textContent="✖ Error "+l.status+" while fetching file: "+l.statusText:o.textContent="✖ Error: File does not exist or is empty")},l.send(null)}}),Prism.plugins.toolbar&&Prism.plugins.toolbar.registerButton("download-file",function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&t.hasAttribute("data-src")&&t.hasAttribute("data-download-link")){var a=t.getAttribute("data-src"),r=document.createElement("a");return r.textContent=t.getAttribute("data-download-link-label")||"Download",r.setAttribute("download",""),r.href=a,r}})},document.addEventListener("DOMContentLoaded",function(){self.Prism.fileHighlight()})),function(){if("undefined"!=typeof self&&self.Prism&&self.document){var e=/\n(?!$)/g,t=function(t){var r=a(t)["white-space"];if("pre-wrap"===r||"pre-line"===r){var s=t.querySelector("code"),i=t.querySelector(".line-numbers-rows"),n=t.querySelector(".line-numbers-sizer"),o=s.textContent.split(e);n||((n=document.createElement("span")).className="line-numbers-sizer",s.appendChild(n)),n.style.display="block",o.forEach(function(e,t){n.textContent=e||"\n";var a=n.getBoundingClientRect().height;i.children[t].style.height=a+"px"}),n.textContent="",n.style.display="none"}},a=function(e){return e?window.getComputedStyle?getComputedStyle(e):e.currentStyle||null:null};window.addEventListener("resize",function(){Array.prototype.forEach.call(document.querySelectorAll("pre.line-numbers"),t)}),Prism.hooks.add("complete",function(a){if(a.code){var r=a.element.parentNode,s=/\s*\bline-numbers\b\s*/;if(r&&/pre/i.test(r.nodeName)&&(s.test(r.className)||s.test(a.element.className))&&!a.element.querySelector(".line-numbers-rows")){s.test(a.element.className)&&(a.element.className=a.element.className.replace(s," ")),s.test(r.className)||(r.className+=" line-numbers");var i,n=a.code.match(e),o=n?n.length+1:1,l=new Array(o+1);l=l.join("<span></span>"),(i=document.createElement("span")).setAttribute("aria-hidden","true"),i.className="line-numbers-rows",i.innerHTML=l,r.hasAttribute("data-start")&&(r.style.counterReset="linenumber "+(parseInt(r.getAttribute("data-start"),10)-1)),a.element.appendChild(i),t(r),Prism.hooks.run("line-numbers",a)}}}),Prism.hooks.add("line-numbers",function(e){e.plugins=e.plugins||{},e.plugins.lineNumbers=!0}),Prism.plugins.lineNumbers={getLine:function(e,t){if("PRE"===e.tagName&&e.classList.contains("line-numbers")){var a=e.querySelector(".line-numbers-rows"),r=parseInt(e.getAttribute("data-start"),10)||1,s=r+(a.children.length-1);t<r&&(t=r),t>s&&(t=s);var i=t-r;return a.children[i]}}}}}(),function(e){var t={variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\([^)]+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},/\$(?:[\w#?*!@]+|\{[^}]+\})/i]};e.languages.bash={shebang:{pattern:/^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,alias:"important"},comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<\s*)["']?(\w+?)["']?\s*\r?\n(?:[\s\S])*?\r?\n\2/,lookbehind:!0,greedy:!0,inside:t},{pattern:/(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/,greedy:!0,inside:t}],variable:t.variable,function:{pattern:/(^|[\s;|&])(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|[\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&])(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|[\s;|&])/,lookbehind:!0},boolean:{pattern:/(^|[\s;|&])(?:true|false)(?=$|[\s;|&])/,lookbehind:!0},operator:/&&?|\|\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/,punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];]/};var a=t.variable[1].inside;a.string=e.languages.bash.string,a.function=e.languages.bash.function,a.keyword=e.languages.bash.keyword,a.boolean=e.languages.bash.boolean,a.operator=e.languages.bash.operator,a.punctuation=e.languages.bash.punctuation,e.languages.shell=e.languages.bash}(Prism),Prism.languages.c=Prism.languages.extend("clike",{keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,operator:/-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/]/,number:/(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/,lookbehind:!0},directive:{pattern:/(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,lookbehind:!0,alias:"keyword"}}},constant:/\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/}),delete Prism.languages.c["class-name"],delete Prism.languages.c.boolean,Prism.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^{}\s][^{};]*?(?=\s*\{)/,string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.languages.css,Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css",greedy:!0}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)),Prism.languages.go=Prism.languages.extend("clike",{keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,builtin:/\b(?:bool|byte|complex(?:64|128)|error|float(?:32|64)|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(?:ln)?|real|recover)\b/,boolean:/\b(?:_|iota|nil|true|false)\b/,operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,number:/(?:\b0x[a-f\d]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[-+]?\d+)?)i?/i,string:{pattern:/(["'`])(\\[\s\S]|(?!\1)[^\\])*\1/,greedy:!0}}),delete Prism.languages.go["class-name"],Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,function:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,operator:/-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^\/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,alias:"function"},constant:/\b[A-Z][A-Z\d_]*\b/}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/,greedy:!0,inside:{interpolation:{pattern:/\${[^}]+}/,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}}}),Prism.languages.javascript["template-string"].inside.interpolation.inside.rest=Prism.languages.javascript,Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript",greedy:!0}}),Prism.languages.js=Prism.languages.javascript,Prism.languages.json={property:/"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i,string:{pattern:/"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,greedy:!0},number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,punctuation:/[{}[\]);,]/,operator:/:/g,boolean:/\b(?:true|false)\b/i,null:/\bnull\b/i},Prism.languages.jsonp=Prism.languages.json,Prism.languages.nginx=Prism.languages.extend("clike",{comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},keyword:/\b(?:CONTENT_|DOCUMENT_|GATEWAY_|HTTP_|HTTPS|if_not_empty|PATH_|QUERY_|REDIRECT_|REMOTE_|REQUEST_|SCGI|SCRIPT_|SERVER_|http|events|accept_mutex|accept_mutex_delay|access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth|auth_basic|auth_basic_user_file|auth_http|auth_http_header|auth_http_timeout|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|debug_connection|debug_points|default_type|deny|devpoll_changes|devpoll_events|directio|directio_alignment|disable_symlinks|empty_gif|env|epoll_events|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|google_perftools_profiles|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|imap_capabilities|imap_client_buffer|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|kqueue_changes|kqueue_events|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|lock_file|log_format|log_format_combined|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|multi_accept|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|pop3_auth|pop3_capabilities|port_in_redirect|post_action|postpone_output|protocol|proxy|proxy_buffer|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_error_message|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|proxy_timeout|proxy_upstream_fail_timeout|proxy_upstream_max_fails|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|rtsig_signo|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|smtp_auth|smtp_capabilities|so_keepalive|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|starttls|stub_status|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timeout|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|use|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|xclient|xml_entities|xslt_entities|xslt_stylesheet|xslt_types)\b/i}),Prism.languages.insertBefore("nginx","keyword",{variable:/\$[a-z_]+/i}),Prism.languages.pascal={comment:[/\(\*[\s\S]+?\*\)/,/\{[\s\S]+?\}/,/\/\/.*/],string:{pattern:/(?:'(?:''|[^'\r\n])*'|#[&$%]?[a-f\d]+)+|\^[a-z]/i,greedy:!0},keyword:[{pattern:/(^|[^&])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,lookbehind:!0},{pattern:/(^|[^&])\b(?:dispose|exit|false|new|true)\b/i,lookbehind:!0},{pattern:/(^|[^&])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,lookbehind:!0},{pattern:/(^|[^&])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,lookbehind:!0}],number:[/(?:[&%]\d+|\$[a-f\d]+)/i,/\b\d+(?:\.\d+)?(?:e[+-]?\d+)?/i],operator:[/\.\.|\*\*|:=|<[<=>]?|>[>=]?|[+\-*\/]=?|[@^=]/i,{pattern:/(^|[^&])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,lookbehind:!0}],punctuation:/\(\.|\.\)|[()\[\]:;,.]/},Prism.languages.objectpascal=Prism.languages.pascal,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},"triple-quoted-string":{pattern:/("""|''')[\s\S]+?\1/,greedy:!0,alias:"string"},string:{pattern:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},keyword:/\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:True|False|None)\b/,number:/(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,punctuation:/[{}[\];(),.:]/},document.querySelectorAll("table").forEach(function(e){if(!e.classList.contains("rouge-table")){let t=e.parentNode,a=document.createElement("div");a.classList.add("responsive-table"),t.replaceChild(a,e),a.appendChild(e)}});let links=document.links;for(let e=0,t=links.length;e<t;e++)links[e].hostname!=window.location.hostname&&(links[e].target="_blank",links[e].setAttribute("rel","noopener nofollow"));</script><link rel=stylesheet href="test.css?ver=1550436635"><footer><span>© 2012-2019</span> <a href=/curriculum-vitae>Curriculum Vitae</a> <a href=//github.com/mitjafelicijan target=_blank rel="noopener nofollow">Github</a> <a href=//twitter.com/mitjafelicijan target=_blank rel="noopener nofollow">Twitter</a></footer><script type=text/x-mathjax-config>MathJax.Hub.Config({
    TeX: {
      equationNumbers: {
        autoNumber: "AMS"
      }
    },
    tex2jax: {
      inlineMath: [ ['$','$'], ['\\(', '\\)'] ],
      displayMath: [ ['$$','$$'] ],
      processEscapes: true,
    }
  });</script><script src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"async></script></main></body></html>