public class DNANoAmbPack extends Object implements Packing, Serializable
Packing
implementation which handles the DNA alphabet, without any
support for ambiguity symbols. In normal use, the only returns values between
0 and 3, and so requires only two bits of storage per symbol.Constructor and Description |
---|
DNANoAmbPack(byte placeHolder)
Construct a new packing which returns the specified byte value for unknown Symbols
(such as ambiguity symbols).
|
DNANoAmbPack(Symbol placeHolderSymbol)
Construct a new packing which translates unknown symbols into
the specified symbol.
|
Modifier and Type | Method and Description |
---|---|
FiniteAlphabet |
getAlphabet()
The FiniteAlphabet this packing is for.
|
boolean |
handlesAmbiguity()
Flag to state if ambiguities are stored.
|
byte |
pack(Symbol sym)
Return a byte representing the packing of a symbol.
|
Symbol |
unpack(byte b)
Return the symbol for a packing.
|
byte |
wordSize()
The number of bits required to pack a symbol.
|
public DNANoAmbPack(byte placeHolder)
public DNANoAmbPack(Symbol placeHolderSymbol)
public FiniteAlphabet getAlphabet()
Packing
getAlphabet
in interface Packing
public byte pack(Symbol sym)
Packing
Return a byte representing the packing of a symbol. The bits will be from 1 >> 0 through to 1 >> (wordSize - 1).
public Symbol unpack(byte b) throws IllegalSymbolException
Packing
Return the symbol for a packing.
unpack
in interface Packing
b
- the byte pattern for a SymbolIllegalSymbolException
- if the packing doesn't represent a valid
Symbolpublic byte wordSize()
Packing
The number of bits required to pack a symbol.
public boolean handlesAmbiguity()
Packing
Flag to state if ambiguities are stored.
Packings are free to either store ambiguity information or to discard it (presumably converting all ambiguities to a standard AtomicSymbol and then packing that). You can check wether ambiguities are handled by calling this method.
handlesAmbiguity
in interface Packing
Copyright © 2014 BioJava. All rights reserved.