This function replaces the aligned amino acids in aa.msa
with their
original codon triplets. This is possible only when the nucleotide sequences in nuc.ffn
are the exact nucleotide sequences behind the protein sequences that are aligned in aa.msa
.
It is required that the first token of the Header lines is identical for a protein sequence
in aa.msa
and its nucleotide version in nuc.ffn, otherwise it is impossible to
match them. Thus, they may not appear in the same order in the two input fasta objects.
When aligning coding sequences, one should in general always align their protein sequences, to
keep the codon structure, and then use backTranslate
to convert this into a
nucleotide alignment, if required.
If the nuclotide sequences contain the stop codons, these will be removed.