<p>Woaa that is complicated data. </p>

<p>The reason it fails is easy, correcting it is harder. It fails because the open reading frame is lost during in silico translation, e.g. several gaps have 4 indels and the final nucleotides after the final indel are always 4. Thus it will invariably encounter a stop codon OR it will simply refuse to deal with an indel if it is incorporated into a triplet codon. There is no triplet codon model for an indel so the whole calculations stops.</p>

<p>Correcting data that complex ... the easiest way to do it is align you entire data set using amino acids, e.g. muscle. Have an identical nucleotide data set. MAKE SURE the names and positions are identical between your amino acid and nucleotide data, as a programmer this isn't hard to do however, everyone has their own scripts to do this. If you don't do this you next step will fall over. </p>

<p>Use a amino acid to nucleotide alignment translator. I use <code>transalign</code> (I think its EMBOSS). This will give you an inframe alignment. I noted many/all of you start codons are ATG which is a good sign. Check the nucleotide output and make sure there is no overhangs of the triplet codon at the terminal 3' end and check in <code>Jalview</code> or whatever your alignment editor of choice is that the translation is okay. </p>

<p>This will alignment work in the synonymous/non-synonymous analysis and all subsequent/complimentary analyses. </p>

<p>If you have an intron in protein your you'll need to remove it (hopefully not).</p>

<p>Finally you need to be careful of '3rd codon saturation' in your data because that heavily affects your trees and its certainly a risk given the heterogeneity of the indel structure, but first I would get an inframe alignment. There are checks for saturation (I'm sure even R can do this).</p>

CC BY-SA 4.0
2020-06-09T18:20:00.140Z
"he easiest way to do it is align you entire data set using amino acids, e.g. muscle." this i did in MEGA .Yes I have respective amino acids for the set of nucleotide as well "MAKE SURE the names and positions are identical between your amino acid and nucleotide data"is it the file name?
kcm
CC BY-SA 4.0
2020-06-09T15:04:10.987Z
2020-06-09T15:04:10.987Z
M__
<pre><code>library(seqinr)
library(ape)
library(phangorn)
</code></pre>

<p>alignment file <a href="https://drive.google.com/file/d/10P6qF3nrXlnm-tUONK5bTAPqR4wapX-q/view?usp=sharing" rel="nofollow noreferrer">data file</a>
    sylvia.aln &lt;- read.alignment("abhi_seq/all_seq_no_gal.fas", format="fasta")
    sylvia.aln</p>

<pre><code>kaks(sylvia.aln, verbose=TRUE)


Warning message:
In kaks(sylvia.aln) : sequence lengths are not a multiple of 3
</code></pre>

<p>It ends with this warning and there are no result.</p>

<p>When i ran one of the seqinr example data what I see there are no gaps in the sequence files. If i understand the results is due to the gap I suppose. </p>

<p>Any help or suggestion would be really appreciated.</p>

<r><phylogenetics>
Calculating Synonymous and non-synonymous
# Calculating Synonymous and non-synonymous

(Asked by: username_0 on 2020-06-09)

library(seqinr)
library(ape)
library(phangorn)

alignment file data file
    sylvia.aln <- read.alignment("abhi_seq/all_seq_no_gal.fas", format="fasta")
    sylvia.aln
kaks(sylvia.aln, verbose=TRUE)


Warning message:
In kaks(sylvia.aln) : sequence lengths are not a multiple of 3

It ends with this warning and there are no result.
When i ran one of the seqinr example data what I see there are no gaps in the sequence files. If i understand the results is due to the gap I suppose. 
Any help or suggestion would be really appreciated.

**Tags:** r, phylogenetics

---

## 1 answers

### Answer by username_1 on 2020-06-09. Score: 1

Woaa that is complicated data.

The reason it fails is easy, correcting it is harder. It fails because the open reading frame is lost during in silico translation, e.g. several gaps have 4 indels and the final nucleotides after the final indel are always 4. Thus it will invariably encounter a stop codon OR it will simply refuse to deal with an indel if it is incorporated into a triplet codon. There is no triplet codon model for an indel so the whole calculations stops.

Correcting data that complex ... the easiest way to do it is align you entire data set using amino acids, e.g. muscle. Have an identical nucleotide data set. MAKE SURE the names and positions are identical between your amino acid and nucleotide data, as a programmer this isn't hard to do however, everyone has their own scripts to do this. If you don't do this you next step will fall over.

Use a amino acid to nucleotide alignment translator. I use `transalign` (I think its EMBOSS). This will give you an inframe alignment. I noted many/all of you start codons are ATG which is a good sign. Check the nucleotide output and make sure there is no overhangs of the triplet codon at the terminal 3' end and check in `Jalview` or whatever your alignment editor of choice is that the translation is okay.

This will alignment work in the synonymous/non-synonymous analysis and all subsequent/complimentary analyses.

If you have an intron in protein your you'll need to remove it (hopefully not).

Finally you need to be careful of '3rd codon saturation' in your data because that heavily affects your trees and its certainly a risk given the heterogeneity of the indel structure, but first I would get an inframe alignment. There are checks for saturation (I'm sure even R can do this).

> **Comments:**
> **username_0**: "he easiest way to do it is align you entire data set using amino acids, e.g. muscle." this i did in MEGA .Yes I have respective amino acids for the set of nucleotide as well "MAKE SURE the names and positions are identical between your amino acid and nucleotide data"is it the file name?  

---

