<p>I don't know of any transcript-to-transcript aligners that are able to do this, but <a href="http://last.cbrc.jp/doc/lastal.html" rel="nofollow noreferrer">LAST</a> can align transcript queries to protein reference sequences using a specified frameshift cost. Here's the specific documentation for that option:</p>

<blockquote>
  <p>-F COST   </p>
  
  <p>Align DNA queries to protein reference sequences, using the specified
  frameshift cost. A value of 15 seems to be reasonable. (As a special
  case, -F0 means DNA-versus-protein alignment without frameshifts,
  which is faster.) The output looks like this:</p>

<pre><code>a score=108 s prot 2  40 + 649
FLLQAVKLQDP-STPHQIVPSP-VSDLIATHTLCPRMKYQDD s dna  8 117 + 999
FFLQ-IKLWDP\STPH*IVSSP/PSDLISAHTLCPRMKSQDN
</code></pre>
  
  <p>The \ indicates a forward shift by one nucleotide, and the / indicates
  a reverse shift by one nucleotide. The * indicates a stop codon. The
  same alignment in tabular format looks like this:</p>

<pre><code>108 prot 2 40 + 649 dna 8 117 + 999 4,1:0,6,0:1,10,0:-1,19
</code></pre>
  
  <p>The "-1" indicates the reverse frameshift.</p>
</blockquote>

<p>I sent an email to the <a href="https://groups.google.com/forum/#!forum/last-align" rel="nofollow noreferrer">LAST mailing list</a> about adding a frameshift penalty for transcript-to-transcript matching; I've been pleasantly surprised with the requested features that Martin Frith has added to LAST in the past. Unfortunately, in this case the problem is too difficult to sort out due to all the possible combinations that could happen, so it's unlikely to be implemented in LAST in the forseeable future (unless someone else writes that code).</p>

