Package org.biojava.bio.alignment
Class FlexibleAlignment
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojava.bio.symbol.AbstractSymbolList
org.biojava.bio.alignment.AbstractULAlignment
org.biojava.bio.alignment.FlexibleAlignment
- All Implemented Interfaces:
Alignment,ARAlignment,EditableAlignment,UnequalLengthAlignment,SymbolList,Changeable
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.
- Author:
- David Waring, Matthew Pocock
-
Nested Class Summary
Nested classes/interfaces inherited from class org.biojava.bio.alignment.AbstractULAlignment
AbstractULAlignment.LeftRightLocationComparator<T>, AbstractULAlignment.SubULAlignmentNested classes/interfaces inherited from class org.biojava.bio.symbol.AbstractSymbolList
AbstractSymbolList.EditScreener, AbstractSymbolList.EditTranslaterNested classes/interfaces inherited from interface org.biojava.bio.alignment.Alignment
Alignment.SymbolListIterator -
Field Summary
FieldsFields inherited from class org.biojava.bio.alignment.AbstractULAlignment
alphabetFields inherited from interface org.biojava.bio.alignment.ARAlignment
ADD_LABEL, REMOVE_LABELFields inherited from interface org.biojava.bio.alignment.EditableAlignment
GAPS, LOCATIONFields inherited from interface org.biojava.bio.symbol.SymbolList
EDIT, EMPTY_LIST -
Constructor Summary
ConstructorsConstructorDescriptionFlexibleAlignment(List<AlignmentElement> 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). since more than one sequence in an alignment could have the same name this works as long as the labels are different objects even though they may hold the same name. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd a new a alignment usings a location to the reference sequence.protected booleanallGaps(SymbolList seq, int start, int end) make sure that all Symbols in this range are gapsvoidedit() allows edits on an individual sequence, they should be reflected back to the underlying SymbolList.protected AlignmentElementgetLabels will return a list of labels in left to right ordergetLabelsAt(int column) protected intgreater(int x, int y) intlength()protected intlesser(int x, int y) locInAlignment(Object label) The location of an individual SymbolList relative to overall Alignmentprotected Locationprotected intget the position in the sequence corresponding to the postion within the alignmentvoidremoveGaps(GappedSymbolList seq, int start, int length) because there is a bug in GappedSymbolListvoidremoveSequence(Object label) protected voidcheck that begining is at 1 otherwise shift everything overprotected voidmoves the whole sequenceprotected voidshiftAll(int offset) voidshiftAtAlignmentLoc(Object label, Location loc, int offset) loc in this case is the Alignment LocationvoidshiftAtSequenceLoc(Object label, Location loc, int offset) loc in this case is the SymbolList LocationThis gets the symbol for an individual sequence at position in the overall alignment If the sequence is not aligned at that location it returns nullsymbolListForLabel(String label) Methods inherited from class org.biojava.bio.alignment.AbstractULAlignment
debug, labelsAt, labelsInRange, leftMost, orderedLables, rightMost, subAlignment, subAlignment, symbolAt, symbolListIteratorMethods inherited from class org.biojava.bio.symbol.AbstractSymbolList
edit, equals, hashCode, iterator, seqString, subList, subStr, toList, toStringMethods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListenerMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.biojava.bio.alignment.Alignment
subAlignment, symbolListIteratorMethods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Field Details
-
data
-
labelOrder
-
alignmentRange
-
-
Constructor Details
-
FlexibleAlignment
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). since more than one sequence in an alignment could have the same name this works as long as the labels are different objects even though they may hold the same name.- Throws:
BioException
-
-
Method Details
-
addSequence
add a new a alignment usings a location to the reference sequence. This should either contain no gaps or it should be relative to a reference sequence that already has the gaps added- Specified by:
addSequencein interfaceARAlignment- Throws:
ChangeVetoExceptionBioException
-
removeSequence
- Specified by:
removeSequencein interfaceARAlignment- Throws:
ChangeVetoException
-
locInAlignment
The location of an individual SymbolList relative to overall Alignment- Specified by:
locInAlignmentin interfaceUnequalLengthAlignment- Throws:
NoSuchElementException
-
getLabelsAt
- Throws:
IndexOutOfBoundsException
-
length
- Specified by:
lengthin interfaceSymbolList
-
getAlphabet
- Specified by:
getAlphabetin interfaceSymbolList
-
getLabels
getLabels will return a list of labels in left to right order -
symbolAt
public Symbol symbolAt(String label, int column) throws NoSuchElementException, IndexOutOfBoundsException 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- Specified by:
symbolAtin interfaceAlignment- Throws:
NoSuchElementExceptionIndexOutOfBoundsException
-
symbolListForLabel
- Specified by:
symbolListForLabelin interfaceAlignment- Parameters:
label-- Returns:
- Throws:
NoSuchElementException
-
edit
Description copied from interface:EditableAlignmentedit() allows edits on an individual sequence, they should be reflected back to the underlying SymbolList.
- Specified by:
editin interfaceEditableAlignment- Throws:
ChangeVetoException
-
shiftAtAlignmentLoc
public void shiftAtAlignmentLoc(Object label, Location loc, int offset) throws ChangeVetoException, IllegalAlignmentEditException, IndexOutOfBoundsException loc in this case is the Alignment Location- Specified by:
shiftAtAlignmentLocin interfaceEditableAlignment- Throws:
ChangeVetoExceptionIllegalAlignmentEditExceptionIndexOutOfBoundsException
-
shiftAtSequenceLoc
public void shiftAtSequenceLoc(Object label, Location loc, int offset) throws ChangeVetoException, IllegalAlignmentEditException, IndexOutOfBoundsException loc in this case is the SymbolList Location- Specified by:
shiftAtSequenceLocin interfaceEditableAlignment- Throws:
ChangeVetoExceptionIllegalAlignmentEditExceptionIndexOutOfBoundsException
-
removeGaps
because there is a bug in GappedSymbolList -
allGaps
make sure that all Symbols in this range are gaps -
resetRange
check that begining is at 1 otherwise shift everything over- Throws:
ChangeVetoException
-
shiftAll
- Throws:
ChangeVetoException
-
shift
moves the whole sequence- Throws:
ChangeVetoException
-
greater
-
lesser
-
getAE
- Throws:
NoSuchElementException
-
posInSeq
protected int posInSeq(Object label, int column) throws NoSuchElementException, IndexOutOfBoundsException get the position in the sequence corresponding to the postion within the alignment -
locInSeq
protected Location locInSeq(Object label, Location viewLoc) throws NoSuchElementException, IndexOutOfBoundsException
-