public class SimpleAlignedSequence<S extends Sequence<C>,C extends Compound> extends Object implements Serializable, AlignedSequence<S,C>
Sequence within an alignment.AlignedSequence.Step| Constructor and Description |
|---|
SimpleAlignedSequence(AlignedSequence<S,C> prev,
List<AlignedSequence.Step> steps)
Creates a new
AlignedSequence for the given AlignedSequence in a global alignment. |
SimpleAlignedSequence(AlignedSequence<S,C> prev,
List<AlignedSequence.Step> steps,
int numBefore,
int numAfter)
Creates a new
AlignedSequence for the given AlignedSequence in a local alignment. |
SimpleAlignedSequence(S original,
List<AlignedSequence.Step> steps)
Creates an
AlignedSequence for the given Sequence in a global alignment. |
SimpleAlignedSequence(S original,
List<AlignedSequence.Step> steps,
int numBefore,
int numAfter)
Creates an
AlignedSequence for the given Sequence in a local alignment. |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCache()
Nullifies cached arrays/objects.
|
int |
countCompounds(C... compounds)
Returns the number of times we found a compound in the Sequence
|
boolean |
equals(Object o) |
AccessionID |
getAccession()
Returns the AccessionID this location is currently bound with
|
int[] |
getAlignmentFromSequence()
Returns the alignment.
|
int |
getAlignmentIndexAt(int sequenceIndex)
Returns the column index within an alignment corresponding to the given index in the original
Sequence. |
List<C> |
getAsList()
Returns the Sequence as a List of compounds
|
C |
getCompoundAt(int alignmentIndex)
Returns the Compound at the given biological index
|
CompoundSet<C> |
getCompoundSet()
Gets the compound set used to back this Sequence
|
double |
getCoverage()
Returns the coverage, as a fraction between 0 and 1, of this
AlignedSequence with respect to the original sequence. |
Point |
getEnd()
|
int |
getIndexOf(C compound)
Scans through the Sequence looking for the first occurrence of the given
compound
|
SequenceView<C> |
getInverse()
Does the right thing to get the inverse of the current
Sequence.
|
int |
getLastIndexOf(C compound)
Scans through the Sequence looking for the last occurrence of the given
compound
|
int |
getLength()
Returns the length of the Sequence
|
Location |
getLocationInAlignment()
|
int |
getNumGapPositions()
Returns number of gap positions (gap openings and extensions) in the sequence.
|
int |
getNumGaps()
Returns number of gaps in the sequence.
|
S |
getOriginalSequence()
Returns the original
Sequence before alignment. |
int |
getOverlapCount()
Returns the maximum number of elements contributed to a column of an alignment by this
Sequence. |
String |
getSequenceAsString()
Returns the String representation of the Sequence
|
int[] |
getSequenceFromAlignment()
Returns the sequence positions at each alignment index
|
int |
getSequenceIndexAt(int alignmentIndex)
Returns the index in the original
Sequence corresponding to the given index within an alignment. |
Point |
getStart()
|
SequenceView<C> |
getSubSequence(Integer start,
Integer end)
Returns a portion of the sequence from the different positions.
|
int |
hashCode() |
boolean |
isCircular()
Returns true if this
Sequence wraps around from the last alignment column back to the first. |
boolean |
isGap(int alignmentIndex)
Returns true if this
Sequence has a gap at a particular alignment column. |
Iterator<C> |
iterator() |
String |
toString()
Provides standard Java language access to results of
getSequenceAsString(). |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic SimpleAlignedSequence(S original, List<AlignedSequence.Step> steps)
AlignedSequence for the given Sequence in a global alignment.original - the original Sequence before alignmentsteps - lists whether the sequence aligns a Compound or gap at each index of the alignmentIllegalArgumentException - if given sequence does not fit in alignmentpublic SimpleAlignedSequence(S original, List<AlignedSequence.Step> steps, int numBefore, int numAfter)
AlignedSequence for the given Sequence in a local alignment.original - the original Sequence before alignmentsteps - lists whether the sequence aligns a Compound or gap at each index of the alignmentnumBefore - number of Compounds before a local alignmentnumAfter - number of Compounds after a local alignmentIllegalArgumentException - if given sequence does not fit in alignmentpublic SimpleAlignedSequence(AlignedSequence<S,C> prev, List<AlignedSequence.Step> steps)
AlignedSequence for the given AlignedSequence in a global alignment.prev - the previous AlignedSequence before this alignmentsteps - lists whether the sequence aligns a Compound or gap at each index of the alignmentIllegalArgumentException - if given sequence does not fit in alignmentpublic SimpleAlignedSequence(AlignedSequence<S,C> prev, List<AlignedSequence.Step> steps, int numBefore, int numAfter)
AlignedSequence for the given AlignedSequence in a local alignment.prev - the previous AlignedSequence before this alignmentsteps - lists whether the sequence aligns a Compound or gap at each index of the alignmentnumBefore - number of Compounds before a local alignmentnumAfter - number of Compounds after a local alignmentIllegalArgumentException - if given sequence does not fit in alignmentpublic void clearCache()
AlignedSequenceclearCache in interface AlignedSequence<S extends Sequence<C>,C extends Compound>public int[] getAlignmentFromSequence()
AlignedSequencegetAlignmentFromSequence in interface AlignedSequence<S extends Sequence<C>,C extends Compound>public int getAlignmentIndexAt(int sequenceIndex)
AlignedSequenceSequence.
Both indices are 1-indexed and inclusive.getAlignmentIndexAt in interface AlignedSequence<S extends Sequence<C>,C extends Compound>sequenceIndex - index in the original Sequencepublic Point getEnd()
AlignedSequencepublic Location getLocationInAlignment()
AlignedSequenceLocation of the original Sequence within an alignment. This provides access to
additional substructure beyond start and end points.getLocationInAlignment in interface AlignedSequence<S extends Sequence<C>,C extends Compound>public int getNumGaps()
AlignedSequenceLocation information or from
gap Compounds, which may not necessarily result in the same number.getNumGaps in interface AlignedSequence<S extends Sequence<C>,C extends Compound>public S getOriginalSequence()
AlignedSequenceSequence before alignment.getOriginalSequence in interface AlignedSequence<S extends Sequence<C>,C extends Compound>public int getOverlapCount()
AlignedSequenceSequence. If
this Sequence is circular, this number is >= 1. If not, this overlap count is definitely 1.getOverlapCount in interface AlignedSequence<S extends Sequence<C>,C extends Compound>public int[] getSequenceFromAlignment()
AlignedSequencegetSequenceFromAlignment in interface AlignedSequence<S extends Sequence<C>,C extends Compound>public int getSequenceIndexAt(int alignmentIndex)
AlignedSequenceSequence corresponding to the given index within an alignment. Both
indices are 1-indexed and inclusive.getSequenceIndexAt in interface AlignedSequence<S extends Sequence<C>,C extends Compound>alignmentIndex - column index within an alignmentSequencepublic Point getStart()
AlignedSequencepublic boolean isCircular()
AlignedSequenceSequence wraps around from the last alignment column back to the first. This makes
overlap possible, but does not require an overlap count > 1.isCircular in interface AlignedSequence<S extends Sequence<C>,C extends Compound>public boolean isGap(int alignmentIndex)
AlignedSequenceSequence has a gap at a particular alignment column.public int countCompounds(C... compounds)
SequencecountCompounds in interface Sequence<C extends Compound>compounds - Vargs of the compounds to countpublic AccessionID getAccession()
AccessionedgetAccession in interface Accessionedpublic List<C> getAsList()
Sequencepublic C getCompoundAt(int alignmentIndex)
SequencegetCompoundAt in interface Sequence<C extends Compound>alignmentIndex - Biological index (1 to n)public CompoundSet<C> getCompoundSet()
SequencegetCompoundSet in interface Sequence<C extends Compound>public int getIndexOf(C compound)
SequencegetIndexOf in interface Sequence<C extends Compound>compound - Compounds to look forpublic int getLastIndexOf(C compound)
SequencegetLastIndexOf in interface Sequence<C extends Compound>compound - Compounds to look forpublic int getLength()
Sequencepublic String getSequenceAsString()
SequencegetSequenceAsString in interface Sequence<C extends Compound>public SequenceView<C> getSubSequence(Integer start, Integer end)
SequencegetSubSequence in interface Sequence<C extends Compound>start - Biological index start; must be greater than 0end - Biological end; must be less than length + 1public String toString()
getSequenceAsString().public SequenceView<C> getInverse()
SequencegetInverse in interface Sequence<C extends Compound>public int getNumGapPositions()
AlignedSequenceLocation
information or from gap Compounds, which may not necessarily result in the same number.getNumGapPositions in interface AlignedSequence<S extends Sequence<C>,C extends Compound>public double getCoverage()
AlignedSequenceAlignedSequence with respect to the original sequence.
This is equivalent to (Sequence.getLength() - AlignedSequence.getNumGapPositions()) / getOriginalSequence().getLength().getCoverage in interface AlignedSequence<S extends Sequence<C>,C extends Compound>Copyright © 2000–2017 BioJava. All rights reserved.