Class Genome


  • public class Genome
    extends Object
    The Genome class provides static methods for compressing and expanding a genomic sequence using a 2-bit code.

    For additional documentation, see Section 5.5 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

    Author:
    Robert Sedgewick, Kevin Wayne
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void compress()
      Reads a sequence of 8-bit extended ASCII characters over the alphabet { A, C, T, G } from standard input; compresses them using two bits per character; and writes the results to standard output.
      static void expand()
      Reads a binary sequence from standard input; converts each two bits to an 8-bit extended ASCII character over the alphabet { A, C, T, G }; and writes the results to standard output.
      static void main​(String[] args)
      Sample client that calls compress() if the command-line argument is "-" an expand() if it is "+".
    • Method Detail

      • compress

        public static void compress()
        Reads a sequence of 8-bit extended ASCII characters over the alphabet { A, C, T, G } from standard input; compresses them using two bits per character; and writes the results to standard output.
      • expand

        public static void expand()
        Reads a binary sequence from standard input; converts each two bits to an 8-bit extended ASCII character over the alphabet { A, C, T, G }; and writes the results to standard output.
      • main

        public static void main​(String[] args)
        Sample client that calls compress() if the command-line argument is "-" an expand() if it is "+".
        Parameters:
        args - the command-line arguments