Bios2mds: an R package for comparing orthologous protein families by metric multidimensional scaling
© Pelé et al.; licensee BioMed Central Ltd. 2012
Received: 3 January 2012
Accepted: 15 June 2012
Published: 15 June 2012
The distance matrix computed from multiple alignments of homologous sequences is widely used by distance-based phylogenetic methods to provide information on the evolution of protein families. This matrix can also be visualized in a low dimensional space by metric multidimensional scaling (MDS). Applied to protein families, MDS provides information complementary to the information derived from tree-based methods. Moreover, MDS gives a unique opportunity to compare orthologous sequence sets because it can add supplementary elements to a reference space.
The R package bios2mds (from BIOlogical Sequences to MultiDimensional Scaling) has been designed to analyze multiple sequence alignments by MDS. Bios2mds starts with a sequence alignment, builds a matrix of distances between the aligned sequences, and represents this matrix by MDS to visualize a sequence space. This package also offers the possibility of performing K-means clustering in the MDS derived sequence space. Most importantly, bios2mds includes a function that projects supplementary elements (a.k.a. “out of sample” elements) onto the space defined by reference or “active” elements. Orthologous sequence sets can thus be compared in a straightforward way. The data analysis and visualization tools have been specifically designed for an easy monitoring of the evolutionary drift of protein sub-families.
The bios2mds package provides the tools for a complete integrated pipeline aimed at the MDS analysis of multiple sets of orthologous sequences in the R statistical environment. In addition, as the analysis can be carried out from user provided matrices, the projection function can be widely used on any kind of data.
The multiple alignment of homologous sequences provides important information on the evolution and the sequence-function relationships of protein families. Two types of methods, tree-based or space-based methods, can be used to compare sequences (reviewed in ). Both methods depend on a multiple alignment of homologous sequences. Tree methods assume a hierarchical, binary structure of the data to infer phylogenetic relationships. On the other hand, space methods are based on multivariate analysis of a distance matrix between the sequences and do not assume a specific structure for the data. Such a method is metric multidimensional (MDS) which is a powerful method to visualize distances between elements [2–5]. MDS, also named principal coordinate analysis, starts from a matrix of distances between elements and visualizes these elements in a low dimensional space in which the distances best approximate the original distances. Applied to biological sequences, this method usefully complements phylogeny [6–11].
The completion of the genome sequencing of a wide variety of organisms has paved the way to the comparison of protein families from different species. A very interesting property of MDS is the possibility to project supplementary elements onto a reference or “active” space. The positions of the supplementary elements (a.k.a. “out of sample” elements) are obtained from their distance to the active elements [2, 12, 13]. This property provides a very useful tool to compare orthologous sequences to a reference sequence set. In particular, when several orthologous protein families are compared, this method can be used to visualize evolutionary drifts .
MDS is based on the eigen-decomposition (i.e., principal component analysis) of a cross-product matrix derived from the distance matrix [2–5] and can be performed with the default tools included in the R statistical language (e.g., cmds function). In addition, several R packages such as ade4 made4, adegenet, and vegan[14–17] have been developed to provide multivariate analysis in the field of bioinformatics, including MDS. For example, the dudi.pca function in ade4 or the wcmdscale function in vegan performs MDS analysis. However, the projection technique has not been widely used yet and, to the best of our knowledge, is not included in the available R packages.
Thus, we have developed the R package bios2mds (from BIOlogical Sequences to MultiDimensional Scaling) to provide all the tools necessary to perform the MDS analysis of multiple sequence alignments. This package includes a function that projects supplementary sequences onto a reference space and, thus, makes it possible to compare orthologous sequence sets.
The bios2mds package has been developed in the R statistical environment. R was chosen because it is open-source, accessible under the GNU General Public License and widely used within the bioinformatics community. R packages can take advantage of functions already developed in available packages. Here, the aim of the package is to provide the tools necessary to compare orthologous sequence sets by MDS analysis, namely to analyze the active set by metric MDS to define an active space and project supplementary orthologous sequences onto this active space.
While it is possible to use available packages such as ape and seqinr to read sequences and compute distance matrices, we preferred to avoid too many dependencies for clarity purpose. Thus the corresponding functions were rewritten and included into the bios2mds package. Concerning the MDS computation, the cmds function provided by R gives the final results (coordinates and eigenvalues) but does not give access to the intermediary matrices that are required for the projection technique. It was thus necessary to write an MDS function from its basic equations in order to perform the projection of supplementary elements.
Here, we present the main functionalities of bios2mds. The package provides a complete R environment for MDS analysis in the context of protein sequences. It includes functions for data import, MDS computation, clustering and visualization of the results.
Multidimensional scaling relies on distance matrices. The user can provide these distance matrices or compute them from multiple sequence alignments in the FASTA or MSF formats. Sequence alignments are read in with the import.fasta or import.msf functions. Several measures of distances can be computed for multiple alignments of protein sequences: the Euclidean distances based on the square roots of the difference scores , the distances based on the difference scores and the distances based on dissimilarity scores computed from amino acid substitution matrices. The substitution matrices provided with bios2mds are the JTT  and the Gonnet  matrices, the BLOSUM  and the PAM  series, along with the PHAT  and JTT_TM  matrices, more specifically developed for membrane proteins. The distances based on the difference scores can also be used for nucleotide sequences. More sophisticated measures of DNA distances can be found in several packages, such as ade4, ape and phangorn[14, 18, 27].
Briefly, given a matrix of (squared) distances between elements, MDS transforms this matrix of squared distances into a cross-product matrix whose eigen-decomposition provides the factor score matrix giving the coordinates of the elements on the principal components [2–5]. The projection of supplementary elements onto the active space depends on the matrix of distances between the supplementary and the active elements and on the factor score matrix of the active elements [2, 12, 13]. To make the projection possible and to facilitate subsequent data analysis especially in the case of orthologous sequence sets, we provide the mmds function (corresponding to the cmds command from R, but with a customized output) and the mmds.project function that performs projection of supplementary elements onto an active space.
The MDS representation of the sequence space can be analyzed by K-means in order to find clusters. This part of bios2mds depends on the amap, e1071, and cluster packages. The kmeans.run function that we have developed assesses the robustness of the clustering. It depends on the Kmeans and the matchClasses functions from the amap and e1071 packages, respectively. The kmeans.run function performs multiple runs of Kmeans from the amap package and analyzes the resulting clusters with the matchClasses function from the e1071 package. The output of kmeans.run provides the most frequent clustering solution, with the list of the members of each cluster and their relative membership to this cluster in the different runs. The sil.score function performs multiple runs of the silhouette function from the cluster package. The silhouette function helps determining the optimal number of clusters . Multiple runs with sil.score allow taking into account the clustering uncertainty. The write.fasta function allows users to retrieve the multiple sequence alignment of each cluster, in FASTA format, for further analysis.
The package bios2mds contains graphical tools to visualize the results of the MDS analysis in R. The mmds.2D.plot and mmds.3D.plot functions are used for 2D and 3D representations, respectively, of active and supplementary elements, on the same graph, on user selected components. The mmds.3D.plot function is based on plot3D from the rgl package  that provides an interactive tool for 3D visualization within the R environment. The col.group function allows the use of a color code for plotting the 2D and 3D graphs, based on groupings and colors defined by the user in CSV files, for both active and supplementary elements. The mmds.2D.multi function visualizes the barycenters of the groups defined by the user in the 2D representation of the active elements. Finally, the write.mmds.pdb function allows users to export the coordinates of each element on the first three components obtained by MDS in a PDB format for visualization with a molecular graphics program, such as Pymol (http://www.pymol.org) or Rasmol (http://www.openrasmol.org). When col.group is used, each user-defined group corresponds to a different PDB chain number to facilitate selection and coloring.
Results and discussion
In this section, we show and discuss the results obtained by typical MDS analyses. The input consists of non-redundant sets of non-olfactory class A G-protein-coupled receptors (GPCRs) from different species [9, 33]. Two types of analysis make sense: the analysis of paralogous sequences, yielding a sequence space, and the comparison of orthologous sequences, using the projection technique.
Analysis of paralogous sequences
Comparison of scoring methods
% negative components
Comparison of orthologous sequence sets
Figures 4a and b show the projection of the assigned and unassigned sequences from N. vectensis, respectively, onto the sequence space of human GPCRs. As previously discussed , receptors that cannot be assigned to a human sub-family are projected onto the centre of the human space since their specific evolution is expected to happen on perpendicular dimensions. The GPCR sequence space of the sea anemone has a cross shape (Figure 4c) and is driven by several large sub-families with no equivalent in humans. For clarity purpose, we project separately the human GPCRs from either “ancient” or “recent” sub-families onto this sequence space (Figures 4c and d, respectively). The “ancient” sub-families are those present both in N. vectensis and in H. sapiens. The projection of the human receptors from these “ancient” sub-families onto the anemone sequence space is consistent with the reverse projection (compare Figures 4a and c). Similarly, the human receptors from “recent” sub-families, with no equivalent in N. vectensis, are projected towards the centre of the anemone sequence space (Figure 4d).
The R package bios2mds provides users with a powerful and flexible framework to perform multidimensional scaling of multiple sequence alignments. The program can import data directly as distance matrices or as multiple sequence alignments from which distance matrices are computed. The package bios2mds is tailored for the analysis of protein sequences but can be adapted for nucleotide sequences. Several R tools, including the cmds command, offer the possibility to perform MDS analysis of a distance matrix. However, to our knowledge, the bios2mds package is unique in allowing the projection of supplementary elements onto an active space in the R environment. This property is especially suited for the comparison of orthologous sequence sets and the evolution of specific protein sub-families. The tools for the visualization of the data have been designed to take advantage of prior knowledge on the protein family under scrutiny, for example its classification into sub-families or the presence of specific sequence motifs. Finally, it has to be emphasized that the input of the projection function within bios2mds requires only active and supplementary distances matrices. Thus this function can be widely used for any kind of application.
Availability and requirements
Project name: bios2mds
Project home page: http://cran.r-project.org/web/packages/bios2mds/index.html
Operating systems: Platform independent
Programming language: R 2.12
Other requirements: requires the amap, e1071, cluster, scales and rgl packages
License: GNU General Public License
Any restrictions to use by non-academics: None
We thank NEC Computers Services SARL (Angers, France) for the kind provision of a multiprocessor server. We thank the Conseil Général de Maine-et-Loire for JP’s fellowship and the Centre Hospitalier Universitaire of Angers and the CNRS for JMB’s studenship. We thank Dr P. Guardiola (Angers, France) for stimulating discussion and advice.
- B-Rao C, Majumdar KC: Reconstruction of phylogenetic relationships. J Biosci. 1999, 24: 121-137. 10.1007/BF02941116.View ArticleGoogle Scholar
- Abdi H: Metric multidimensional scaling. Edited by: Salkind NJ. 2007, Sage, Thousand Oaks (CA), 598-605.Google Scholar
- Borg I: Groenen PJF: Modern multidimensional scaling. 2005, Springer, New YorkGoogle Scholar
- Gower JC: A comparison of some methods of cluster analysis. Biometrics. 1967, 23: 623-637. 10.2307/2528417.View ArticlePubMedGoogle Scholar
- Torgerson WS: Theory and methods of scaling. 1958, Wiley, New YorkGoogle Scholar
- Blackshields G, Sievers F, Shi W, Wilm A, Higgins DG: Sequence embedding for fast construction of guide trees for multiple sequence alignment. Algorithms Mol Biol. 2010, 5: 21-10.1186/1748-7188-5-21.PubMed CentralView ArticlePubMedGoogle Scholar
- B-Rao C, Majumbar K: Map-like representation of phylogenetic relationships: Application to tilapiine fish. J Fish Biol. 1998, 52: 1199-1217. 10.1111/j.1095-8649.1998.tb00966.x.View ArticleGoogle Scholar
- Higgins DG: Sequence ordinations: a multivariate analysis approach to analysing large sequence data sets. Comput Appl Biosci. 1992, 8: 15-22.PubMedGoogle Scholar
- Pelé J, Abdi H, Moreau M, Thybert D, Chabbert M: Multidimensional scaling reveals the main evolutionary pathways of class A G-protein-coupled receptors. PLoS One. 2011, 6: e19094-10.1371/journal.pone.0019094.PubMed CentralView ArticlePubMedGoogle Scholar
- Shi W, Lei F, Zhu C, Sievers F, Higgins DG: A complete analysis of HA and NA genes of influenza A viruses. PLoS One. 2010, 5: e14454-10.1371/journal.pone.0014454.PubMed CentralView ArticlePubMedGoogle Scholar
- Woolley KJ, Athalye M: A use for principal coordinate analysis in the comparison of protein sequences. Biochem Biophys Res Commun. 1986, 140: 808-813. 10.1016/0006-291X(86)90705-9.View ArticlePubMedGoogle Scholar
- Trosset MW, Pribe CE: The out-of-sample problem for classical multidimensional scaling. Computational statistics & data analysis. 2008, 52: 4635-4642. 10.1016/j.csda.2008.02.031.View ArticleGoogle Scholar
- Gower JC: Adding a Point to Vector Diagrams in Multivariate Analysis. Biometrika. 1968, 55: 582-585. 10.1093/biomet/55.3.582.View ArticleGoogle Scholar
- Chessel D, Dufour AB, Thioulouse J: The ade4 package-I: One-table methods. R news. 2004, 4: 5-10.Google Scholar
- Culhane AC, Thioulouse J, Perriere G, Higgins DG: MADE4: an R package for multivariate analysis of gene expression data. Bioinformatics. 2005, 21: 2789-2790. 10.1093/bioinformatics/bti394.View ArticlePubMedGoogle Scholar
- Jombart T: adegenet: a R package for the multivariate analysis of genetic markers. Bioinformatics. 2008, 24: 1403-1405. 10.1093/bioinformatics/btn129.View ArticlePubMedGoogle Scholar
- Oksanen J, Blanchet FG, Kindt R, Legendre P, O'Hara RB, Simpson GL, Solymos P, Stevens MHH, Wagner H: Vegan: Community Ecology Package.http://cran.r-project.org/package=vegan,
- Paradis E, Claude J, Strimmer K: APE: Analyses of Phylogenetics and Evolution in R language. Bioinformatics. 2004, 20: 289-290. 10.1093/bioinformatics/btg412.View ArticlePubMedGoogle Scholar
- Charif D, Lobry JR: SeqinR 1.0-2: a contributed package to the R project for statistical computing devoted to biological sequences retrieval and analysis. Edited by: Bastolla U, Porto M, Roman HE, Vendruscolo M. 2007, Springer Verlag, New York, 207-232.Google Scholar
- Gower JC: A general coefficient of similarity and some of its properties. Biometrics. 1971, 27: 857-871. 10.2307/2528823.View ArticleGoogle Scholar
- Jones DT, Taylor WR, Thornton JM: The rapid generation of mutation data matrices from protein sequences. Comput Appl Biosci. 1992, 8: 275-282.PubMedGoogle Scholar
- Gonnet GH, Cohen MA, Benner SA: Exhaustive matching of the entire protein sequence database. Science. 1992, 256: 1443-1445. 10.1126/science.1604319.View ArticlePubMedGoogle Scholar
- Henikoff S, Henikoff JG: Amino acid substitution matrices from protein blocks. Proc Natl Acad Sci U S A. 1992, 89: 10915-10919. 10.1073/pnas.89.22.10915.PubMed CentralView ArticlePubMedGoogle Scholar
- Dayhoff MO, Schwartz RM, Orcutt BC: A model of evolutionary change in proteins. Atlas of Protein Sequence and Structure. 1978, 5: 345-352.Google Scholar
- Ng PC, Henikoff JG, Henikoff S: PHAT: a transmembrane-specific substitution matrix. Predicted hydrophobic and transmembrane. Bioinformatics. 2000, 16: 760-766. 10.1093/bioinformatics/16.9.760.View ArticlePubMedGoogle Scholar
- Jones DT, Taylor WR, Thornton JM: A mutation data matrix for transmembrane proteins. FEBS Lett. 1994, 339: 269-275. 10.1016/0014-5793(94)80429-X.View ArticlePubMedGoogle Scholar
- Schliep KP: Phangorn: phylogenetic analysis in R. Bioinformatics. 2011, 27: 592-593. 10.1093/bioinformatics/btq706.PubMed CentralView ArticlePubMedGoogle Scholar
- Lucas A: Using amap and ctc Packages for Huge Clustering. R news. 2006, 6: 58-60.Google Scholar
- Dimitriadou E, Hornik K, Leisch F, Meyer D, Weingessel A: Misc Functions of the Department of Statistics (e1071), TU Wien.http://cran.r-project.org/package=e1071,
- Struyf A, Hubert M, Rousseeuw PJ: Integrating Robust Clustering Techniques in S-PLUS. Computational Statistics and Data Analysis. 1997, 26: 17-37. 10.1016/S0167-9473(97)00020-0.View ArticleGoogle Scholar
- Rousseeuw P: Silhouettes: A Graphical Aid to the Interpretation and Validation of Cluster Analysis. J Comput Appl Math. 1987, 20: 53-65.View ArticleGoogle Scholar
- Adler D, Nenadic O, Zucchini W, RGL: A R-library for 3D visualization with OpenGL. Edited by: Braverman A. 2009, Curran Associates, Inc, Red Hook, 419-429.Google Scholar
- Devillé J, Rey J, Chabbert M: An indel in transmembrane helix 2 helps to trace the molecular evolution of class A G-protein-coupled receptors. J Mol Evol. 2009, 68: 475-489. 10.1007/s00239-009-9214-9.View ArticlePubMedGoogle Scholar
- Fredriksson R, Lagerstrom MC, Lundin LG, Schioth HB: The G-protein-coupled receptors in the human genome form five main families. Phylogenetic analysis, paralogon groups, and fingerprints. Mol Pharmacol. 2003, 63: 1256-1272. 10.1124/mol.63.6.1256.View ArticlePubMedGoogle Scholar
- Kreienkamp HJ, Larusson HJ, Witte I, Roeder T, Birgul N, Honck HH, Harder S, Ellinghausen G, Buck F, Richter D: Functional annotation of two orphan G-protein-coupled receptors, Drostar1 and −2, from Drosophila melanogaster and their ligands by reverse pharmacology. J Biol Chem. 2002, 277: 39937-39943. 10.1074/jbc.M206931200.View ArticlePubMedGoogle Scholar
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.