# Calculating Synonymous and non-synonymous

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.

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).

• "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? – krushnach Chandra Jun 9 '20 at 18:20