public class SimpleGappedSymbolList extends AbstractSymbolList implements GappedSymbolList, Serializable
| Modifier and Type | Class and Description | 
|---|---|
protected static class  | 
SimpleGappedSymbolList.Block
An aligned block. 
 | 
AbstractSymbolList.EditScreener, AbstractSymbolList.EditTranslaterEDIT, EMPTY_LIST| Constructor and Description | 
|---|
SimpleGappedSymbolList(Alphabet alpha)  | 
SimpleGappedSymbolList(GappedSymbolList gappedSource)
Create a new SimpleGappedSymbolList that will view source, inheriting all
 existing gaps. 
 | 
SimpleGappedSymbolList(SymbolList source)
Create a new SimpleGappedSymbolList that will view source. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addGapInSource(int pos)
Add a gap at pos within the source coordinates. 
 | 
void | 
addGapInView(int pos)
Add a single gap at pos within the view coordintates. 
 | 
void | 
addGapsInSource(int pos,
               int length)
Add length gaps at pos within the source coordinates. 
 | 
void | 
addGapsInView(int pos,
             int length)
Add length gaps at pos within the view coordinates. 
 | 
List<SimpleGappedSymbolList.Block> | 
BlockIterator()
Get list of the un-gapped region of the SymbolList. 
 | 
void | 
dumpBlocks()
Debugging method 
 | 
protected int | 
findSourceBlock(int indx)
Finds the index of the block containing the source coordinate indx. 
 | 
protected int | 
findSourceGap(int indx)
Finds the index of the Block before the gap at indx within the following
 gap. 
 | 
protected int | 
findViewBlock(int indx)
Finds the index of the Block containing indx within the view ranges. 
 | 
protected int | 
findViewGap(int indx)
Finds the index of the Block before the gap at indx within the view
 range. 
 | 
int | 
firstNonGap()
Return the index of the first Symbol that is not a Gap character. 
 | 
Location | 
gappedToLocation(Location l)
Translates a Location from the gapped view into the underlying sequence. 
 | 
Alphabet | 
getAlphabet()
The alphabet that this SymbolList is over. 
 | 
SymbolList | 
getSourceSymbolList()
Return the underlying (ungapped) SymbolList. 
 | 
Location | 
getUngappedLocation()
Get a Location that contains exactly those positions that are not gaps. 
 | 
protected boolean | 
isSane()  | 
int | 
lastNonGap()
Return the index of the last Symbol that is not a Gap character. 
 | 
int | 
length()
The number of symbols in this SymbolList. 
 | 
Location | 
locationToGapped(Location l)
Translate a Location onto the gapped view, splitting blocks if necessary 
 | 
void | 
removeGap(int pos)
Remove a single gap at position pos in this GappedSymbolList. 
 | 
void | 
removeGaps(int pos,
          int length)
Remove some gaps at position pos in this GappedSymbolList. 
 | 
protected void | 
renumber(int i,
        int delta)
Renumber the view indexes from block, adding delta to each offset. 
 | 
int | 
sourceToView(int indx)
Coordinate conversion from source to view. 
 | 
protected int | 
sourceToView(SimpleGappedSymbolList.Block b,
            int indx)
Coordinate conversion from source to view. 
 | 
Symbol | 
symbolAt(int indx)
Return the symbol at index, counting from 1. 
 | 
int | 
viewToSource(int indx)
Coordinate conversion from view to source. 
 | 
protected int | 
viewToSource(SimpleGappedSymbolList.Block b,
            int indx)
Coordinate conversion from view to source. 
 | 
