public class RandomAccessIndexTranslator<T> extends AbstractIndexTranslator<T,RandomAccessIndexTranslator.IndexTranslations>
AlignmentModel
.
A set of tokens to be considered as gaps can be defined using the gapTokens
constructor parameter.
In contrast to SequentialAccessIndexTranslator
this class stores the mapping for all positions of all sequences to
allow fast random access, while SequentialAccessIndexTranslator
calculates the mapping in each call with a runtime
proportional to the distance between the indices used in two subsequent calls. Therefore this implementation is faster for
random access but uses more memory.
Modifier and Type | Class and Description |
---|---|
protected static class |
RandomAccessIndexTranslator.IndexTranslations |
Constructor and Description |
---|
RandomAccessIndexTranslator(AlignmentModel<T> model)
Creates a new instance of this class using a
HashSet containing the gap token specified by the
token set of model . |
RandomAccessIndexTranslator(AlignmentModel<T> model,
java.util.Set<T> gapTokens) |
Modifier and Type | Method and Description |
---|---|
protected RandomAccessIndexTranslator.IndexTranslations |
createSequenceData(java.lang.String sequenceID) |
int |
getAlignedIndex(java.lang.String sequenceID,
int unalignedIndex) |
IndexRelation |
getUnalignedIndex(java.lang.String sequenceID,
int alignedIndex) |
finalize, getGapTokens, getModel, getSequenceData
public RandomAccessIndexTranslator(AlignmentModel<T> model, java.util.Set<T> gapTokens)
public RandomAccessIndexTranslator(AlignmentModel<T> model)
HashSet
containing the gap token specified by the
token set of model
. Additional gap tokens can be added using AbstractIndexTranslator.getGapTokens()
later on.model
- the alignment model to calculate ungapped indices inprotected RandomAccessIndexTranslator.IndexTranslations createSequenceData(java.lang.String sequenceID)
createSequenceData
in class AbstractIndexTranslator<T,RandomAccessIndexTranslator.IndexTranslations>
public IndexRelation getUnalignedIndex(java.lang.String sequenceID, int alignedIndex)
getUnalignedIndex
in class AbstractIndexTranslator<T,RandomAccessIndexTranslator.IndexTranslations>
public int getAlignedIndex(java.lang.String sequenceID, int unalignedIndex)
getAlignedIndex
in class AbstractIndexTranslator<T,RandomAccessIndexTranslator.IndexTranslations>