org.biojava.bio.alignment
Class AbstractULAlignment.SubULAlignment

java.lang.Object
  extended by org.biojava.utils.AbstractChangeable
      extended by org.biojava.bio.symbol.AbstractSymbolList
          extended by org.biojava.bio.alignment.AbstractULAlignment.SubULAlignment
All Implemented Interfaces:
UnequalLengthAlignment, Alignment, SymbolList, Changeable
Enclosing class:
AbstractULAlignment

public class AbstractULAlignment.SubULAlignment
extends AbstractSymbolList
implements UnequalLengthAlignment


Nested Class Summary
 
Nested classes/interfaces inherited from class org.biojava.bio.symbol.AbstractSymbolList
AbstractSymbolList.EditScreener, AbstractSymbolList.EditTranslater
 
Nested classes/interfaces inherited from interface org.biojava.bio.symbol.Alignment
Alignment.SymbolListIterator
 
Field Summary
 
Fields inherited from interface org.biojava.bio.symbol.Alignment
CONTENT
 
Fields inherited from interface org.biojava.bio.symbol.SymbolList
EDIT, EMPTY_LIST
 
Constructor Summary
protected AbstractULAlignment.SubULAlignment(java.util.Set labels, Location loc)
           
 
Method Summary
 Alphabet getAlphabet()
          The alphabet that this SymbolList is over.
 java.util.List getLabels()
           The list of SymbolLists in the alignment.
 java.util.List labelsAt(int column)
          Returns a list labels, of all seqs that cover that column
 java.util.List labelsInRange(Location loc)
          Returns list of all the labels that intersect that range
 int length()
          The number of symbols in this SymbolList.
protected  java.util.List listIntersection(java.util.List s1, java.util.List s2)
           
 Location locInAlignment(java.lang.Object label)
          The location of an individual SymbolList relative to overall Alignment
 Alignment subAlignment(java.util.Set labels, Location loc)
           Make a view onto this alignment.
 Symbol symbolAt(int column)
          Return the symbol at index, counting from 1.
 Symbol symbolAt(java.lang.Object label, int column)
          Retrieve a symbol by label and column.
 SymbolList symbolListForLabel(java.lang.Object label)
          Retrieve a single row of the alignment by label.
 java.util.Iterator symbolListIterator()
          Creates an Iterator over the SymbolLists in the alignment.
 
Methods inherited from class org.biojava.bio.symbol.AbstractSymbolList
edit, equals, hashCode, iterator, seqString, subList, subStr, toList, toString
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.biojava.bio.symbol.SymbolList
edit, iterator, seqString, subList, subStr, toList
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Constructor Detail

AbstractULAlignment.SubULAlignment

protected AbstractULAlignment.SubULAlignment(java.util.Set labels,
                                             Location loc)
                                      throws java.lang.IndexOutOfBoundsException
Throws:
java.lang.IndexOutOfBoundsException
Method Detail

length

public int length()
Description copied from interface: SymbolList
The number of symbols in this SymbolList.

Specified by:
length in interface SymbolList
Returns:
the length

locInAlignment

public Location locInAlignment(java.lang.Object label)
The location of an individual SymbolList relative to overall Alignment

Specified by:
locInAlignment in interface UnequalLengthAlignment

subAlignment

public Alignment subAlignment(java.util.Set labels,
                              Location loc)
                       throws java.util.NoSuchElementException
Description copied from interface: Alignment

Make a view onto this alignment.

If labels is null, then each label will be kept. Otherwise, only those in labels will be kept. If loc is null, then the entire length of the alignment will be kept. If loc is not null, then only the columns within the location will be kept.

Specified by:
subAlignment in interface Alignment
Parameters:
labels - the Set of sequences to include by label
loc - the Location to include
Returns:
a sub Alignment
Throws:
java.util.NoSuchElementException - if labels contains any item that is not a label

listIntersection

protected java.util.List listIntersection(java.util.List s1,
                                          java.util.List s2)

labelsAt

public java.util.List labelsAt(int column)
                        throws java.lang.IndexOutOfBoundsException
Description copied from interface: UnequalLengthAlignment
Returns a list labels, of all seqs that cover that column

Specified by:
labelsAt in interface UnequalLengthAlignment
Throws:
java.lang.IndexOutOfBoundsException

labelsInRange

public java.util.List labelsInRange(Location loc)
                             throws java.lang.IndexOutOfBoundsException
Description copied from interface: UnequalLengthAlignment
Returns list of all the labels that intersect that range

Specified by:
labelsInRange in interface UnequalLengthAlignment
Throws:
java.lang.IndexOutOfBoundsException

getLabels

public java.util.List getLabels()
Description copied from interface: Alignment

The list of SymbolLists in the alignment.

The index in the list is the same as the index in the alignment. Each SymbolList object will only be in the alignment once. However, a single underlying SymbolList may have more than one view within an alignment, each represented by a different GappedSymbolList.

Specified by:
getLabels in interface Alignment
Returns:
the List of all SymbolLists in the alignment

symbolAt

public Symbol symbolAt(java.lang.Object label,
                       int column)
                throws java.util.NoSuchElementException
Description copied from interface: Alignment
Retrieve a symbol by label and column.

Specified by:
symbolAt in interface Alignment
Parameters:
label - the SymbolList to retrieve from
column - the index of the column to retrieve
Returns:
the symbol in the symbol list associated with the label at the given column
Throws:
java.util.NoSuchElementException - if there is no row for 'label'

symbolAt

public Symbol symbolAt(int column)
                throws java.util.NoSuchElementException
Description copied from interface: SymbolList
Return the symbol at index, counting from 1.

Specified by:
symbolAt in interface SymbolList
Parameters:
column - the offset into this SymbolList
Returns:
the Symbol at that index
Throws:
java.util.NoSuchElementException

symbolListForLabel

public SymbolList symbolListForLabel(java.lang.Object label)
                              throws java.util.NoSuchElementException
Description copied from interface: Alignment
Retrieve a single row of the alignment by label.

Specified by:
symbolListForLabel in interface Alignment
Parameters:
label - the object from which to retrieve the symbol list
Returns:
a SymbolList that contains each token in a row of the alignment
Throws:
java.util.NoSuchElementException - if there is no row for 'label'

getAlphabet

public Alphabet getAlphabet()
Description copied from interface: SymbolList
The alphabet that this SymbolList is over.

Every symbol within this SymbolList is a member of this alphabet. alphabet.contains(symbol) == true for each symbol that is within this sequence.

Specified by:
getAlphabet in interface SymbolList
Returns:
the alphabet

symbolListIterator

public java.util.Iterator symbolListIterator()
Description copied from interface: Alignment
Creates an Iterator over the SymbolLists in the alignment. This should be similar to iterating over the labels and then fetching each SymbolList, but the order is not guaranteed to be the same.

Specified by:
symbolListIterator in interface Alignment
Returns:
an Iterator