Class EndGapsManager

    • Constructor Detail

      • EndGapsManager

        public EndGapsManager​(EndGapsManager endGapsManager,
                              SequenceCharSequence referenceSequence)
        Creates a new EndGapsManager identical to the provided one except for the addition of a reference sequence at index 0. If the provided EndGapsManager already has a reference sequence then the previous reference sequence is excluded from this new end gaps manager. An EndGapsManager created using this method is not serializable using toXmlExcludingSequences(String)
        Parameters:
        endGapsManager - an end gaps manager
        referenceSequence - the new reference sequence or null for no reference sequence
        Since:
        API 4.40 (Geneious 5.4.0)
      • EndGapsManager

        public EndGapsManager​(org.jdom.Element element,
                              SequenceListOnDisk<SequenceDocument> associatedSequences)
        Recreates an EndGapsManager from XML.
        Parameters:
        element - n element previously returned from toXmlExcludingSequences(String)
        associatedSequences - the sequence associated with the EndGapsManager
        Since:
        API 4.40 (Geneious 5.4.0)
      • EndGapsManager

        public EndGapsManager​(SequenceCharSequence[] sequences,
                              int minimumHashSize)
        Parameters:
        sequences - the sequences the consider end gaps on. This array is not copied and this class relies on the caller not changing the contents of this array after constructing this class.
        minimumHashSize - Suggested value of 256. This means that for every 256 residues we maintain an index of all possible sequences that could cover that range. Lower values make lookups faster, but lower values take longer to construct and uses more memory. The implementation of this class may use a higher hash size than the provided one and the size it selects will be returned from getHashSize()
      • EndGapsManager

        public EndGapsManager​(SequenceCharSequence[] sequences,
                              int minimumHashSize,
                              int numberOfSequences)
        Parameters:
        sequences - the sequences to consider end gaps on. This array is not copied and this class relies on the caller not changing the contents of this array after constructing this class.
        minimumHashSize - Suggested value of 256. This means that for every 256 residues we maintain an index of all possible sequences that could cover that range. Lower values make lookups faster, but lower values take longer to construct and uses more memory. The implementation of this class may use a higher hash size than the provided one and the size it selects will be returned from getHashSize()
        numberOfSequences - usually this is sequences.length, but sometimes the caller may want to use a subset of the sequences.
      • EndGapsManager

        public EndGapsManager​(java.util.List<SequenceCharSequence> sequences,
                              int minimumHashSize,
                              int numberOfSequences)
        Parameters:
        sequences - the sequences to consider end gaps on. This list is not copied and this class relies on the caller not changing the contents of this list after constructing this class.
        minimumHashSize - Suggested value of 256. This means that for every 256 residues we maintain an index of all possible sequences that could cover that range. Lower values make lookups faster, but lower values take longer to construct and uses more memory. The implementation of this class may use a higher hash size than the provided one and the size it selects will be returned from getHashSize()
        numberOfSequences - usually this is sequences.length, but sometimes the caller may want to use a subset of the sequences.
      • EndGapsManager

        public EndGapsManager​(SequenceAlignmentDocument alignment,
                              int minimumHashSize)
        Creates an EndGapsManager for the sequences in the given alignment.
        Parameters:
        alignment - the alignment containing the sequences to create the EndGapsManager on.
        minimumHashSize - Suggested value of 256. This means that for every 256 residues we maintain an index of all possible sequences that could cover that range. Lower values make lookups faster, but lower values take longer to construct and uses more memory. The implementation of this class may use a higher hash size than the provided one and the size it selects will be returned from getHashSize()
        Since:
        API 4.11 (Geneious 5.0)
    • Method Detail

      • getSequencesCoveringArray

        public int[] getSequencesCoveringArray​(int residueIndex)
        Parameters:
        residueIndex - the 0-based index to get sequences indices for
        Returns:
        all sequences which contain the given index, excluding those sequences for which residueIndex is an end gap.
      • getPotentialSequencesCoveringArray

        public int[] getPotentialSequencesCoveringArray​(int residueIndex)
        Returns all sequences which contain the given index, excluding those sequences for which residueIndex is an end gap, however, the returned list may also include sequences that do not cover the given residueIndex. Most usages should use getSequencesCoveringArray(int) instead unless they are very concerned about performance and don't want to allocate the extra array required to return the results.
        Parameters:
        residueIndex - the 0-based index to get sequences indices for
        Returns:
        all sequences which contain the given index, excluding those sequences for which residueIndex is an end gap. However, the returned list may also include sequences that do not cover the given residueIndex.
      • getPotentialSequencesCoveringArray

        public int[] getPotentialSequencesCoveringArray​(int residueIndex,
                                                        int circularAlignmentLength)
        Returns all sequences which contain the given index, excluding those sequences for which residueIndex is an end gap, however, the returned list may also include sequences that do not cover the given residueIndex. Most usages should use getSequencesCoveringArray(int) instead unless they are very concerned about performance and don't want to allocate the extra array required to return the results.
        Parameters:
        residueIndex - the 0-based index to get sequences indices for
        circularAlignmentLength - the circular length of the alignment if it is circular, or 0 if it is not circular (as defined by SequenceAlignmentDocument.getCircularLength()
        Returns:
        all sequences which contain the given index, excluding those sequences for which residueIndex is an end gap. However, the returned list may also include sequences that do not cover the given residueIndex.
        Since:
        API 4.600 (Geneious 6.0.0)
      • getSamePotentialSequencesLowerBound

        public int getSamePotentialSequencesLowerBound​(int residueIndex)
        Gets a lower bound such that all calls to getPotentialSequencesCoveringArray(int) with an index between LowerBound and residueIndex inclusive would return the same array.
        Parameters:
        residueIndex - the residue index to get a lower bound for.
        Returns:
        an index<=residueIndex which indicates a lower bound 'LowerBound' for which all calls to getPotentialSequencesCoveringArray(int) with an index between LowerBound and residueIndex inclusive would return the same array.
        See Also:
        (int), getPotentialSequencesCoveringArray(int)
      • getHashSize

        public int getHashSize()
        Gets the hash size used for this manager.
        Returns:
        the hash size used for this end gaps manager. This will be greater than or equal to the hashSize passed to the constructor.
      • getSequencesCoveringIterable

        public java.lang.Iterable<java.lang.Integer> getSequencesCoveringIterable​(int residueIndex)
        Parameters:
        residueIndex - the 0-based index to get sequences indices for
        Returns:
        all sequences which contain the given index, excluding those sequences for which residueIndex is an end gap.
      • getSequencesCoveringIterator

        public java.util.Iterator<java.lang.Integer> getSequencesCoveringIterator​(int residueIndex)
        Parameters:
        residueIndex - the 0-based index to get sequences indices for
        Returns:
        all sequences which contain the given index, excluding those sequences for which residueIndex is an end gap.
      • getSequenceCount

        public int getSequenceCount()
        Returns:
        the number of sequences for which end gaps are being managed on.
      • getNumberOfColumns

        public int getNumberOfColumns()
        Returns:
        the number of columns in the alignment (i.e. the CharSequence.length() of all sequences)
        Since:
        API 4.610 (Geneious 6.1.0)
      • getSequence

        public SequenceCharSequence getSequence​(int index)
        Parameters:
        index - the index of the sequence to get in the range [0, getSequenceCount())
        Returns:
        the sequence at this index.
      • getSequences

        public java.util.List<SequenceCharSequence> getSequences()
        Returns:
        all sequences (plus potentially some more if getSequenceCount() < than the returned list length) managed by this end gaps manager. The returned value is the stored internal list so any usage of this method must not modify the contents of this list.
        Since:
        API 4.11 (Geneious 5.0)