text: user3932: 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.
  
  user3848: 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. 
  
  user3939: 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
  
original_text: 3932: <p>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 <code>seqinr</code> package to create an identity matrix (using <code>dist.alignment</code>).  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.).  </p>
  
  <p>Here's a very short set of fake input data, with columns 2-4 representing amino acid residue positions:</p>
  
  <pre><code>a &lt;- c("Strain 1", "Strain 2", "Strain 3", "Strain 4")
  b &lt;- c("Polar_hydrox", "Nonpolar", "Nonpolar", "Polar_hydrox")
  c &lt;- c("Nonpolar", "Nonpolar", "Nonpolar", "Nonpolar")
  d &lt;- c("Nonpolar_cyclic", "Nonpolar_cyclic", "Polar_amide", "Polar_amide")
  e &lt;- c("Polar_amide", "Acidic", "Polar_amide", "Acidic")
  x &lt;- data.frame(a, b, c, d, e)
  </code></pre>
  
  <p>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 <code>dist.alignment</code>, the MDS plots look different.</p>
  
  <p>Edit: Gower's formula and the <code>dist.alignment</code> 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?</p>
  
  <p>Edit: clarified functions used for calculating distance matrix.</p>
   3848: <p>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.</p>
  
  <p>However, hydrophobic/hydrophilic characters are far more amenable to linear style epitopes that this analysis is primed towards.</p>
  
  <p>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. </p>
   3939: <p>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 </p>
  
  <blockquote>
    <p>Wallace IM1, Higgins DG BMC Bioinformatics. 2007 Apr 23;8:135.
    Supervised multivariate analysis of sequence groups to identify
    specificity determining residues.</p>
  </blockquote>
  
  <p>The method is available in the R package <a href="https://bioconductor.org/packages/ade4" rel="nofollow noreferrer">ade4</a> and Bioconductor package <a href="https://bioconductor.org/packages/made4" rel="nofollow noreferrer">made4</a></p>
  
  <p>Also have a look at the phylogenetic R package <a href="https://cran.r-project.org/package=adephylo" rel="nofollow noreferrer">adephylo</a> and several related packages</p>
  