I have a multiple sequence alignment (MSA) of protein sequences, with which I have performed multidimensional scaling to visualize their clustering. Using R, I used the seqinr package to create an identity matrix (using dist.alignment). Is there a similar method that is more "generalizable"? Specifically, I'm interested in classifying the amino acids by some functional characteristics, such as polarity, instead of having the alignment list the amino acids by their identity (A, G, I, etc.).

Here's a very short set of fake input data, with columns 2-4 representing amino acid residue positions:

a <- c("Strain 1", "Strain 2", "Strain 3", "Strain 4")
b <- c("Polar_hydrox", "Nonpolar", "Nonpolar", "Polar_hydrox")
c <- c("Nonpolar", "Nonpolar", "Nonpolar", "Nonpolar")
d <- c("Nonpolar_cyclic", "Nonpolar_cyclic", "Polar_amide", "Polar_amide")
e <- c("Polar_amide", "Acidic", "Polar_amide", "Acidic")
x <- data.frame(a, b, c, d, e)

Is what I'm asking a feasible/correct use of MDS? Or should I be looking into a different method entirely? I attempted to use Gower's formula to create a dissimilarity matrix on the original dataset (i.e. using the actual amino acid identities instead of the functional groupings), but compared to what I got using dist.alignment, the MDS plots look different.

Edit: Gower's formula and the dist.alignment function are obviously calculating the distance matrices differently, but I don't know the details on the different methods. Would using Gower's formula be a good approach for calculating distance matrices for the example dataset?

Edit: clarified functions used for calculating distance matrix.

  • 1
    $\begingroup$ If you use different distances metrics it is expected to get different MDS plots. What do you mean by more generalizable? What is your biological goal? $\endgroup$
    – llrs
    Commented Jan 8, 2019 at 7:57
  • $\begingroup$ Thanks for your response. My goal is to see whether sequences appear more related to one another when considering what the functionality of their amino composition is, versus the raw amino acid composition. I'm interested in the phenomena that not every kind of amino acid change will affect immune escape equally. $\endgroup$ Commented Jan 8, 2019 at 15:27
  • $\begingroup$ The question is then why do you settle for Gower's formula and not other distance metrics like the Manhattan distance? It is as good as any other distance metric as far as I can tell. $\endgroup$
    – llrs
    Commented Jan 8, 2019 at 15:55

2 Answers 2


Some of the first MSA analysis, eg of codon usage of bacteria were performed using matrix factorization (see old papers from Des Higgins). His group also published discriminative methods for finding functional residues using supervised correspondence analysis

Wallace IM1, Higgins DG BMC Bioinformatics. 2007 Apr 23;8:135. Supervised multivariate analysis of sequence groups to identify specificity determining residues.

The method is available in the R package ade4 and Bioconductor package made4

Also have a look at the phylogenetic R package adephylo and several related packages


I personally don't think this will work well for some variables, primarily because you are not mapping conformational epitopes, where amino acids will cluster in physical space by their charge. In particular, the charge is critical to retaining this conformational structure.

However, hydrophobic/hydrophilic characters are far more amenable to linear style epitopes that this analysis is primed towards.

I don't recommend a multi-dimensional array for this analysis, because you have loads of information, but rather a 'dictionary' (Python), hash (Perl) (or 'object' [any]) or XML, which retains all the information for a given sequence and then strips this in preparation for your multivariate statistic.


Your Answer

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

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