Interface Profile<S extends Sequence<C>,C extends Compound>

Type Parameters:
S - each element of the alignment Profile is of type S
C - each element of an AlignedSequence is a Compound 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
  • Method Details

    • getAlignedSequence

      AlignedSequence<S,C> getAlignedSequence(int listIndex)
      Returns AlignedSequence at given index.
      Parameters:
      listIndex - index of sequence in profile
      Returns:
      desired sequence
      Throws:
      IndexOutOfBoundsException - if listIndex < 1 or listIndex > number of sequences
    • getAlignedSequence

      AlignedSequence<S,C> getAlignedSequence(S sequence)
      Searches for the given Sequence within this alignment profile. Returns the corresponding AlignedSequence.
      Parameters:
      sequence - an original Sequence
      Returns:
      the corresponding AlignedSequence
    • getAlignedSequences

      List<AlignedSequence<S,C>> getAlignedSequences()
      Returns a List containing the individual AlignedSequences of this alignment.
      Returns:
      list of aligned sequences
    • getAlignedSequences

      List<AlignedSequence<S,C>> getAlignedSequences(int... listIndices)
      Returns a List containing some of the individual AlignedSequences of this alignment.
      Parameters:
      listIndices - indices of sequences in profile
      Returns:
      list of aligned sequences
    • getAlignedSequences

      List<AlignedSequence<S,C>> getAlignedSequences(S... sequences)
      Returns a List containing some of the individual AlignedSequences of this alignment.
      Parameters:
      sequences - original Sequences
      Returns:
      list of aligned sequences
    • getCompoundAt

      C getCompoundAt(int listIndex, int alignmentIndex)
      Returns the Compound at row of given sequence and column of alignment index. If the given sequence has overlap, this will return the Compound from the top row of the sequence.
      Parameters:
      listIndex - index of sequence in profile
      alignmentIndex - column index within an alignment
      Returns:
      the sequence element
      Throws:
      IndexOutOfBoundsException - if listIndex < 1, listIndex > number of sequences, alignmentIndex < 1, or alignmentIndex > getLength()
    • getCompoundAt

      C getCompoundAt(S sequence, int alignmentIndex)
      Returns the Compound at row of given sequence and column of alignment index. If the given sequence has overlap, this will return the Compound from the top row of the sequence.
      Parameters:
      sequence - either an AlignedSequence or an original Sequence
      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 each Compound in the given column for all compounds in CompoundSet.
      Parameters:
      alignmentIndex - column index within an alignment
      Returns:
      list of counts
      Throws:
      IndexOutOfBoundsException - if alignmentIndex < 1 or alignmentIndex > getLength()
    • getCompoundCountsAt

      int[] getCompoundCountsAt(int alignmentIndex, List<C> compounds)
      Returns the number of each Compound in the given column only for compounds in the given list.
      Parameters:
      alignmentIndex - column index within an alignment
      compounds - list of compounds to count
      Returns:
      corresponding list of counts
      Throws:
      IndexOutOfBoundsException - if alignmentIndex < 1 or alignmentIndex > getLength()
    • getCompoundsAt

      List<C> getCompoundsAt(int alignmentIndex)
      Returns the Compound elements of the original Sequences at the given column.
      Parameters:
      alignmentIndex - column index within an alignment
      Returns:
      the sequence elements
      Throws:
      IndexOutOfBoundsException - if alignmentIndex < 1 or alignmentIndex > getLength()
    • getCompoundSet

      CompoundSet<C> getCompoundSet()
      Returns:
      set of Compounds in contained sequences
    • getCompoundWeightsAt

      float[] getCompoundWeightsAt(int alignmentIndex)
      Returns the fraction of each Compound in the given column for all compounds in CompoundSet.
      Parameters:
      alignmentIndex - column index within an alignment
      Returns:
      list of fractional weights
      Throws:
      IndexOutOfBoundsException - if alignmentIndex < 1 or alignmentIndex > getLength()
    • getCompoundWeightsAt

      float[] getCompoundWeightsAt(int alignmentIndex, List<C> compounds)
      Returns the fraction of each Compound in the given column only for compounds in the given list.
      Parameters:
      alignmentIndex - column index within an alignment
      compounds - 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 original Sequences 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

      int getIndexOf(C compound)
      Searches for the given Compound 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

      int getLastIndexOf(C compound)
      Searches for the given Compound 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

      List<S> getOriginalSequences()
      Returns a List containing the original Sequences used for alignment.
      Returns:
      list of original sequences
    • getSize

      int getSize()
      Returns the number of rows in this profile. If any AlignedSequences 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

      ProfileView<S,C> getSubProfile(Location location)
      Returns a ProfileView windowed to contain only the given Location. This only includes the AlignedSequences 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 any AlignedSequence 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 any AlignedSequence 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 in getSize() lines with getLength() Compounds per line.
      Overrides:
      toString in class Object
      Returns:
      a simple view of the alignment profile
    • toString

      String toString(int width)
      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

      String toString(Profile.StringFormat format)
      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