diff options
Diffstat (limited to 'files')
| -rw-r--r-- | files/dna-sequence/algorithm-binary-to-dna.png | bin | 0 -> 109368 bytes | |||
| -rw-r--r-- | files/dna-sequence/algorithms.tex | 53 | ||||
| -rw-r--r-- | files/dna-sequence/dna-basics.jpg | bin | 0 -> 165883 bytes |
3 files changed, 53 insertions, 0 deletions
diff --git a/files/dna-sequence/algorithm-binary-to-dna.png b/files/dna-sequence/algorithm-binary-to-dna.png new file mode 100644 index 0000000..913f2be --- /dev/null +++ b/files/dna-sequence/algorithm-binary-to-dna.png | |||
| Binary files differ | |||
diff --git a/files/dna-sequence/algorithms.tex b/files/dna-sequence/algorithms.tex new file mode 100644 index 0000000..de26f13 --- /dev/null +++ b/files/dna-sequence/algorithms.tex | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | \documentclass{article} | ||
| 2 | \usepackage{algorithm}% http://ctan.org/pkg/algorithms | ||
| 3 | \usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx | ||
| 4 | \begin{document} | ||
| 5 | |||
| 6 | % https://tex.stackexchange.com/questions/229355/algorithm-algorithmic-algorithmicx-algorithm2e-algpseudocode-confused | ||
| 7 | % https://en.wikibooks.org/wiki/LaTeX/Algorithms | ||
| 8 | |||
| 9 | \begin{algorithm} | ||
| 10 | \caption{Naive byte array to DNA encode} | ||
| 11 | \begin{algorithmic}[1] | ||
| 12 | \Procedure{EncodeToDNASequence}{$name$} | ||
| 13 | \State $fp\gets open(name)$ | ||
| 14 | \State $en\gets null$ | ||
| 15 | \While{$fp\not=EOF$} | ||
| 16 | \State $c\gets buf[0]$\Comment{Read 1 byte from buffer} | ||
| 17 | \State $b\gets sprintf("08b", c)$\Comment{Convert to string binary} | ||
| 18 | \For{\texttt{e in range[0,2,4,6]}} | ||
| 19 | \If {$e[0] = 48$ $1$ and $e[1] = 48$}\Comment{0x00 - A (Adenine)} | ||
| 20 | \State $en\gets en + `A`$ | ||
| 21 | \EndIf | ||
| 22 | \If {$e[0] = 48$ $1$ and $e[1] = 49$}\Comment{0x01 - G (Guanine)} | ||
| 23 | \State $en\gets en + `G`$ | ||
| 24 | \EndIf | ||
| 25 | \If {$e[0] = 49$ $1$ and $e[1] = 48$}\Comment{0x10 - C (Cytosine)} | ||
| 26 | \State $en\gets en + `C`$ | ||
| 27 | \EndIf | ||
| 28 | \If {$e[0] = 49$ $1$ and $e[1] = 49$}\Comment{0x11 - T (Thymine)} | ||
| 29 | \State $en\gets en + `T`$ | ||
| 30 | \EndIf | ||
| 31 | \EndFor | ||
| 32 | \EndWhile | ||
| 33 | \State \textbf{return} $en$\Comment{Return string DNA sequence} | ||
| 34 | \EndProcedure | ||
| 35 | \end{algorithmic} | ||
| 36 | \end{algorithm} | ||
| 37 | |||
| 38 | %\begin{algorithm} | ||
| 39 | %\caption{Euclid’s algorithm}\label{euclid} | ||
| 40 | %\begin{algorithmic}[1] | ||
| 41 | %\Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b} | ||
| 42 | % \State $r\gets a\bmod b$ | ||
| 43 | % \While{$r\not=0$}\Comment{We have the answer if r is 0} | ||
| 44 | % \State $a\gets b$ | ||
| 45 | % \State $b\gets r$ | ||
| 46 | % \State $r\gets a\bmod b$ | ||
| 47 | % \EndWhile\label{euclidendwhile} | ||
| 48 | % \State \textbf{return} $b$\Comment{The gcd is b} | ||
| 49 | %\EndProcedure | ||
| 50 | %\end{algorithmic} | ||
| 51 | %\end{algorithm} | ||
| 52 | |||
| 53 | \end{document} | ||
diff --git a/files/dna-sequence/dna-basics.jpg b/files/dna-sequence/dna-basics.jpg new file mode 100644 index 0000000..c2e7f52 --- /dev/null +++ b/files/dna-sequence/dna-basics.jpg | |||
| Binary files differ | |||
