k4_algorithms.tex 5.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. %SUMMARY
  2. %- ABSTRACT
  3. %- INTRODUCTION
  4. %# BASICS
  5. %- \acs{DNA} STRUCTURE
  6. %- DATA TYPES
  7. % - BAM/FASTQ
  8. % - NON STANDARD
  9. %- COMPRESSION APPROACHES
  10. % - SAVING DIFFERENCES WITH GIVEN BASE \acs{DNA}
  11. % - HUFFMAN ENCODING
  12. % - PROBABILITY APPROACHES (WITH BASE?)
  13. %
  14. %# COMPARING TOOLS
  15. %-
  16. %# POSSIBLE IMPROVEMENT
  17. %- \acs{DNA}S STOCHASTICAL ATTRIBUTES
  18. %- IMPACT ON COMPRESSION
  19. \chapter{Compression aproaches}
  20. % begin with entropy encoding/shannons source coding theorem
  21. The process of compressing data serves the goal to generate an output that is smaller than its input data. In many cases, like in gene compressing, the compression is idealy lossless. This means it is possible for every compressed data, to receive the full information that were available in the origin data, by decompressing it. Lossy compression on the other hand, might excludes parts of data in the compression process, in order to increase the compression rate. The excluded parts are typicaly not necessary to transmit the origin information. This works with certain audio and pictures files or network protocols that are used to transmit video/audio streams live.
  22. For \acs{DNA} a lossless compression is needed. To be preceice a lossy compression is not possible, because there is no unnecessary data. Every nucleotide and its position is needed for the sequenced \acs{DNA} to be complete.
  23. \section{Huffman encoding}
  24. % list of algos and the tools that use them
  25. The well known Huffman coding, is used in several Tools for genome compression. This subsection should give the reader a general impression how this algorithm works, without going into detail. To use Huffman coding one must first define an alphabet, in our case a four letter alphabet, containing \texttt{A, C, G and T} is sufficient. The basic structure is symbolized as a tree. With that, a few simple rules apply to the structure:
  26. % binary view for alphabet
  27. % length n of sequence to compromize
  28. % greedy algo
  29. \begin{itemize}
  30. \item every symbol of the alphabet is one leaf
  31. \item the right branch from every not is marked as a 1, the left one is marked as a 0
  32. \item every symbol got a weight, the weight is defined by the frequency the symbol occours in the input text
  33. \item the less weight a node has, the higher the probability is, that this node is read next in the symbol sequence
  34. \end{itemize}
  35. The process of compressing starts with the nodes with the lowest weight and buids up to the hightest. Each step adds nodes to a tree where the most left branch should be the shortest and the most right the longest. The most left branch ends with the symbol with the highest weight, therefore occours the most in the input data.
  36. Following one path results in the binary representation for one symbol. For an alphabet like the one described above, the binary representation encoded in ASCI is shown here \texttt{A -> 01000001, C -> 01000011, G -> 01010100, T -> 00001010}. An imaginary sequence, that has this distribution of characters \texttt{A -> 10, C -> 8, G -> 4, T -> 2}. From this information a weighting would be calculated for each character by dividing one by the characters occurence. With a corresponding tree, created from with the weights, the binary data for each symbol would change to this \texttt{A -> 0, C -> 11, T -> 100, G -> 101}. Besides the compressed data, the information contained in the tree msut be saved for the decompression process.
  37. % (genomic squeeze <- official | inofficial -> GDC, GRS). Further \ac{ANS} or rANS ... TBD.
  38. \section{Arithmetic coding}
  39. Arithmetic coding is an approach to solve the problem of waste of memory, due to the overhead which is created by encoding certain lenghts of alphabets in binary. Encoding a three-letter alphabet requires at least two bit per letter. Since there are four possilbe combinations with two bits, one combination is not used, so the full potential is not exhausted. Looking at it from another perspective, less storage would be required, if there would be a possibility to encode two letters in the alphabet with one bit and the other one with a two byte combination. This approache is not possible because the letters would not be clearly distinguishable. The two bit letter could be interpreted either as the letter it should represent or as two one bit letters.
  40. % check this wording 'simulating' with sources
  41. % this is called subdividing
  42. Arithmetic coding works by simulating a n-letter binary encoding for a n-letter alphabet. This is possible by projecting the input text on a floatingpoint number. Every character in the alphabet is represented by an intervall between two floating point number in the space between 0.0 and 1.0 (exclusively), which is determined by its distribution in the input text (intervall start) and the the start of the next character (intervall end). To encode a sequence of characters, the intervall start of the character is noted, its intervall is split into smaller intervalls with the ratios of the initial intervalls between 0.0 and 1.0. With this, the second character is choosen. This process is repeated for until a intervall for the last character is choosen.\\
  43. To encode in binary, the binary floating point representation of a number inside the intervall, for the last character is calculated, by using a similar process, described above, called subdividing.
  44. % its finite subdividing because processors bottleneck floatingpoints
  45. \section{Probability aproaches}