* Realigns the given dna to match the alignment of the protein, using codon
* mappings to translate aligned peptide positions to codons.
*
+ * Always produces a padded CDS alignment.
+ *
* @param dna
* the alignment whose sequences are realigned by this method
* @param protein
// todo: implement this
List<AlignedCodonFrame> mappings = protein.getCodonFrames();
int alignedCount = 0;
+ int width = 0; // alignment width for padding CDS
for (SequenceI dnaSeq : dna.getSequences())
{
if (alignCdsSequenceAsProtein(dnaSeq, protein, mappings,
{
alignedCount++;
}
+ width = Math.max(dnaSeq.getLength(), width);
+ }
+ int oldwidth, diff;
+ for (SequenceI dnaSeq : dna.getSequences())
+ {
+ oldwidth = dnaSeq.getLength();
+ diff = width - oldwidth;
+ if (diff > 0)
+ {
+ dnaSeq.insertCharAt(oldwidth, diff, dna.getGapCharacter());
+ }
}
return alignedCount;
}