C
- Type of compound; must extend NucleotideCompound
java.lang.Iterable<C>
, Accessioned
, ProxySequenceReader<C>
, Sequence<C>
, SequenceReader<C>
FourBitSequenceReader
, TwoBitSequenceReader
public class BitSequenceReader<C extends Compound> extends java.lang.Object implements ProxySequenceReader<C>
BitSequenceReader.BitArrayWorker
instances. These are the objects that carry out array storage as well as
indexing into those arrays. New bit encodings can be written by extending
this class and a worker class. There are a number of issues with this
type of storage engine:
Compound
s; 2 bit allows no N compoundsBitSequenceReader.BitArrayWorker
instanceModifier and Type | Class | Description |
---|---|---|
static class |
BitSequenceReader.BitArrayWorker<C extends Compound> |
The logic of working with a bit has been separated out into this class
to help developers create the bit data structures without having to
put the code into an intermediate format and to also use the format
without the need to copy this code.
|
Constructor | Description |
---|---|
BitSequenceReader(BitSequenceReader.BitArrayWorker<C> worker,
AccessionID accession) |
Instance which allows you to supply a different @{BitArrayWorker}
object.
|
Modifier and Type | Method | Description |
---|---|---|
int |
countCompounds(C... compounds) |
Counts the number of times a compound appears in this sequence store
|
boolean |
equals(java.lang.Object o) |
|
AccessionID |
getAccession() |
Returns the AccessionID this location is currently bound with
|
java.util.List<C> |
getAsList() |
Returns this Sequence store as a List
|
C |
getCompoundAt(int position) |
Returns the compound at the specified biological index
|
CompoundSet<C> |
getCompoundSet() |
Returns the compound set backing this store
|
int |
getIndexOf(C compound) |
Returns the first occurrence of the given compound in this store; performs
a linear search
|
SequenceView<C> |
getInverse() |
Does the right thing to get the inverse of the current
Sequence.
|
int |
getLastIndexOf(C compound) |
Returns the last occurrence of the given compound in this store; performs
a linear search
|
int |
getLength() |
Returns the length of the sequence
|
java.lang.String |
getSequenceAsString() |
Returns the sequence as a String
|
SequenceView<C> |
getSubSequence(int start,
int end) |
Returns a sub sequence view
|
SequenceView<C> |
getSubSequence(java.lang.Integer start,
java.lang.Integer end) |
Returns a portion of the sequence from the different positions.
|
int |
hashCode() |
|
java.util.Iterator<C> |
iterator() |
Provides basic iterable access to this class
|
void |
setCompoundSet(CompoundSet<C> compoundSet) |
Class is immutable & so this is unsupported
|
void |
setContents(java.lang.String sequence) |
Class is immutable & so this is unsupported
|
public BitSequenceReader(BitSequenceReader.BitArrayWorker<C> worker, AccessionID accession)
public void setCompoundSet(CompoundSet<C> compoundSet)
setCompoundSet
in interface SequenceReader<C extends Compound>
public void setContents(java.lang.String sequence) throws CompoundNotFoundException
setContents
in interface SequenceReader<C extends Compound>
CompoundNotFoundException
public int countCompounds(C... compounds)
countCompounds
in interface Sequence<C extends Compound>
compounds
- Vargs of the compounds to countpublic AccessionID getAccession()
Accessioned
getAccession
in interface Accessioned
public java.util.List<C> getAsList()
public C getCompoundAt(int position)
getCompoundAt
in interface Sequence<C extends Compound>
position
- Biological index (1 to n)public CompoundSet<C> getCompoundSet()
getCompoundSet
in interface Sequence<C extends Compound>
public int getIndexOf(C compound)
getIndexOf
in interface Sequence<C extends Compound>
compound
- Compounds to look forpublic int getLastIndexOf(C compound)
getLastIndexOf
in interface Sequence<C extends Compound>
compound
- Compounds to look forpublic int getLength()
public java.lang.String getSequenceAsString()
getSequenceAsString
in interface Sequence<C extends Compound>
public SequenceView<C> getSubSequence(int start, int end)
public java.util.Iterator<C> iterator()
public SequenceView<C> getSubSequence(java.lang.Integer start, java.lang.Integer end)
Sequence
getSubSequence
in interface Sequence<C extends Compound>
start
- Biological index start; must be greater than 0end
- Biological end; must be less than length + 1public SequenceView<C> getInverse()
Sequence
getInverse
in interface Sequence<C extends Compound>
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object