Class ArrayListSequenceReader<C extends Compound>
- java.lang.Object
-
- org.biojava.nbio.core.sequence.storage.ArrayListSequenceReader<C>
-
- Type Parameters:
C
-
- All Implemented Interfaces:
Iterable<C>
,Accessioned
,Sequence<C>
,SequenceReader<C>
- Direct Known Subclasses:
ArrayListProxySequenceReader
public class ArrayListSequenceReader<C extends Compound> extends Object implements SequenceReader<C>
Stores a Sequence as a collection of compounds in an ArrayList
-
-
Constructor Summary
Constructors Constructor Description ArrayListSequenceReader()
ArrayListSequenceReader(String sequence, CompoundSet<C> compoundSet)
ArrayListSequenceReader(List<C> compounds, CompoundSet<C> compoundSet)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
countCompounds(C... compounds)
Returns the number of times we found a compound in the Sequenceboolean
equals(Object o)
AccessionID
getAccession()
Returns the AccessionID this location is currently bound withList<C>
getAsList()
Returns the Sequence as a List of compoundsC
getCompoundAt(int position)
Returns the Compound at the given biological indexCompoundSet<C>
getCompoundSet()
Gets the compound set used to back this Sequenceint
getIndexOf(C compound)
Scans through the Sequence looking for the first occurrence of the given compoundSequenceView<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 compoundint
getLength()
Returns the length of the SequenceString
getSequenceAsString()
Returns the String representation of the SequenceString
getSequenceAsString(Integer begin, Integer end, Strand strand)
SequenceView<C>
getSubSequence(Integer bioBegin, Integer bioEnd)
Returns a portion of the sequence from the different positions.int
hashCode()
Iterator<C>
iterator()
void
setCompoundSet(CompoundSet<C> compoundSet)
void
setContents(String sequence)
void
setContents(List<C> list)
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
ArrayListSequenceReader
public ArrayListSequenceReader()
-
ArrayListSequenceReader
public ArrayListSequenceReader(List<C> compounds, CompoundSet<C> compoundSet)
- Parameters:
compounds
-compoundSet
-
-
ArrayListSequenceReader
public ArrayListSequenceReader(String sequence, CompoundSet<C> compoundSet) throws CompoundNotFoundException
- Parameters:
sequence
-compoundSet
-- Throws:
CompoundNotFoundException
-
-
Method Detail
-
getSequenceAsString
public String getSequenceAsString()
Description copied from interface:Sequence
Returns the String representation of the Sequence- Specified by:
getSequenceAsString
in interfaceSequence<C extends Compound>
- Returns:
-
getSequenceAsString
public String getSequenceAsString(Integer begin, Integer end, Strand strand)
- Parameters:
begin
-end
-strand
-- Returns:
-
getAsList
public List<C> getAsList()
Description copied from interface:Sequence
Returns the Sequence as a List of compounds
-
getCompoundAt
public C getCompoundAt(int position)
Description copied from interface:Sequence
Returns the Compound at the given biological index- Specified by:
getCompoundAt
in interfaceSequence<C extends Compound>
- Parameters:
position
-- Returns:
-
getIndexOf
public int getIndexOf(C compound)
Description copied from interface:Sequence
Scans through the Sequence looking for the first occurrence of the given compound- Specified by:
getIndexOf
in interfaceSequence<C extends Compound>
- Parameters:
compound
-- Returns:
-
getLastIndexOf
public int getLastIndexOf(C compound)
Description copied from interface:Sequence
Scans through the Sequence looking for the last occurrence of the given compound- Specified by:
getLastIndexOf
in interfaceSequence<C extends Compound>
- Parameters:
compound
-- Returns:
-
getLength
public int getLength()
Description copied from interface:Sequence
Returns the length of the Sequence
-
setCompoundSet
public void setCompoundSet(CompoundSet<C> compoundSet)
- Specified by:
setCompoundSet
in interfaceSequenceReader<C extends Compound>
- Parameters:
compoundSet
-
-
getCompoundSet
public CompoundSet<C> getCompoundSet()
Description copied from interface:Sequence
Gets the compound set used to back this Sequence- Specified by:
getCompoundSet
in interfaceSequence<C extends Compound>
- Returns:
-
setContents
public void setContents(String sequence) throws CompoundNotFoundException
- Specified by:
setContents
in interfaceSequenceReader<C extends Compound>
- Parameters:
sequence
-- Throws:
CompoundNotFoundException
-
setContents
public void setContents(List<C> list)
- Parameters:
list
-
-
getSubSequence
public SequenceView<C> getSubSequence(Integer bioBegin, Integer bioEnd)
Description copied from interface:Sequence
Returns a portion of the sequence from the different positions. This is indexed from 1- Specified by:
getSubSequence
in interfaceSequence<C extends Compound>
- Parameters:
bioBegin
-bioEnd
-- Returns:
-
getAccession
public AccessionID getAccession()
Description copied from interface:Accessioned
Returns the AccessionID this location is currently bound with- Specified by:
getAccession
in interfaceAccessioned
- Returns:
-
countCompounds
public int countCompounds(C... compounds)
Description copied from interface:Sequence
Returns the number of times we found a compound in the Sequence- Specified by:
countCompounds
in interfaceSequence<C extends Compound>
- Parameters:
compounds
-- Returns:
-
getInverse
public SequenceView<C> getInverse()
Description copied from interface:Sequence
Does the right thing to get the inverse of the current Sequence. This means either reversing the Sequence and optionally complementing the Sequence.- Specified by:
getInverse
in interfaceSequence<C extends Compound>
- Returns:
-
-