CC BY-SA 3.0
2017-07-17T00:31:47.860Z
2017-07-22T11:05:35.870Z
2017-07-22T11:05:35.870Z
gringer
<p>Try MACSE v2 (<a href="https://academic.oup.com/mbe/article/35/10/2582/5079334" rel="nofollow noreferrer">https://academic.oup.com/mbe/article/35/10/2582/5079334</a>) will align multiple protein-coding nucleotide sequences based on their amino acid translation while allowing for the occurrence of frameshifts</p>

CC BY-SA 4.0
2020-07-23T09:13:11.120Z
Thanks @user90!
M__
CC BY-SA 4.0
2022-10-06T20:35:35.450Z
I had no idea! thanks, the 'new' singularity provided [here](https://github.com/ranwez/MACSE_V2_PIPELINES/blob/master/OMM_MACSE/OMM_MACSE_V11.05_sing_3.def)  works like charm.
Andrés Parada
CC BY-SA 4.0
2020-07-23T09:07:14.107Z
2020-07-23T09:07:14.107Z
user90
<p>Virulign does this for virus sequences, the publication is available <a href="https://www.ncbi.nlm.nih.gov/pubmed/30295730" rel="nofollow noreferrer">here</a> and github address <a href="https://github.com/rega-cev/virulign" rel="nofollow noreferrer">here</a></p>

CC BY-SA 4.0
2020-05-01T17:26:40.123Z
Hi @kristoftheys welcome to the site, congratulations on Bioinfo paper. I've edited the post to include publication and github address.
M__
CC BY-SA 4.0
2020-05-03T08:26:19.810Z
@Michael many thanks for the completion. sorry for the inconvenience, next time better :)
kristof theys
CC BY-SA 4.0
2020-05-01T16:59:03.360Z
2020-05-01T17:25:22.953Z
2020-05-01T17:25:22.953Z
kristof theys
<p>Sometimes it useful to perform a nucleotide protein coding gene sequence alignment based on codons, not on individual nucleotides. For example for further codon model analysis it is important to have full codons.</p>

<p>A widely used approach here is to perform a protein sequence alignment first and then impose this alignment to the nucleotide sequences using <a href="http://www.bork.embl.de/pal2nal/" rel="noreferrer">PAL2NAL</a>, <a href="http://wbiomed.curtin.edu.au/bioinf/CodonAlign.php" rel="noreferrer">CodonAlign</a> or something similar.</p>

<p>This is how <a href="https://dx.doi.org/10.1186/1471-2105-6-156" rel="noreferrer">transAlign</a> or <a href="http://guidance.tau.ac.il/ver2/" rel="noreferrer">GUIDANCE</a> (in codon mode) work.</p>

<p>The problem here is that you are discarding part of the information which could be potentially used for the sequence alignment. E.g. if you have slowly evolving low-complexity region adjacent to a quickly evolving one, the amino acid induced alignment could be wrong, while incorporating nucleotide sequence potentially allows to make the alignment more accurate.</p>

<p>I'm aware of two programs which can do true codon alignment. First, <a href="http://wasabiapp.org/software/prank/" rel="noreferrer">PRANK</a> has a dedicated codon model, but it is rather slow and using it is overkill for certain problems. Second, <a href="http://www.bioinformatics.org/sms2/pairwise_align_codons.html" rel="noreferrer">Sequence Manipulation Suite</a> can perform codon alignments, but only for a pair of sequences; also it's javascript based, therefore it is hard to run it for a large number of sequences.</p>

<p>Can you recommend any software for multiple codon sequence alignment? Preferably available for offline use.</p>

CC BY-SA 4.0
2019-03-20T20:20:17.033Z
@IakovDavydov how does a codon alignment 'loose some information' over a simple DNA-DNA alignment? It's easier to find homologous residues using proteins (instead of DNA), and using that information to align DNA triplets can only be beneficial.
PejoPhylo
CC BY-SA 4.0
2019-03-21T09:00:59.310Z
@PejoPhylo I was not claiming that codon alignment looses some information. I was saying that when converting codons to amino acid some information is lost.
Iakov Davydov
CC BY-SA 4.0
2019-03-21T10:07:53.740Z
@IakovDavydov I'm sorry, but then I don't understand what you originally asked in this question. Couldn't you use PAL2NAL for your (multiple) codon alignment? It supports offline use
PejoPhylo
CC BY-SA 4.0
2019-03-21T17:09:08.207Z
@PejoPhylo I don't think I can make it much clearer here than in the original question. But briefly: with PAL2NAL you loose some information, which might be important for some alignments. Most of the time that's not important, but if your dN is comparable with dS and GC-content stays constant, that could make a difference. This paper provides some details: https://doi.org/10.1093/molbev/msr272
Iakov Davydov
CC BY-SA 4.0
2019-03-21T17:13:23.213Z
@IakovDavydov thanks, I'll give it a read.
PejoPhylo
CC BY-SA 4.0
2022-09-30T14:27:45.373Z
@IakovDavydov I don't think that your original question is correct.  If one is interested in the functional aspect (the protein), then any codon based aligner will work, for example MEGA.  By definition, the amino acids are being aligned. The question about the low complexity, slowly evolving region is mute. If you are interested in the codon differences and drift, or evolution of the codons, then yes - but, I think that using nt aligned by codon is done more from the perspective of bundling the nt into triplets.
Andor Kiss
CC BY-SA 3.0
2017-07-05T16:02:11.253Z
Why not translate the sequence and perform amino acid alignment? True, you “discard” the codon isoacceptor identity but that can be mapped back trivially if needed.
Konrad Rudolph
CC BY-SA 3.0
2017-07-05T16:57:59.340Z
As I write in the question, this way you loose some information. E.g. you can produce an incorrect amino acid alignment for low-complexity region, which you otherwise would be able to reconstruct MSA properly.
In principle I agree that this doesn't happen very often.
Iakov Davydov
CC BY-SA 3.0
2017-07-16T17:25:07.657Z
There's `blastx` and `tblastx` but I don't think they do true codon alignment.
GWW
<phylogenetics><covid-19><codon><sars-cov-2><virulign>
Which sequence alignment tools support codon alignment?
# Which sequence alignment tools support codon alignment?

(Asked by: username_0 on 2017-07-05)

Sometimes it useful to perform a nucleotide protein coding gene sequence alignment based on codons, not on individual nucleotides. For example for further codon model analysis it is important to have full codons.

A widely used approach here is to perform a protein sequence alignment first and then impose this alignment to the nucleotide sequences using [PAL2NAL](http://www.bork.embl.de/pal2nal/), [CodonAlign](http://wbiomed.curtin.edu.au/bioinf/CodonAlign.php) or something similar.

This is how [transAlign](https://dx.doi.org/10.1186/1471-2105-6-156) or [GUIDANCE](http://guidance.tau.ac.il/ver2/) (in codon mode) work.

The problem here is that you are discarding part of the information which could be potentially used for the sequence alignment. E.g. if you have slowly evolving low-complexity region adjacent to a quickly evolving one, the amino acid induced alignment could be wrong, while incorporating nucleotide sequence potentially allows to make the alignment more accurate.

I'm aware of two programs which can do true codon alignment. First, [PRANK](http://wasabiapp.org/software/prank/) has a dedicated codon model, but it is rather slow and using it is overkill for certain problems. Second, [Sequence Manipulation Suite](http://www.bioinformatics.org/sms2/pairwise_align_codons.html) can perform codon alignments, but only for a pair of sequences; also it's javascript based, therefore it is hard to run it for a large number of sequences.

Can you recommend any software for multiple codon sequence alignment? Preferably available for offline use.

**Tags:** phylogenetics, covid-19, codon, sars-cov-2, virulign
> **Comments:**
> **username_3**: Why not translate the sequence and perform amino acid alignment? True, you “discard” the codon isoacceptor identity but that can be mapped back trivially if needed.  
> **username_0**: As I write in the question, this way you loose some information. E.g. you can produce an incorrect amino acid alignment for low-complexity region, which you otherwise would be able to reconstruct MSA properly. In principle I agree that this doesn't happen very often.  
> **username_4**: There's `blastx` and `tblastx` but I don't think they do true codon alignment.  
> **username_1**: @IakovDavydov how does a codon alignment 'loose some information' over a simple DNA-DNA alignment? It's easier to find homologous residues using proteins (instead of DNA), and using that information to align DNA triplets can only be beneficial.  
> **username_0**: @PejoPhylo I was not claiming that codon alignment looses some information. I was saying that when converting codons to amino acid some information is lost.  
> **username_1**: @IakovDavydov I'm sorry, but then I don't understand what you originally asked in this question. Couldn't you use PAL2NAL for your (multiple) codon alignment? It supports offline use  
> **username_0**: @PejoPhylo I don't think I can make it much clearer here than in the original question. But briefly: with PAL2NAL you loose some information, which might be important for some alignments. Most of the time that's not important, but if your dN is comparable with dS and GC-content stays constant, that could make a difference. This paper provides some details: https://doi.org/10.1093/molbev/msr272  
> **username_1**: @IakovDavydov thanks, I'll give it a read.  
> **username_2**: @IakovDavydov I don't think that your original question is correct.  If one is interested in the functional aspect (the protein), then any codon based aligner will work, for example MEGA.  By definition, the amino acids are being aligned. The question about the low complexity, slowly evolving region is mute. If you are interested in the codon differences and drift, or evolution of the codons, then yes - but, I think that using nt aligned by codon is done more from the perspective of bundling the nt into triplets.  

---

## 3 answers

### Answer by username_5 on 2017-07-17. Score: 4

I don't know of any transcript-to-transcript aligners that are able to do this, but LAST can align transcript queries to protein reference sequences using a specified frameshift cost. Here's the specific documentation for that option:

-F COST   
Align DNA queries to protein reference sequences, using the specified
  frameshift cost. A value of 15 seems to be reasonable. (As a special
  case, -F0 means DNA-versus-protein alignment without frameshifts,
  which is faster.) The output looks like this:
a score=108 s prot 2  40 + 649
FLLQAVKLQDP-STPHQIVPSP-VSDLIATHTLCPRMKYQDD s dna  8 117 + 999
FFLQ-IKLWDP\STPH*IVSSP/PSDLISAHTLCPRMKSQDN

The \ indicates a forward shift by one nucleotide, and the / indicates
  a reverse shift by one nucleotide. The * indicates a stop codon. The
  same alignment in tabular format looks like this:
108 prot 2 40 + 649 dna 8 117 + 999 4,1:0,6,0:1,10,0:-1,19

The "-1" indicates the reverse frameshift.

I sent an email to the LAST mailing list about adding a frameshift penalty for transcript-to-transcript matching; I've been pleasantly surprised with the requested features that Martin Frith has added to LAST in the past. Unfortunately, in this case the problem is too difficult to sort out due to all the possible combinations that could happen, so it's unlikely to be implemented in LAST in the forseeable future (unless someone else writes that code).


---

### Answer by username_6 on 2020-07-23. Score: 3

Try MACSE v2 (<https://academic.oup.com/mbe/article/35/10/2582/5079334>) will align multiple protein-coding nucleotide sequences based on their amino acid translation while allowing for the occurrence of frameshifts

> **Comments:**
> **username_7**: Thanks @user90!  
> **username_8**: I had no idea! thanks, the 'new' singularity provided [here](https://github.com/ranwez/MACSE_V2_PIPELINES/blob/master/OMM_MACSE/OMM_MACSE_V11.05_sing_3.def)  works like charm.  

---

### Answer by username_9 on 2020-05-01. Score: 2

Virulign does this for virus sequences, the publication is available [here](https://www.ncbi.nlm.nih.gov/pubmed/30295730) and github address [here](https://github.com/rega-cev/virulign)

> **Comments:**
> **username_7**: Hi @kristoftheys welcome to the site, congratulations on Bioinfo paper. I've edited the post to include publication and github address.  
> **username_9**: @Michael many thanks for the completion. sorry for the inconvenience, next time better :)  

---

