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 (gap openings) 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, wait
forEach, spliterator
public 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 Compound
s before a local alignmentnumAfter
- number of Compound
s 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 Compound
s before a local alignmentnumAfter
- number of Compound
s after a local alignmentIllegalArgumentException
- if given sequence does not fit in alignmentpublic void clearCache()
AlignedSequence
clearCache
in interface AlignedSequence<S extends Sequence<C>,C extends Compound>
public int[] getAlignmentFromSequence()
AlignedSequence
getAlignmentFromSequence
in interface AlignedSequence<S extends Sequence<C>,C extends Compound>
public int getAlignmentIndexAt(int sequenceIndex)
AlignedSequence
Sequence
.
Both indices are 1-indexed and inclusive.getAlignmentIndexAt
in interface AlignedSequence<S extends Sequence<C>,C extends Compound>
sequenceIndex
- index in the original Sequence
public Point getEnd()
AlignedSequence
public Location getLocationInAlignment()
AlignedSequence
Location
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()
AlignedSequence
Location
information or from
gap Compound
s, which may not necessarily result in the same number.getNumGaps
in interface AlignedSequence<S extends Sequence<C>,C extends Compound>
public S getOriginalSequence()
AlignedSequence
Sequence
before alignment.getOriginalSequence
in interface AlignedSequence<S extends Sequence<C>,C extends Compound>
public int getOverlapCount()
AlignedSequence
Sequence
. 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()
AlignedSequence
getSequenceFromAlignment
in interface AlignedSequence<S extends Sequence<C>,C extends Compound>
public int getSequenceIndexAt(int alignmentIndex)
AlignedSequence
Sequence
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 alignmentSequence
public Point getStart()
AlignedSequence
public boolean isCircular()
AlignedSequence
Sequence
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)
AlignedSequence
Sequence
has a gap at a particular alignment column.public int countCompounds(C... compounds)
Sequence
countCompounds
in interface Sequence<C extends Compound>
compounds
- Vargs of the compounds to countpublic AccessionID getAccession()
Accessioned
getAccession
in interface Accessioned
public List<C> getAsList()
Sequence
public C getCompoundAt(int alignmentIndex)
Sequence
getCompoundAt
in interface Sequence<C extends Compound>
alignmentIndex
- Biological index (1 to n)public CompoundSet<C> getCompoundSet()
Sequence
getCompoundSet
in interface Sequence<C extends Compound>
public int getIndexOf(C compound)
Sequence
getIndexOf
in interface Sequence<C extends Compound>
compound
- Compounds to look forpublic int getLastIndexOf(C compound)
Sequence
getLastIndexOf
in interface Sequence<C extends Compound>
compound
- Compounds to look forpublic int getLength()
Sequence
public String getSequenceAsString()
Sequence
getSequenceAsString
in interface Sequence<C extends Compound>
public SequenceView<C> getSubSequence(Integer start, Integer end)
Sequence
getSubSequence
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()
Sequence
getInverse
in interface Sequence<C extends Compound>
public int getNumGapPositions()
AlignedSequence
Location
information or from gap Compound
s, which may not necessarily result in the same number.getNumGapPositions
in interface AlignedSequence<S extends Sequence<C>,C extends Compound>
public double getCoverage()
AlignedSequence
AlignedSequence
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–2019 BioJava. All rights reserved.