Classes for aligning sequences.
For example:
Consensus consensus = null;
try {
// Get alignment algorithm.
PairwiseAlignmentAlgorithm paa =
PairwiseAlignmentAlgorithmFactory.createAlgorithm(
PairwiseAlignmentType.Global,
ScoreMatrixFactory.getScoreMatrix(ScoreMatrixType.Kea),
GapPenaltyFactory.getGapPenalty(GapPenaltyType.Kea)
);
// Register progress component with algorithm.
paa.addProgressListener(_progressComponent);
// Generate matrix.
PairwiseAlignmentMatrix matrix = paa.run(sequence1, sequence2);
// Get traceback object and use it to generate consensus from matrix.
PairwiseAlignmentTraceback traceback =
PairwiseAlignmentTracebackFactory.createTraceback();
consensus = traceback.getConsensus(matrix);
// Remove no-alignment characters at beginning and end.
consensus.trim();
}
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}