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

    • Method Detail

      • getAlignedSequence

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

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

        java.util.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

        java.util.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:
        java.lang.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:
        java.lang.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:
        java.lang.IndexOutOfBoundsException - if alignmentIndex < 1 or alignmentIndex > getLength()
      • getCompoundCountsAt

        int[] getCompoundCountsAt​(int alignmentIndex,
                                  java.util.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:
        java.lang.IndexOutOfBoundsException - if alignmentIndex < 1 or alignmentIndex > getLength()
      • getCompoundsAt

        java.util.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:
        java.lang.IndexOutOfBoundsException - if alignmentIndex < 1 or alignmentIndex > getLength()
      • 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:
        java.lang.IndexOutOfBoundsException - if alignmentIndex < 1 or alignmentIndex > getLength()
      • getCompoundWeightsAt

        float[] getCompoundWeightsAt​(int alignmentIndex,
                                     java.util.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:
        java.lang.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:
        java.lang.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

        java.util.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:
        java.lang.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:
        java.lang.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

        java.lang.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 java.lang.Object
        Returns:
        a simple view of the alignment profile
      • toString

        java.lang.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

        java.lang.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