- Type Parameters:
S
- each element of the alignmentProfile
is of type SC
- each element of anAlignedSequence
is aCompound
of type C
- All Superinterfaces:
Iterable<AlignedSequence<S,
C>>
- All Known Subinterfaces:
MutableProfile<S,
,C> MutableProfilePair<S,
,C> MutableSequencePair<S,
,C> ProfilePair<S,
,C> ProfileView<S,
,C> SequencePair<S,
C>
- All Known Implementing Classes:
SimpleProfile
,SimpleProfilePair
,SimpleSequencePair
public interface Profile<S extends Sequence<C>,C extends Compound>
extends Iterable<AlignedSequence<S,C>>
Defines a data structure for the results of sequence alignment. Every
List
returned is unmodifiable unless
the class implements the subinterface MutableProfile
.- Author:
- Mark Chapman, Paolo Pavan
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAlignedSequence
(int listIndex) ReturnsAlignedSequence
at given index.getAlignedSequence
(S sequence) Searches for the givenSequence
within this alignment profile.Returns aList
containing the individualAlignedSequence
s of this alignment.getAlignedSequences
(int... listIndices) Returns aList
containing some of the individualAlignedSequence
s of this alignment.getAlignedSequences
(S... sequences) Returns aList
containing some of the individualAlignedSequence
s of this alignment.getCompoundAt
(int listIndex, int alignmentIndex) Returns theCompound
at row of given sequence and column of alignment index.getCompoundAt
(S sequence, int alignmentIndex) Returns theCompound
at row of given sequence and column of alignment index.int[]
getCompoundCountsAt
(int alignmentIndex) Returns the number of eachCompound
in the given column for all compounds inCompoundSet
.int[]
getCompoundCountsAt
(int alignmentIndex, List<C> compounds) Returns the number of eachCompound
in the given column only for compounds in the given list.getCompoundsAt
(int alignmentIndex) ReturnsCompoundSet
of allAlignedSequence
sfloat[]
getCompoundWeightsAt
(int alignmentIndex) Returns the fraction of eachCompound
in the given column for all compounds inCompoundSet
.float[]
getCompoundWeightsAt
(int alignmentIndex, List<C> compounds) Returns the fraction of eachCompound
in the given column only for compounds in the given list.int
getIndexOf
(C compound) Searches for the givenCompound
within this alignment profile.int[]
getIndicesAt
(int alignmentIndex) Returns the indices in the originalSequence
s corresponding to the given column.int
getLastIndexOf
(C compound) Searches for the givenCompound
within this alignment profile.int
Returns the number of columns in the alignment profile.int
getSize()
Returns the number of rows in this profile.getSubProfile
(Location location) Returns aProfileView
windowed to contain only the givenLocation
.boolean
hasGap
(int alignmentIndex) Returns true if anyAlignedSequence
has a gap at the given index.boolean
Returns true if anyAlignedSequence
is circular.toString()
Returns a simple view of the alignment profile.toString
(int width) Returns a formatted view of the alignment profile.toString
(Profile.StringFormat format) Returns a formatted view of the alignment profile.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
getAlignedSequence
ReturnsAlignedSequence
at given index.- Parameters:
listIndex
- index of sequence in profile- Returns:
- desired sequence
- Throws:
IndexOutOfBoundsException
- if listIndex < 1 or listIndex > number of sequences
-
getAlignedSequence
Searches for the givenSequence
within this alignment profile. Returns the correspondingAlignedSequence
.- Parameters:
sequence
- an originalSequence
- Returns:
- the corresponding
AlignedSequence
-
getAlignedSequences
List<AlignedSequence<S,C>> getAlignedSequences()Returns aList
containing the individualAlignedSequence
s of this alignment.- Returns:
- list of aligned sequences
-
getAlignedSequences
Returns aList
containing some of the individualAlignedSequence
s of this alignment.- Parameters:
listIndices
- indices of sequences in profile- Returns:
- list of aligned sequences
-
getAlignedSequences
Returns aList
containing some of the individualAlignedSequence
s of this alignment.- Parameters:
sequences
- originalSequence
s- Returns:
- list of aligned sequences
-
getCompoundAt
Returns theCompound
at row of given sequence and column of alignment index. If the given sequence has overlap, this will return theCompound
from the top row of the sequence.- Parameters:
listIndex
- index of sequence in profilealignmentIndex
- column index within an alignment- Returns:
- the sequence element
- Throws:
IndexOutOfBoundsException
- if listIndex < 1, listIndex > number of sequences, alignmentIndex < 1, or alignmentIndex >getLength()
-
getCompoundAt
Returns theCompound
at row of given sequence and column of alignment index. If the given sequence has overlap, this will return theCompound
from the top row of the sequence.- Parameters:
sequence
- either anAlignedSequence
or an originalSequence
alignmentIndex
- column index within an alignment- Returns:
- the sequence element
- Throws:
IndexOutOfBoundsException
- if alignmentIndex < 1 or alignmentIndex >getLength()
-
getCompoundCountsAt
int[] getCompoundCountsAt(int alignmentIndex) Returns the number of eachCompound
in the given column for all compounds inCompoundSet
.- Parameters:
alignmentIndex
- column index within an alignment- Returns:
- list of counts
- Throws:
IndexOutOfBoundsException
- if alignmentIndex < 1 or alignmentIndex >getLength()
-
getCompoundCountsAt
Returns the number of eachCompound
in the given column only for compounds in the given list.- Parameters:
alignmentIndex
- column index within an alignmentcompounds
- list of compounds to count- Returns:
- corresponding list of counts
- Throws:
IndexOutOfBoundsException
- if alignmentIndex < 1 or alignmentIndex >getLength()
-
getCompoundsAt
- Parameters:
alignmentIndex
- column index within an alignment- Returns:
- the sequence elements
- Throws:
IndexOutOfBoundsException
- if alignmentIndex < 1 or alignmentIndex >getLength()
-
getCompoundSet
CompoundSet<C> getCompoundSet()ReturnsCompoundSet
of allAlignedSequence
s- Returns:
- set of
Compound
s in contained sequences
-
getCompoundWeightsAt
float[] getCompoundWeightsAt(int alignmentIndex) Returns the fraction of eachCompound
in the given column for all compounds inCompoundSet
.- Parameters:
alignmentIndex
- column index within an alignment- Returns:
- list of fractional weights
- Throws:
IndexOutOfBoundsException
- if alignmentIndex < 1 or alignmentIndex >getLength()
-
getCompoundWeightsAt
Returns the fraction of eachCompound
in the given column only for compounds in the given list.- Parameters:
alignmentIndex
- column index within an alignmentcompounds
- list of compounds to count- Returns:
- corresponding list of fractional weights
- Throws:
IndexOutOfBoundsException
- if alignmentIndex < 1 or alignmentIndex >getLength()
-
getIndicesAt
int[] getIndicesAt(int alignmentIndex) Returns the indices in the originalSequence
s corresponding to the given column. All indices are 1-indexed and inclusive.- Parameters:
alignmentIndex
- column index within an alignment- Returns:
- the sequence indices
- Throws:
IndexOutOfBoundsException
- if alignmentIndex < 1 or alignmentIndex >getLength()
-
getIndexOf
Searches for the givenCompound
within this alignment profile. Returns column index nearest to the start of the alignment profile, or -1 if not found.- Parameters:
compound
- search element- Returns:
- index of column containing search element nearest to the start of the alignment profile
-
getLastIndexOf
Searches for the givenCompound
within this alignment profile. Returns column index nearest to the end of the alignment profile, or -1 if not found.- Parameters:
compound
- search element- Returns:
- index of column containing search element nearest to the end of the alignment profile
-
getLength
int getLength()Returns the number of columns in the alignment profile.- Returns:
- the number of columns
-
getOriginalSequences
- Returns:
- list of original sequences
-
getSize
int getSize()Returns the number of rows in this profile. If anyAlignedSequence
s are circular and overlap within the alignment, the returned size will be greater than the number of sequences, otherwise the numbers will be equal.- Returns:
- number of rows
-
getSubProfile
Returns aProfileView
windowed to contain only the givenLocation
. This only includes theAlignedSequence
s which overlap the location.- Parameters:
location
- portion of profile to view- Returns:
- a windowed view of the profile
- Throws:
IllegalArgumentException
- if location is invalid
-
hasGap
boolean hasGap(int alignmentIndex) Returns true if anyAlignedSequence
has a gap at the given index.- Parameters:
alignmentIndex
- column index within an alignment- Returns:
- true if any
AlignedSequence
has a gap at the given index - Throws:
IndexOutOfBoundsException
- if alignmentIndex < 1 or alignmentIndex >getLength()
-
isCircular
boolean isCircular()Returns true if anyAlignedSequence
is circular. If so, sequences may simply wrap around from the end to the start of the alignment or they may contribute multiple overlapping lines to the profile.- Returns:
- true if any
AlignedSequence
is circular
-
toString
String toString()Returns a simple view of the alignment profile. This shows each sequence on a separate line (or multiple lines, if circular) and nothing more. This should result ingetSize()
lines withgetLength()
Compound
s per line. -
toString
Returns a formatted view of the alignment profile. This shows the start and end indices of the profile and each sequence for each group of lines of the given width. Each line may also be labeled.- Parameters:
width
- limit on the line length- Returns:
- a formatted view of the alignment profile
-
toString
Returns a formatted view of the alignment profile. Details depend on the format given.- Parameters:
format
- output format- Returns:
- a formatted view of the alignment profile
-