Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## calhoun.seq
Class KmerHasher

    java.lang.Object
      calhoun.seq.KmerHasher

All Implemented Interfaces:
  java.io.Serializable

    public class KmerHasher

extends java.lang.Object
implements java.io.Serializable

Class for computing kmer hashes. You instantiate the class with the length of the kmer to hash and the alphabet to use. The hashing functions then compute hashes for individual kmers. This class does not stored any hashes, which are just ints.

See Also:
  Serialized Form

Nested Class Summary
`static interface` | `KmerHasher.CharacterHash`

Field Summary
`static KmerHasher.CharacterHash` | `ACGTN` Character hash function to use with DNA bases which included the ambiguity code "N".
`static KmerHasher.CharacterHash` | `ACGTNcomp` Character hash function to use with DNA bases which included the ambiguity code "N".
`static KmerHasher.CharacterHash` | `ACGTother` Character hash function to use with DNA bases which included the ambiguity code "N".
`static KmerHasher.CharacterHash` | `ACGTotherRC` Character hash function to use with DNA bases which included the ambiguity code "N".
`static KmerHasher.CharacterHash` | `DNA` Character hash function to use with DNA bases.
`static KmerHasher.CharacterHash` | `LETTERS` Character hash function to use with any letters.

Constructor Summary
`KmerHasher(KmerHasher.CharacterHash charHash, int length)` Creates a hash from a given character hash and length.

Method Summary
`int` | `hash(char c)`
`int` | `hash(char[] chr)` Computes a hash given a character array.
`int` | `hash(char[] chr, int start)` Computes a hash given a character array.
`int` | `hash(java.lang.String str, int pos)` Computes hash given a 0-based position on the string.
`boolean` | `hashable(char a)`
`int` | `range()`
`static java.lang.String` | `reverseComplement(java.lang.String forward)`
`int` | `reverseShiftHash(char chr, int hash)` Updates an existing hash.
`int` | `shiftHash(char chr, int hash)` Updates an existing hash.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DNA

    public static KmerHasher.CharacterHash DNA

  Character hash function to use with DNA bases. Upper and lower case get hashed to the same value. Handles only the 4 nucleotides (ACTG). No other characters allowed.

### ACGTN

    public static KmerHasher.CharacterHash ACGTN

  Character hash function to use with DNA bases which included the ambiguity code "N". Upper and lower case get hashed to the same value. Handles only the 4 nucleotides (ACTG). No other characters allowed.

### ACGTNcomp

    public static KmerHasher.CharacterHash ACGTNcomp

  Character hash function to use with DNA bases which included the ambiguity code "N". Upper and lower case get hashed to the same value. Handles only the 4 nucleotides (ACTG). No other characters allowed.

### ACGTother

    public static KmerHasher.CharacterHash ACGTother

  Character hash function to use with DNA bases which included the ambiguity code "N". Upper and lower case get hashed to the same value. Handles only the 4 nucleotides (ACTG). No other characters allowed.

### ACGTotherRC

    public static KmerHasher.CharacterHash ACGTotherRC

  Character hash function to use with DNA bases which included the ambiguity code "N". Upper and lower case get hashed to the same value. Handles only the 4 nucleotides (ACTG). No other characters allowed.

### LETTERS

    public static KmerHasher.CharacterHash LETTERS

  Character hash function to use with any letters. Upper and lower case get hashed to the same value.

Constructor Detail

### KmerHasher

    public KmerHasher(KmerHasher.CharacterHash charHash,
                      int length)

  Creates a hash from a given character hash and length.

Method Detail

### reverseComplement

    public static java.lang.String reverseComplement(java.lang.String forward)

### range

    public int range()

### hash

    public int hash(java.lang.String str,
                    int pos)

  Computes hash given a 0-based position on the string.

### hash

    public int hash(char[] chr)

  Computes a hash given a character array. The array must be the exact size of the hash

### hash

    public int hash(char[] chr,
                    int start)

  Computes a hash given a character array. Starts at the given index into the array

### shiftHash

    public int shiftHash(char chr,
                         int hash)

  Updates an existing hash. Drops the first character and adds in the new one to the end. hash("BCDE", 0) == shiftHash("E", hash("ABCD", 0))

### reverseShiftHash

    public int reverseShiftHash(char chr,
                                int hash)

  Updates an existing hash. Drops the first character and adds in the new one to the end. hash("ABCD", 0) == reverseShiftHash("A", hash("BCDE", 0))

### hash

    public int hash(char c)

### hashable

    public boolean hashable(char a)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD