- 
- 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 aSequencewithin an alignment.- Author:
 - Mark Chapman, Paolo Pavan
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classAlignedSequence.StepDefines an alignment step in order to pass alignment information from anAlignerto a constructor. 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclearCache()Nullifies cached arrays/objects.int[]getAlignmentFromSequence()Returns the alignment.intgetAlignmentIndexAt(int sequenceIndex)Returns the column index within an alignment corresponding to the given index in the originalSequence.doublegetCoverage()Returns the coverage, as a fraction between 0 and 1, of thisAlignedSequencewith respect to the original sequence.PointgetEnd()LocationgetLocationInAlignment()intgetNumGapPositions()Returns number of gap positions (gap openings and extensions) in the sequence.intgetNumGaps()Returns number of gaps (gap openings) in the sequence.SgetOriginalSequence()Returns the originalSequencebefore alignment.intgetOverlapCount()Returns the maximum number of elements contributed to a column of an alignment by thisSequence.int[]getSequenceFromAlignment()Returns the sequence positions at each alignment indexintgetSequenceIndexAt(int alignmentIndex)Returns the index in the originalSequencecorresponding to the given index within an alignment.PointgetStart()booleanisCircular()Returns true if thisSequencewraps around from the last alignment column back to the first.booleanisGap(int alignmentIndex)Returns true if thisSequencehas a gap at a particular alignment column.- 
Methods inherited from interface org.biojava.nbio.core.sequence.template.Accessioned
getAccession 
- 
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator 
- 
Methods inherited from interface org.biojava.nbio.core.sequence.template.Sequence
countCompounds, getAsList, getCompoundAt, getCompoundSet, getIndexOf, getInverse, getLastIndexOf, getLength, getSequenceAsString, getSubSequence 
 - 
 
 - 
 
- 
- 
Method Detail
- 
clearCache
void clearCache()
Nullifies cached arrays/objects. 
- 
getAlignmentFromSequence
int[] getAlignmentFromSequence()
Returns the alignment.- Returns:
 - the alignment
 
 
- 
getSequenceFromAlignment
int[] getSequenceFromAlignment()
Returns the sequence positions at each alignment index- Returns:
 - array of the sequence positions
 
 
- 
getAlignmentIndexAt
int getAlignmentIndexAt(int sequenceIndex)
Returns the column index within an alignment corresponding to the given index in the originalSequence. Both indices are 1-indexed and inclusive.- Parameters:
 sequenceIndex- index in the originalSequence- Returns:
 - column index within an alignment
 - Throws:
 IndexOutOfBoundsException- if sequenceIndex < 1 or sequenceIndex >getOriginalSequence().Sequence.getLength()
 
- 
getLocationInAlignment
Location getLocationInAlignment()
Returns theLocationof the originalSequencewithin 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 (gap openings) in the sequence. This could be determined from theLocationinformation or from gapCompounds, which may not necessarily result in the same number.- Returns:
 - number of gaps in the sequence
 
 
- 
getNumGapPositions
int getNumGapPositions()
Returns number of gap positions (gap openings and extensions) in the sequence. This could be determined from theLocationinformation or from gapCompounds, which may not necessarily result in the same number.- Returns:
 - number of gap positions in the sequence
 
 
- 
getCoverage
double getCoverage()
Returns the coverage, as a fraction between 0 and 1, of thisAlignedSequencewith respect to the original sequence. This is equivalent to (Sequence.getLength()-getNumGapPositions()) / getOriginalSequence().getLength().- Returns:
 - coverage of the original sequence by the aligned sequence
 
 
- 
getOriginalSequence
S getOriginalSequence()
Returns the originalSequencebefore alignment.- Returns:
 - the original sequence
 
 
- 
getOverlapCount
int getOverlapCount()
Returns the maximum number of elements contributed to a column of an alignment by thisSequence. If thisSequenceis 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 originalSequencecorresponding 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()
 
- 
isCircular
boolean isCircular()
Returns true if thisSequencewraps 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 thisSequencehas 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()
 
 - 
 
 -