public final class SparseSequence extends SimpleDiscreteSequence
long,
which allows to save 32 symbols in one long. On the one hand an
instance of this class is more memory efficient than any other
SimpleDiscreteSequence, e.g. ByteSequence. But on the other hand
this class will be a little bit slower when accessing single positions.Sequence.CompositeSequence<T>, Sequence.RecursiveSequence<T>, Sequence.SubSequence<T>alphabetCon, annotation, rc| Constructor and Description |
|---|
SparseSequence(AlphabetContainer alphCon,
String seq)
Creates a new
SparseSequence from a String
representation. |
SparseSequence(AlphabetContainer alphCon,
SymbolExtractor se)
Creates a new
SparseSequence from a SymbolExtractor. |
| Modifier and Type | Method and Description |
|---|---|
SparseSequence |
complement(int start,
int end)
|
int |
discreteVal(int pos)
Returns the discrete value at position
pos of the
Sequence. |
protected SparseSequence |
flatCloneWithoutAnnotation()
Works in analogy to
Object.clone(), but does not clone the
annotation. |
static DataSet |
getDataSet(AlphabetContainer con,
AbstractStringExtractor... se)
This method allows to create a
DataSet containing SparseSequences. |
static DataSet |
getDataSet(AlphabetContainer con,
String filename)
This method allows to create a
DataSet containing SparseSequences using
a file name. |
static DataSet |
getDataSet(AlphabetContainer con,
String filename,
SequenceAnnotationParser parser)
This method allows to create a
DataSet containing SparseSequences using
a file name. |
int |
getLength()
Returns the length of the
Sequence. |
SparseSequence |
reverse(int start,
int end)
|
SparseSequence |
reverseComplement(int start,
int end)
|
addToRepresentation, compareTo, continuousVal, fillContainer, getEmptyContainer, getEmptyRepresentation, getStringRepresentation, hashCodeForPos, isMultiDimensional, shuffleannotate, compareTo, complement, create, create, create, equals, getAlphabetContainer, getAnnotation, getCompositeSequence, getCompositeSequence, getHammingDistance, getNumberOfSequenceAnnotationsByType, getSequenceAnnotationByType, getSequenceAnnotationByTypeAndIdentifier, getSubSequence, getSubSequence, getSubSequence, getSubSequence, hashCode, matches, reverse, reverseComplement, toDiscrete, toString, toString, toString, toStringpublic SparseSequence(AlphabetContainer alphCon, String seq) throws WrongSequenceTypeException, WrongAlphabetException
SparseSequence from a String
representation.alphCon - the AlphabetContainerseq - the sequence as StringWrongSequenceTypeException - if the AlphabetContainer is not simple or the
internal Alphabet has more than 4
symbolsWrongAlphabetException - if the AlphabetContainer is not discreteSparseSequence(AlphabetContainer, SymbolExtractor)public SparseSequence(AlphabetContainer alphCon, SymbolExtractor se) throws WrongSequenceTypeException, WrongAlphabetException
SparseSequence from a SymbolExtractor.alphCon - the AlphabetContainerse - the SymbolExtractorWrongSequenceTypeException - if the AlphabetContainer is not simple or the
internal Alphabet has more than 4
symbolsWrongAlphabetException - if the AlphabetContainer is not discreteSparseSequence(AlphabetContainer, int, SequenceAnnotation[])public int discreteVal(int pos)
Sequencepos of the
Sequence.discreteVal in class Sequence<int[]>pos - the position of the Sequencepos of the
Sequencepublic int getLength()
SequenceSequence.public SparseSequence complement(int start, int end) throws OperationNotSupportedException
SequenceSequence containing a part
of the complementary current Sequence.
AlphabetContainer on
DNAAlphabet returns "ATTAT".complement in class Sequence<int[]>start - the start position (inclusive) in the original
Sequenceend - the end position (exclusive) in the original SequenceSequence of the partOperationNotSupportedException - if the current Sequence is not based on a
ComplementableDiscreteAlphabetComplementableDiscreteAlphabetpublic SparseSequence reverse(int start, int end) throws OperationNotSupportedException
Sequencereverse in class Sequence<int[]>start - the start position (inclusive) in the original
Sequenceend - the end position (exclusive) in the original SequenceSequence of the partOperationNotSupportedException - if the current Sequence is based on an
AlphabetContainer that is not simplepublic SparseSequence reverseComplement(int start, int end) throws OperationNotSupportedException
SequenceSequence containing a
reverse part of the complementary current Sequence. For more
details see the methods Sequence.reverse() and Sequence.complement().reverseComplement in class Sequence<int[]>start - the start position (inclusive) in the original
Sequenceend - the end position (exclusive) in the original SequenceSequence of the partOperationNotSupportedException - if the current Sequence is not discrete and simple
((not based on a ComplementableDiscreteAlphabet)Sequence.reverse(),
Sequence.complement(),
ComplementableDiscreteAlphabetprotected SparseSequence flatCloneWithoutAnnotation()
SequenceObject.clone(), but does not clone the
annotation. This method is used in
Sequence.annotate(boolean, SequenceAnnotation...).flatCloneWithoutAnnotation in class Sequence<int[]>Sequence without annotationpublic static DataSet getDataSet(AlphabetContainer con, String filename, SequenceAnnotationParser parser) throws FileNotFoundException, WrongAlphabetException, WrongSequenceTypeException, EmptyDataSetException, IOException
DataSet containing SparseSequences using
a file name. Annotations are parsed by the supplied SequenceAnnotationParser. The file is
assumed to be in FastA format.con - the AlphabetContainer for the DataSet and SparseSequencesfilename - the file nameparser - a parser for the annotations of the SparseSequencesDataSet containing SparseSequencesFileNotFoundException - if the file filename could not be foundWrongAlphabetException - if the alphabet does not fit the dataWrongSequenceTypeException - if the data can not be represented as floatsEmptyDataSetException - if not sequences exist in filenameIOException - if the file could not be readpublic static DataSet getDataSet(AlphabetContainer con, String filename) throws FileNotFoundException, WrongAlphabetException, WrongSequenceTypeException, EmptyDataSetException, IOException
DataSet containing SparseSequences using
a file name.con - the AlphabetContainer for the DataSet and SparseSequencesfilename - the file nameDataSet containing SparseSequencesFileNotFoundException - if the file filename could not be foundWrongAlphabetException - if the alphabet does not fit the dataWrongSequenceTypeException - if the data can not be represented as floatsEmptyDataSetException - if not sequences exist in filenameIOException - if the file could not be readpublic static final DataSet getDataSet(AlphabetContainer con, AbstractStringExtractor... se) throws WrongSequenceTypeException, WrongAlphabetException, EmptyDataSetException
DataSet containing SparseSequences.con - the AlphabetContainer for the DataSet and Sequencesse - the AbstractStringExtractors that handle the DataSet as StringDataSet containing SparseSequencesWrongSequenceTypeException - if the AlphabetContainer is not simple or the
internal Alphabet has more than 4
symbolsWrongAlphabetException - if the AlphabetContainer is not discreteEmptyDataSetException - if a DataSet with 0 (zero) Sequence should be created