org.biojava3.alignment.template
Interface AlignedSequence<S extends Sequence<C>,C extends Compound>

Type Parameters:
C - each element of the Sequence is a Compound of type C
All Superinterfaces:
Accessioned, Iterable<C>, Sequence<C>
All Known Subinterfaces:
MutableAlignedSequence<S,C>
All Known Implementing Classes:
SimpleAlignedSequence

public interface AlignedSequence<S extends Sequence<C>,C extends Compound>
extends Sequence<C>

Defines a data structure for a Sequence within an alignment.

Author:
Mark Chapman

Nested Class Summary
static class AlignedSequence.Step
          Defines an alignment step in order to pass alignment information from an Aligner to a constructor.
 
Method Summary
 void clearCache()
          Nullifies cached arrays/objects.
 int getAlignmentIndexAt(int sequenceIndex)
          Returns the column index within an alignment corresponding to the given index in the original Sequence.
 Point getEnd()
          Returns the Point within an alignment of the last element of the original Sequence.
 Location getLocationInAlignment()
          Returns the Location of the original Sequence within an alignment.
 int getNumGaps()
          Returns number of gaps in the sequence.
 S getOriginalSequence()
          Returns the original Sequence before alignment.
 int getOverlapCount()
          Returns the maximum number of elements contributed to a column of an alignment by this Sequence.
 int getSequenceIndexAt(int alignmentIndex)
          Returns the index in the original Sequence corresponding to the given index within an alignment.
 Point getStart()
          Returns the Point within an alignment of the first element of the original Sequence.
 boolean isCircular()
          Returns true if this Sequence wraps around from the last alignment column back to the first.
 boolean isGap(int alignmentIndex)
          Returns true if this Sequence has a gap at a particular alignment column.
 
Methods inherited from interface org.biojava3.core.sequence.template.Sequence
countCompounds, getAsList, getCompoundAt, getCompoundSet, getIndexOf, getInverse, getLastIndexOf, getLength, getSequenceAsString, getSubSequence
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface org.biojava3.core.sequence.template.Accessioned
getAccession
 

Method Detail

clearCache

void clearCache()
Nullifies cached arrays/objects.


getAlignmentIndexAt

int getAlignmentIndexAt(int sequenceIndex)
Returns the column index within an alignment corresponding to the given index in the original Sequence. Both indices are 1-indexed and inclusive.

Parameters:
sequenceIndex - index in the original Sequence
Returns:
column index within an alignment
Throws:
IndexOutOfBoundsException - if sequenceIndex < 1 or sequenceIndex > getOriginalSequence().Sequence.getLength()

getEnd

Point getEnd()
Returns the Point within an alignment of the last element of the original Sequence.

Returns:
position within an alignment of final original Sequence element

getLocationInAlignment

Location getLocationInAlignment()
Returns the Location of the original Sequence within an alignment. This provides access to additional substructure beyond start and end points.

Returns:
location within an alignment

getNumGaps

int getNumGaps()
Returns number of gaps in the sequence. This could be determined from the Location information or from gap Compounds, which may not necessarily result in the same number.

Returns:
number of gaps in the sequence

getOriginalSequence

S getOriginalSequence()
Returns the original Sequence before alignment.

Returns:
the original sequence

getOverlapCount

int getOverlapCount()
Returns the maximum number of elements contributed to a column of an alignment by this Sequence. If this Sequence is circular, this number is >= 1. If not, this overlap count is definitely 1.

Returns:
the most elements contributed to any alignment column

getSequenceIndexAt

int getSequenceIndexAt(int alignmentIndex)
Returns the index in the original Sequence corresponding to the given index within an alignment. Both indices are 1-indexed and inclusive.

Parameters:
alignmentIndex - column index within an alignment
Returns:
index in the original Sequence
Throws:
IndexOutOfBoundsException - if alignmentIndex < 1 or alignmentIndex > Sequence.getLength()

getStart

Point getStart()
Returns the Point within an alignment of the first element of the original Sequence.

Returns:
position within an alignment of first original Sequence element

isCircular

boolean isCircular()
Returns true if this Sequence wraps around from the last alignment column back to the first. This makes overlap possible, but does not require an overlap count > 1.

Returns:
true for circular alignment elements

isGap

boolean isGap(int alignmentIndex)
Returns true if this Sequence has a gap at a particular alignment column.

Parameters:
alignmentIndex - column index within an alignment
Returns:
true if this column has a gap
Throws:
IndexOutOfBoundsException - if alignmentIndex < 1 or alignmentIndex > Sequence.getLength()