public class Alignment extends Object
AffineCosts
Modifier and Type | Class and Description |
---|---|
static class |
Alignment.AlignmentType |
Modifier and Type | Field and Description |
---|---|
protected AffineCosts |
aCosts
The affine alignment costs
|
protected Costs |
costs
The alignment costs
|
protected double[][][] |
d
The matrices holding the edit distances
|
protected int |
l1
The length of the sub-sequence of the first sequence that is aligned
|
protected int |
l2
The length of the sub-sequence of the second sequence that is aligned
|
protected Sequence |
s1
The first sequence
|
protected Sequence |
s2
The second sequence
|
protected int |
startS1
The start position in the first sequence
|
protected int |
startS2
The start position in the second sequence
|
protected Alignment.AlignmentType |
type
The type of the alignment
|
Constructor and Description |
---|
Alignment(Costs costs)
Creates a new
Alignment instance that aligns the sequences
s1 and s2 using the costs defined in
costs . |
Alignment(Costs costs,
int offDiagonal)
Creates a new
Alignment instance that aligns the sequences
s1 and s2 using the costs defined in
costs and a banded version of the alignment algorithm. |
Modifier and Type | Method and Description |
---|---|
boolean |
computeAlignment(Alignment.AlignmentType type,
Sequence s1,
int startS1,
int endS1,
Sequence s2,
int startS2,
int endS2)
Computes the alignment between
s1 and s2 starting from startS1 and startS2 until endS1 and endS2 , respectively. |
boolean |
computeAlignment(Alignment.AlignmentType type,
Sequence s1,
Sequence s2)
Computes the alignment between
s1 and s2 . |
PairwiseStringAlignment |
getAlignment(Alignment.AlignmentType type,
Sequence s1,
int startS1,
int endS1,
Sequence s2,
int startS2,
int endS2)
|
PairwiseStringAlignment |
getAlignment(Alignment.AlignmentType type,
Sequence s1,
Sequence s2)
|
protected PairwiseStringAlignment |
getAlignment(int[] index)
Returns the optimal alignment (backtrace) according to matrix
index[0] until positions index[1] and
index[2] in the first and second sequence, respectively. |
double |
getCost(int end1,
int end2)
Returns the costs until positions
end1 and end2 of the last alignment computed using
computeAlignment(AlignmentType, Sequence, Sequence) . |
protected int startS1
protected int startS2
protected Sequence s1
protected Sequence s2
protected int l1
protected int l2
protected Costs costs
protected AffineCosts aCosts
protected Alignment.AlignmentType type
protected double[][][] d
public Alignment(Costs costs)
Alignment
instance that aligns the sequences
s1
and s2
using the costs defined in
costs
.costs
- the costspublic Alignment(Costs costs, int offDiagonal)
Alignment
instance that aligns the sequences
s1
and s2
using the costs defined in
costs
and a banded version of the alignment algorithm.
If the alignment is performed for Sequence
s of different length,
the number of secondary diagonals must be at least as large as the difference
of the lengths.costs
- the costsoffDiagonal
- the number of secondary diagonals at both sides of the diagonalpublic PairwiseStringAlignment getAlignment(Alignment.AlignmentType type, Sequence s1, Sequence s2)
type
- the type of the alignments1
- the first sequences2
- the second sequencepublic PairwiseStringAlignment getAlignment(Alignment.AlignmentType type, Sequence s1, int startS1, int endS1, Sequence s2, int startS2, int endS2)
type
- the type of the alignments1
- the first sequencestartS1
- the start position in the first sequenceendS1
- the end position in the first sequences2
- the second sequencestartS2
- the start position in the second sequenceendS2
- the end position in the second sequencepublic boolean computeAlignment(Alignment.AlignmentType type, Sequence s1, Sequence s2)
s1
and s2
.
Afterwards, alignment costs may be obtained by getCost(int, int)
. To also obtain the alignment, use getAlignment(AlignmentType, Sequence, Sequence)
.type
- the type of the alignments1
- the first sequences2
- the second sequencepublic boolean computeAlignment(Alignment.AlignmentType type, Sequence s1, int startS1, int endS1, Sequence s2, int startS2, int endS2)
s1
and s2
starting from startS1
and startS2
until endS1
and endS2
, respectively.
Afterwards, alignment costs may be obtained by getCost(int, int)
. To also obtain the alignment, use getAlignment(AlignmentType, Sequence, Sequence)
.type
- the type of the alignments1
- the first sequencestartS1
- the start position in the first sequenceendS1
- the end position (exclusive) in the first sequences2
- the second sequencestartS2
- the start position in the second sequenceendS2
- the end position (exclusive) in the second seuqencepublic double getCost(int end1, int end2)
end1
and end2
of the last alignment computed using
computeAlignment(AlignmentType, Sequence, Sequence)
.end1
- the end position in the first sequenceend2
- the end position in the second sequenceprotected PairwiseStringAlignment getAlignment(int[] index)
index[0]
until positions index[1]
and
index[2]
in the first and second sequence, respectively. The method computeAlignment(AlignmentType, Sequence, Sequence)
must be called before obtaining the alignment, since this method only does the backtracing in the matrices.index
- the indexes of the matrix element