aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.jekyll-metadatabin44635 -> 44635 bytes
-rw-r--r--_posts/2019-01-03-encoding-binary-data-into-dna-sequence.md19
2 files changed, 19 insertions, 0 deletions
diff --git a/.jekyll-metadata b/.jekyll-metadata
index 403977d..6eaaf4a 100644
--- a/.jekyll-metadata
+++ b/.jekyll-metadata
Binary files differ
diff --git a/_posts/2019-01-03-encoding-binary-data-into-dna-sequence.md b/_posts/2019-01-03-encoding-binary-data-into-dna-sequence.md
index b9a5754..0371359 100644
--- a/_posts/2019-01-03-encoding-binary-data-into-dna-sequence.md
+++ b/_posts/2019-01-03-encoding-binary-data-into-dna-sequence.md
@@ -196,6 +196,25 @@ FASTA format was extended by [FASTQ](https://en.wikipedia.org/wiki/FASTQ_format)
196| C (Cytosine) | (255,0,0) | Red | 196| C (Cytosine) | (255,0,0) | Red |
197| T (Thymine) | (255,255,0) | Yellow | 197| T (Thymine) | (255,255,0) | Yellow |
198 198
199With this in mind we can create a simple algorithm to create PNG representation of a DNA sequence.
200
201```pascal
202{ Algorithm 2: Naive DNA to PNG encode from FASTA file }
203procedure EncodeDNASequenceToPNG(f)
204begin
205 i image
206 while not eof(f) do
207 c char := buffer[0] { Read 1 char from buffer }
208 case c of
209 'A': color := RGB{0, 0, 255} { Blue }
210 'G': color := RGB{0, 100, 0} { Green }
211 'C': color := RGB{255, 0, 0} { Red }
212 'T': color := RGB{255, 255, 0} { Yellow }
213 drawRect(i, x, y, x_offset, y_offset, color)
214 save(i) { Save PNG image }
215end
216```
217
199## Encoding text file in practice 218## Encoding text file in practice
200 219
201In 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. 220In 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.