public class FlexibleAlignment extends AbstractULAlignment implements ARAlignment, EditableAlignment
FlexibleAlignment is a class which implements UnequalLengthAlignment, ARAlignment and EditableAlignment It places no restriction on where any sequence can be in the alignment so there could be gaps in the alignment. You tell it where to put the sequence, it will do it. I think I will be adding an Exception NonContinuousAlignmentException. STILL UNDER CONSTRUCTION. seqString does not work because there it does not seem to support tokenization 'token' this is true for SimpleAlignment too.
AbstractULAlignment.LeftRightLocationComparator, AbstractULAlignment.SubULAlignment
AbstractSymbolList.EditScreener, AbstractSymbolList.EditTranslater
Alignment.SymbolListIterator
Modifier and Type | Field and Description |
---|---|
protected Location |
alignmentRange |
protected java.util.Map |
data |
protected java.util.List |
labelOrder |
alphabet
ADD_LABEL, REMOVE_LABEL
EDIT, EMPTY_LIST
GAPS, LOCATION
Constructor and Description |
---|
FlexibleAlignment(java.util.List seqList)
construct this object with the reference sequence which can either be a gappedSymbolList or not
label in all cases refers to an object that holds the display name (generally just a String).
|
Modifier and Type | Method and Description |
---|---|
void |
addSequence(AlignmentElement ae)
add a new a alignment usings a location to the reference sequence.
|
protected boolean |
allGaps(SymbolList seq,
int start,
int end)
make sure that all Symbols in this range are gaps
|
void |
edit(java.lang.Object label,
Edit edit)
edit() allows edits on an individual sequence, they should be reflected back
to the underlying SymbolList.
|
protected AlignmentElement |
getAE(java.lang.Object label) |
Alphabet |
getAlphabet()
The alphabet that this SymbolList is over.
|
java.util.List |
getLabels()
getLabels will return a list of labels in left to right order
|
java.util.List |
getLabelsAt(int column) |
protected int |
greater(int x,
int y) |
int |
length()
The number of symbols in this SymbolList.
|
protected int |
lesser(int x,
int y) |
Location |
locInAlignment(java.lang.Object label)
The location of an individual SymbolList relative to overall Alignment
|
protected Location |
locInSeq(java.lang.Object label,
Location viewLoc) |
protected int |
posInSeq(java.lang.Object label,
int column)
get the position in the sequence corresponding to the postion within the alignment
|
void |
removeGaps(GappedSymbolList seq,
int start,
int length)
because there is a bug in GappedSymbolList
|
void |
removeSequence(java.lang.Object label) |
protected void |
resetRange()
check that begining is at 1 otherwise shift everything over
|
protected void |
shift(java.lang.Object label,
int offset)
moves the whole sequence
|
protected void |
shiftAll(int offset) |
void |
shiftAtAlignmentLoc(java.lang.Object label,
Location loc,
int offset)
loc in this case is the Alignment Location
|
void |
shiftAtSequenceLoc(java.lang.Object label,
Location loc,
int offset)
loc in this case is the SymbolList Location
|
Symbol |
symbolAt(java.lang.Object label,
int column)
This gets the symbol for an individual sequence at position in the overall alignment
If the sequence is not aligned at that location it returns null
|
SymbolList |
symbolListForLabel(java.lang.Object label)
Retrieve a single row of the alignment by label.
|
debug, labelsAt, labelsInRange, leftMost, orderedLables, rightMost, subAlignment, subAlignment, symbolAt, symbolListIterator
edit, equals, hashCode, iterator, seqString, subList, subStr, toList, toString
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
subAlignment, symbolListIterator
edit, iterator, seqString, subList, subStr, symbolAt, toList
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
protected java.util.Map data
protected java.util.List labelOrder
protected Location alignmentRange
public FlexibleAlignment(java.util.List seqList) throws BioException
BioException
public void addSequence(AlignmentElement ae) throws ChangeVetoException, BioException
addSequence
in interface ARAlignment
ChangeVetoException
BioException
public void removeSequence(java.lang.Object label) throws ChangeVetoException
removeSequence
in interface ARAlignment
ChangeVetoException
public Location locInAlignment(java.lang.Object label) throws java.util.NoSuchElementException
locInAlignment
in interface UnequalLengthAlignment
java.util.NoSuchElementException
public java.util.List getLabelsAt(int column) throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public int length()
SymbolList
length
in interface SymbolList
public Alphabet getAlphabet()
SymbolList
Every symbol within this SymbolList is a member of this alphabet.
alphabet.contains(symbol) == true
for each symbol that is within this sequence.
getAlphabet
in interface SymbolList
public java.util.List getLabels()
public Symbol symbolAt(java.lang.Object label, int column) throws java.util.NoSuchElementException, java.lang.IndexOutOfBoundsException
symbolAt
in interface Alignment
label
- the SymbolList to retrieve fromcolumn
- the index of the column to retrievejava.util.NoSuchElementException
- if there is no row for 'label'java.lang.IndexOutOfBoundsException
public SymbolList symbolListForLabel(java.lang.Object label) throws java.util.NoSuchElementException
Alignment
symbolListForLabel
in interface Alignment
label
- the object from which to retrieve the symbol listjava.util.NoSuchElementException
- if there is no row for 'label'public void edit(java.lang.Object label, Edit edit) throws ChangeVetoException
EditableAlignment
edit() allows edits on an individual sequence, they should be reflected back to the underlying SymbolList.
edit
in interface EditableAlignment
ChangeVetoException
public void shiftAtAlignmentLoc(java.lang.Object label, Location loc, int offset) throws ChangeVetoException, IllegalAlignmentEditException, java.lang.IndexOutOfBoundsException
shiftAtAlignmentLoc
in interface EditableAlignment
ChangeVetoException
IllegalAlignmentEditException
java.lang.IndexOutOfBoundsException
public void shiftAtSequenceLoc(java.lang.Object label, Location loc, int offset) throws ChangeVetoException, IllegalAlignmentEditException, java.lang.IndexOutOfBoundsException
shiftAtSequenceLoc
in interface EditableAlignment
ChangeVetoException
IllegalAlignmentEditException
java.lang.IndexOutOfBoundsException
public void removeGaps(GappedSymbolList seq, int start, int length)
protected boolean allGaps(SymbolList seq, int start, int end)
protected void resetRange() throws ChangeVetoException
ChangeVetoException
protected void shiftAll(int offset) throws ChangeVetoException
ChangeVetoException
protected void shift(java.lang.Object label, int offset) throws ChangeVetoException
ChangeVetoException
protected int greater(int x, int y)
protected int lesser(int x, int y)
protected AlignmentElement getAE(java.lang.Object label) throws java.util.NoSuchElementException
java.util.NoSuchElementException
protected int posInSeq(java.lang.Object label, int column) throws java.util.NoSuchElementException, java.lang.IndexOutOfBoundsException
java.util.NoSuchElementException
java.lang.IndexOutOfBoundsException