Class SequenceProxyView<C extends Compound>
- java.lang.Object
-
- org.biojava.nbio.core.sequence.template.SequenceProxyView<C>
-
- All Implemented Interfaces:
java.lang.Iterable<C>,Accessioned,Sequence<C>,SequenceView<C>
- Direct Known Subclasses:
ComplementSequenceView,ReversedSequenceView,RnaSequenceView
public class SequenceProxyView<C extends Compound> extends java.lang.Object implements SequenceView<C>
-
-
Constructor Summary
Constructors Constructor Description SequenceProxyView()SequenceProxyView(Sequence<C> sequence)SequenceProxyView(Sequence<C> sequence, java.lang.Integer bioStart, java.lang.Integer bioEnd)Main constructor for working with SequenceProxyViews
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcountCompounds(C... compounds)Returns the number of times we found a compound in the Sequencebooleanequals(java.lang.Object o)AccessionIDgetAccession()Returns the AccessionID this location is currently bound withjava.util.List<C>getAsList()Returns the Sequence as a List of compoundsjava.lang.IntegergetBioEnd()1-indexed, inclusive.java.lang.IntegergetBioStart()1-indexed, inclusive.CgetCompoundAt(int position)Returns the Compound at the given biological indexCompoundSet<C>getCompoundSet()Gets the compound set used to back this SequenceintgetIndexOf(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.intgetLastIndexOf(C compound)Scans through the Sequence looking for the last occurrence of the given compoundintgetLength()Returns the length of the Sequencejava.lang.StringgetSequenceAsString()Returns the String representation of the SequenceSequenceView<C>getSubSequence(java.lang.Integer bioStart, java.lang.Integer bioEnd)Returns a portion of the sequence from the different positions.Sequence<C>getViewedSequence()inthashCode()java.util.Iterator<C>iterator()voidsetBioEnd(java.lang.Integer bioEnd)voidsetBioStart(java.lang.Integer bioStart)
-
-
-
Constructor Detail
-
SequenceProxyView
public SequenceProxyView()
-
SequenceProxyView
public SequenceProxyView(Sequence<C> sequence, java.lang.Integer bioStart, java.lang.Integer bioEnd)
Main constructor for working with SequenceProxyViews- Parameters:
sequence- Sequence to proxybioStart- Start; cannot be less than 1bioEnd- End; cannot be greater than the sequence length
-
-
Method Detail
-
getViewedSequence
public Sequence<C> getViewedSequence()
- Specified by:
getViewedSequencein interfaceSequenceView<C extends Compound>
-
getSequenceAsString
public java.lang.String getSequenceAsString()
Description copied from interface:SequenceReturns the String representation of the Sequence- Specified by:
getSequenceAsStringin interfaceSequence<C extends Compound>
-
getAsList
public java.util.List<C> getAsList()
Description copied from interface:SequenceReturns the Sequence as a List of compounds
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getCompoundAt
public C getCompoundAt(int position)
Description copied from interface:SequenceReturns the Compound at the given biological index- Specified by:
getCompoundAtin interfaceSequence<C extends Compound>- Parameters:
position- Biological index (1 to n)- Returns:
- Compound at the specified position
-
getIndexOf
public int getIndexOf(C compound)
Description copied from interface:SequenceScans through the Sequence looking for the first occurrence of the given compound- Specified by:
getIndexOfin interfaceSequence<C extends Compound>- Parameters:
compound- Compounds to look for- Returns:
- Index of the first position of the compound in the sequence (1 to n)
-
getLastIndexOf
public int getLastIndexOf(C compound)
Description copied from interface:SequenceScans through the Sequence looking for the last occurrence of the given compound- Specified by:
getLastIndexOfin interfaceSequence<C extends Compound>- Parameters:
compound- Compounds to look for- Returns:
- Index of the last position of the compound in the sequence (1 to n)
-
getLength
public int getLength()
Description copied from interface:SequenceReturns the length of the Sequence
-
getCompoundSet
public CompoundSet<C> getCompoundSet()
Description copied from interface:SequenceGets the compound set used to back this Sequence- Specified by:
getCompoundSetin interfaceSequence<C extends Compound>
-
getSubSequence
public SequenceView<C> getSubSequence(java.lang.Integer bioStart, java.lang.Integer bioEnd)
Description copied from interface:SequenceReturns a portion of the sequence from the different positions. This is indexed from 1- Specified by:
getSubSequencein interfaceSequence<C extends Compound>- Parameters:
bioStart- Biological index start; must be greater than 0bioEnd- Biological end; must be less than length + 1- Returns:
- A SequenceView of the offset
-
iterator
public java.util.Iterator<C> iterator()
-
getAccession
public AccessionID getAccession()
Description copied from interface:AccessionedReturns the AccessionID this location is currently bound with- Specified by:
getAccessionin interfaceAccessioned
-
getBioStart
public java.lang.Integer getBioStart()
Description copied from interface:SequenceView1-indexed, inclusive.- Specified by:
getBioStartin interfaceSequenceView<C extends Compound>- Returns:
- the bioStart
-
setBioStart
public void setBioStart(java.lang.Integer bioStart)
- Parameters:
bioStart- the bioStart to set
-
getBioEnd
public java.lang.Integer getBioEnd()
Description copied from interface:SequenceView1-indexed, inclusive.- Specified by:
getBioEndin interfaceSequenceView<C extends Compound>- Returns:
- the bioEnd
-
setBioEnd
public void setBioEnd(java.lang.Integer bioEnd)
- Parameters:
bioEnd- the bioEnd to set
-
countCompounds
public int countCompounds(C... compounds)
Description copied from interface:SequenceReturns the number of times we found a compound in the Sequence- Specified by:
countCompoundsin interfaceSequence<C extends Compound>- Parameters:
compounds- Vargs of the compounds to count- Returns:
- Number of times a compound was found
-
getInverse
public SequenceView<C> getInverse()
Description copied from interface:SequenceDoes the right thing to get the inverse of the current Sequence. This means either reversing the Sequence and optionally complementing the Sequence.- Specified by:
getInversein interfaceSequence<C extends Compound>
-
-