edit, equals, hashCode, iterator, seqString, subList, subStr, toList, toStringaddChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListenerclone, finalize, getClass, notify, notifyAll, wait, wait, waitedit, iterator, seqString, subList, subStr, toListaddChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListenerpublic SimpleGappedSymbolList(GappedSymbolList gappedSource)
gappedSource - the underlying sequencepublic SimpleGappedSymbolList(SymbolList source)
source - the underlying sequencepublic SimpleGappedSymbolList(Alphabet alpha)
public void addGapInSource(int pos) throws IndexOutOfBoundsException
GappedSymbolListaddGapInSource in interface GappedSymbolListpos - where to add the gapIndexOutOfBoundsException - if pos is not within 1->source.length()public void addGapInView(int pos) throws IndexOutOfBoundsException
GappedSymbolListthis.symbolAt(pos) will then return gap. Adding a gap at 1 will prepend gaps. Adding a gap at (length+1) will append a gap.
addGapInView in interface GappedSymbolListpos - the position to add a gap beforeIndexOutOfBoundsException - if pos is not within 1->length+1public void addGapsInSource(int pos, int length)
GappedSymbolListaddGapsInSource in interface GappedSymbolListpos - where to add the gaplength - how many gaps to addpublic void addGapsInView(int pos, int length) throws IndexOutOfBoundsException
GappedSymbolListthis.symbolAt(i) will then return gap for i = (pos .. pos+count-1). Adding gaps at 1 will prepend gaps. Adding gaps at (length+1) will append gaps.
addGapsInView in interface GappedSymbolListpos - the position to add a gap beforelength - the number of gaps to insertIndexOutOfBoundsException - if pos is not within 1->length+1public List<SimpleGappedSymbolList.Block> BlockIterator()
The gapped symbol list can be represented as a list of ungapped regions. Given a list of start-stop pairs in the ungapped coordinate system each with a corresponding pair of start-stop pairs in the gapped view, the entire gapped list can be reconstructed.
public void dumpBlocks()
public int firstNonGap()
GappedSymbolListAll symbols before firstNonGap are leading gaps. firstNonGap is effectively the index in the view of symbol 1 in the original sequence.
firstNonGap in interface GappedSymbolListpublic Location gappedToLocation(Location l)
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 SymbolListpublic SymbolList getSourceSymbolList()
GappedSymbolListgetSourceSymbolList in interface GappedSymbolListpublic Location getUngappedLocation()
GappedSymbolListThis will be a Location that contains every symbol in the underlying ungapped sequence. Every symbol not in the Location is not from the underlying sequence and is a gap.
getUngappedLocation in interface GappedSymbolListpublic int lastNonGap()
GappedSymbolListAll symbols after lastNonGap untill length are trailing gaps. lastNonGap is effectively the index in the view of symbol length in the original sequence.
lastNonGap in interface GappedSymbolListpublic int length()
SymbolListlength in interface SymbolListpublic Location locationToGapped(Location l)
public void removeGap(int pos) throws IndexOutOfBoundsException, IllegalSymbolException
GappedSymbolListremoveGap in interface GappedSymbolListpos - where to remove the gapIndexOutOfBoundsException - if pos is not within 1..lengthIllegalSymbolException - if the symbol at pos is not a gappublic void removeGaps(int pos, int length) throws IndexOutOfBoundsException, IllegalSymbolException
GappedSymbolListremoveGaps in interface GappedSymbolListpos - where to remove the gapslength - how many to removeIndexOutOfBoundsException - if pos is not within 1..length() or if some of the Symbols
             within pos->(pos+length-1) are not gap SymbolsIllegalSymbolException - if the symbol at pos is not a gappublic final int sourceToView(int indx) throws IndexOutOfBoundsException
GappedSymbolListsourceToView in interface GappedSymbolListindx - the index to projectIndexOutOfBoundsException - if indx is not a valid source indexpublic Symbol symbolAt(int indx) throws IndexOutOfBoundsException
SymbolListsymbolAt in interface SymbolListindx - the offset into this SymbolListIndexOutOfBoundsException - if index is less than 1, or greater than
                                   the length of the symbol listpublic final int viewToSource(int indx) throws IndexOutOfBoundsException
GappedSymbolListIf the index can be projected onto the source, the index it projects onto is returned. If it falls within a gap, then the index of the first symbol after the run of gaps is negated and returned. If the index is after the last block of symbols (and therefore in the trailing list of gaps), then it returns -(length + 1).
viewToSource in interface GappedSymbolListindx - the index to projectIndexOutOfBoundsException - if indx is not a valid view indexprotected final int findSourceBlock(int indx)
indx - the index to findprotected final int findSourceGap(int indx)
indx - the index to find within a gapprotected final int findViewBlock(int indx)
If indx is not within a view block, then it is the index of a gap. The method will return -(indx+1) where indx is the block emediately following the gap.
indx - the index to find within a view range.protected final int findViewGap(int indx)
If indx is in-fact a real symbol, then there will be no Block before it. In this case, the method returns -2. It returns -1 if indx is within the leading gaps and blocks.size()-1 if it is within the trailing gaps.
indx - the index to find within a view rangeprotected boolean isSane()
protected final void renumber(int i, int delta)
This adjusts viewStart and viewEnd to be += delta for each block i->blocks.size(), and sets the total length to += delta.
i - the firstprotected final int sourceToView(SimpleGappedSymbolList.Block b, int indx)
b - the block containing indxindx - the index to projectprotected final int viewToSource(SimpleGappedSymbolList.Block b, int indx)
b - the block containing indxindx - the index to projectCopyright © 2020 BioJava. All rights reserved.