Could someone kindly recommend a tool or R package that can identify synonymous sites in a multiple sequence alignment?

I wish to select those taxa for tree reconstruction and other downstream analyses within subset of the alignment.

To respond to the questions below: yes, I am interested in identifying synonymous sites within a multiple sequence alignment (DNA) of ~70 virus samples with limited genetic diversity. My goal is to subset the multiple sequence alignment including synonymous sites only, because we believe that there are parallel non-synonymous mutations occurring that do not provide information on shared evolutionary history.

Thank you @M_ for the really helpful information below. In Mega, the S tool identifies singleton sites rather than synonymous sites in a multiple sequence alignment. I'm wondering if there is another tool or a PAML option to subset the synonymous sites?

Thank you in advance and best!

  • 1
    $\begingroup$ Do we also need to handle the translation, or is it already a protein alignment? Are we talking about two sequences or more? What kind of output do you need? Visual? Or text? Something else? $\endgroup$
    – terdon
    Apr 27, 2022 at 9:59
  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Apr 27, 2022 at 11:38

1 Answer 1


I proposed Syn-SCAN (below). This was used for HIV and as you are looking at viruses seems a good fit.

There's a simpler way ... just make a invariable amino acid alignment, i.e. discard all amino acid variation. MEGA will do that, or use an algorithm. You then simply check the remaining nucleotide sequences for identity and discard the identity (lots of algorithms do this).

What you are left with is, is what you seek, PURE SYNONYMOUS mutations.

  1. discard taxa with amino acid variation
  2. retain taxa nucleotides with variation.

However, just discarding amino acid variation and retaining everything else will either by identity or synonymous. To be honest, its a virus so the amount of sequence identity between taxa is likely to be very little for protein loci.

Its really that simple. I honestly wouldn't over complicate it.

Sorry for the singleton vs. synonymous error, I haven't looked at MEGA in ages. Its a bit bizarre it discarded the only thing it was actually used for.

The short answer to the question is the 3rd codon position is the traditional approximation for synonymous mutation. A small proportion of 1st codon position sites are neutral and a small proportion of 3rd codon position are non-synonymous.

I agree with @terdon about and @Community regarding additional information sought, because synonymous mutations are heavily subject to compositional bias and that is a big subject. The key issue is the whether the taxa/species in the alignments are known for compositional bias and the genetic distance between different members of the alignment.

The traditional package used for synonymous mutations is/was MEGA, currently version 11. Albeit, recent 'upgrades' seem to remove the synonymous distance matrix calculation. HOWEVER, they may have transferred this capability onto its what appears to be upgraded GUI alignment viewer. What I think is if you:

  • load the alignment into the GUI;
  • click alignment (big button far left of menu);
  • you will now see the alignment;
  • in the middle of the menu bar are 4 buttons 'C', 'V', 'Pi' and 'S'
  • I think 'S' = synonymous
  • All synonymous sites in the alignment are now highlighted and there is likely a method of extracting this information.

C=constant, V=variable Pi=Nei approximation of diversity (population genetics)

If this is correct then those are the subset sought, please note however you will need to select/deselect the taxa manually and reassess the synonymous sites after each 'point and click' iteration (the S button will remain active I suspect between each selection/deselection). What you appear to want is a synonymous tree and this function I believe was removed from MEGA.

MEGA is rarely used except for teaching because its functionality is available elsewhere that permit a given algorithm to be integrated into a data pipeline, which MEGA would not permit (might have recently changed). Hence my recollection of MEGA is a little vague.

The package used for synonymous work is PAML and remains the undisputed standard without question in the context of formal selection analysis, which is heavily dependent on a estimate of synonymous mutations. What you refer to as 'synonymous mutation' isn't the same as the phylogenetic definition, i.e. your definition depends on the other members of the alignment, whereas this isn't an issue in the phylogenetic definition (because the tree circumvents this, i.e. delineates subsets) except if compositional bias occurs ... huge amounts of work is/has been dedicated to compositional bias.

Final point is the widely used phylogenetic library in R called ape will not perform a synonymous mutation calculation - I think, however phangorn library in R might do, but is more likely within the context of selection analysis. Thus to answer the question directly, I don't think R will do this calculation.

It transpires S= singleton (sorry) ....

Have a look at Syn-SCAN. The link is here https://hivdb.stanford.edu/pages/synscan.html . I have never used it and the download link is on the website. The good thing is its written in Perl so it would be easy to modify and check (if you can read/write Perl).

PAML: you can't detach the synonymous mutation calculation from the non-synonymous mutation calculation, without delving into the C-code (which I wouldn't recommend).

  • 1
    $\begingroup$ "Final point is whether R's ape": ape? Should that be API or something else entirely? $\endgroup$
    – terdon
    Apr 27, 2022 at 13:14
  • $\begingroup$ Thank you @M_ for the above! I edited my question in response. Thanks again! $\endgroup$
    – ksw
    Apr 27, 2022 at 17:42
  • $\begingroup$ Hi @terdon .. sorry ape is a popular phylogenetics library in R. Personally, I think its over-used. Its not an API ... I will clarify the text. $\endgroup$
    – M__
    Apr 27, 2022 at 20:57
  • 1
    $\begingroup$ Thanks! As for "Personally, I think its over-used", that's how I feel about R :P $\endgroup$
    – terdon
    Apr 28, 2022 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.