|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava3.core.sequence.storage.JoiningSequenceReader<C>
C
- Tyoe of compound to holdpublic class JoiningSequenceReader<C extends Compound>
This reader actually proxies onto multiple types of sequence in order to allow a number of sequence objects to act as if they are one sequence. The code takes in any number of sequences, records the minimum and maximum bounds each sequence covers with respect to 1 position indexing and then binary searches these when a position is requested. Because of this 0 length Sequences are excluded during construction. Performance is not as good as if you are using a flat sequence however the speed of lookup is more than adaquate for most situations. Using the iterator gives the best performance as this does not rely on the binary search mechanism instead iterating through each sequence in turn.
Constructor Summary | |
---|---|
JoiningSequenceReader(CompoundSet<C> compoundSet,
List<Sequence<C>> sequences)
|
|
JoiningSequenceReader(CompoundSet<C> compoundSet,
Sequence<C>... sequences)
|
|
JoiningSequenceReader(List<Sequence<C>> sequences)
Allows creation of the store from List |
|
JoiningSequenceReader(Sequence<C>... sequences)
Allows creation of the store from Vargs Sequence |
Method Summary | |
---|---|
int |
countCompounds(C... compounds)
Returns the number of times we found a compound in the Sequence |
AccessionID |
getAccession()
Returns the AccessionID this location is currently bound with |
List<C> |
getAsList()
Returns the Sequence as a List of compounds |
C |
getCompoundAt(int position)
Returns the Compound at the given biological index |
CompoundSet<C> |
getCompoundSet()
Gets the compound set used to back this Sequence |
int |
getIndexOf(C compound)
Scans through the Sequence looking for the first occurrence of the given compound |
SequenceView<C> |
getInverse()
Does the right thing to get the inverse of the current Sequence. |
int |
getLastIndexOf(C compound)
Scans through the Sequence looking for the last occurrence of the given compound |
int |
getLength()
Returns the length of the Sequence |
String |
getSequenceAsString()
Returns the String representation of the Sequence |
SequenceView<C> |
getSubSequence(Integer start,
Integer end)
Returns a portion of the sequence from the different positions. |
Iterator<C> |
iterator()
Iterator implementation which attempts to move through the 2D structure attempting to skip onto the next sequence as & when it is asked to |
void |
setCompoundSet(CompoundSet<C> compoundSet)
|
void |
setContents(String sequence)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JoiningSequenceReader(Sequence<C>... sequences)
public JoiningSequenceReader(List<Sequence<C>> sequences)
public JoiningSequenceReader(CompoundSet<C> compoundSet, Sequence<C>... sequences)
public JoiningSequenceReader(CompoundSet<C> compoundSet, List<Sequence<C>> sequences)
Method Detail |
---|
public C getCompoundAt(int position)
Sequence
getCompoundAt
in interface Sequence<C extends Compound>
position
- Biological index (1 to n)
public CompoundSet<C> getCompoundSet()
Sequence
getCompoundSet
in interface Sequence<C extends Compound>
public int getLength()
Sequence
getLength
in interface Sequence<C extends Compound>
public Iterator<C> iterator()
iterator
in interface Iterable<C extends Compound>
public void setCompoundSet(CompoundSet<C> compoundSet)
setCompoundSet
in interface SequenceReader<C extends Compound>
public void setContents(String sequence)
setContents
in interface SequenceReader<C extends Compound>
public int countCompounds(C... compounds)
Sequence
countCompounds
in interface Sequence<C extends Compound>
compounds
- Vargs of the compounds to count
public AccessionID getAccession() throws UnsupportedOperationException
Accessioned
getAccession
in interface Accessioned
UnsupportedOperationException
public List<C> getAsList()
Sequence
getAsList
in interface Sequence<C extends Compound>
public int getIndexOf(C compound)
Sequence
getIndexOf
in interface Sequence<C extends Compound>
compound
- Compounds to look for
public int getLastIndexOf(C compound)
Sequence
getLastIndexOf
in interface Sequence<C extends Compound>
compound
- Compounds to look for
public String getSequenceAsString()
Sequence
getSequenceAsString
in interface Sequence<C extends Compound>
public SequenceView<C> getSubSequence(Integer start, 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 + 1
public SequenceView<C> getInverse()
Sequence
getInverse
in interface Sequence<C extends Compound>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |