Skylign: a tool for creating informative, interactive logos representing sequence alignments and profile hidden Markov models
BMC Bioinformatics volume 15, Article number: 7 (2014)
Logos are commonly used in molecular biology to provide a compact graphical representation of the conservation pattern of a set of sequences. They render the information contained in sequence alignments or profile hidden Markov models by drawing a stack of letters for each position, where the height of the stack corresponds to the conservation at that position, and the height of each letter within a stack depends on the frequency of that letter at that position.
We present a new tool and web server, called Skylign, which provides a unified framework for creating logos for both sequence alignments and profile hidden Markov models. In addition to static image files, Skylign creates a novel interactive logo plot for inclusion in web pages. These interactive logos enable scrolling, zooming, and inspection of underlying values. Skylign can avoid sampling bias in sequence alignments by down-weighting redundant sequences and by combining observed counts with informed priors. It also simplifies the representation of gap parameters, and can optionally scale letter heights based on alternate calculations of the conservation of a position.
Skylign is available as a website, a scriptable web service with a RESTful interface, and as a software package for download. Skylign’s interactive logos are easily incorporated into a web page with just a few lines of HTML markup. Skylign may be found at http://skylign.org.
Alignments and profile hidden Markov models
Alignments of multiple biological sequences play an important role in a wide range of bioinformatics applications, and are used to represent sequence families that range in size from DNA binding site motifs to full length proteins, ribosomal RNAs, and autonomous transposable elements. In an alignment, sequences are organized such that each column contains amino acids (or nucleotides) related by descent or shared functional constraint. The distributions of letters will typically vary from column to column. These patterns can reveal important characteristics of the sequence family, for example highlighting sites vital to conformation or ligand binding.
A sequence alignment can be used to produce a profile hidden Markov model (profile HMM). Profile HMMs provide a formal probabilistic framework for sequence comparison [1–3], leveraging the information contained in a sequence alignment to improve detection of distantly related sequences [4, 5]. They are, for example, used in the annotation of both protein domains [6–9] and genomic sequence derived from ancient transposable element expansions .
Consider a family of related sequences, and an alignment of a subset of those sequences. For each column, we can think of the observed letters as having been sampled from the distribution, of letters at that position among all members of the sequence family. One approach to estimating for a column is to compute a maximum likelihood estimate directly from observed counts at that column. An alternative is to try to improve the estimate using sequence weighting (relative  and absolute ) and mixture Dirichlet priors [2, 13–15]. The later approach is used in computing position-specific letter distributions for profile HMMs [16, 17].
In an alignment, a subset of the columns will be consensus columns, in which most sequences are represented by a letter, rather than a gap character. In a typical profile HMM, a model position is created for each consensus column, and non-consensus columns are treated as insertions relative to model positions. As with letters, the per-position gap distributions may be estimated from observed or weighted counts, or combined with a Dirichlet prior.
A logo provides a compact graphical representation of an alignment, representing each column with a stack of letters. The total height of each stack corresponds to a measure of the invariance of the column – typically, it is the information content of that position. The height of each letter within a stack depends on the frequency of that letter at that position. Logos were originally devised to represent the extent of letter conservation in each column of an alignment [18, 19], and were later generalized to show letter and gap probabilities of a profile HMM .
Consider an alphabet A consisting of L letters, a1 through a L (L is 4 for DNA, and 20 for amino acids). For a given column in an alignment, we capture the estimated column distribution as a length-L vector , such that p i is the probability of observing letter a i at that column. We define the length-L vector to be the background distribution over letters in A, such that q i is the background probability of observing letter a i , typically based on letter frequency in a large set of representative sequences.
When the base of the log is 2, the information content is expressed in bits. This value indicates the extent to which a column’s distribution differs from the background , and serves as a measure of the conservation of the column. Information content is non-negative, largest when a column is invariant, and especially large when the invariant letter is rare in . For example, the maximum information content for one column in a DNA alignment under uniform background distribution is 2 bits. The maximum for an amino acid alignment under the background corresponding to the BLOSUM62 scoring matrix is roughly 6.5 bits – this for an invariant column of Tryptophan, which has the lowest background probability. Table 1 shows examples of information content values for a few DNA letter distributions, to give some insight into the complex relationship between information content and letter frequencies.
For a conventional logo, a stack’s height is spread among the letters in alphabet A based on , such that the height of each letter a i within a stack is . Letters are sorted such that those with larger p i appear near the top in the stack. An example is shown in Figure 1.
We present a software tool and associated web service, called Skylign, which offers several advantages over existing logo tools. It can generate both a static image file and a new interactive web plot that supports scrolling, zooming, and inspection of values underlying each letter stack. Skylign also produces a simplified representation of per-position gap probabilities, and optionally reduces visual clutter by including only overrepresented letters in a stack. Skylign’s interactive logos are robust and fast for alignments with length in the thousands, such as those representing many transposable element families.
An important implementation detail is that Skylign produces logos for both profile HMMs and multiple sequence alignments in a unified framework. Profile logos are plotted using the per-position distributions of the profile HMM. For alignment logos, the column distributions can be estimated either from observed counts, weighted counts, or based on posterior probabilities after combining with a Dirichlet mixture prior. Estimation based on weights and priors is performed by explicitly producing a profile HMM using the hmmbuild tool within HMMER3.1 .
In the following sections, we describe implementation details, compare alternative visualization approaches, and illustrate the utility of these logos. Skylign can be accessed as a web service at http://skylign.org, and the Skylign software package may be downloaded for independent installation.
Results and discussion
Several logo web servers have been released since the introduction of logos [20, 22–24], each with their own enhancements to logo presentation. In the course of developing websites for sequence homology search and annotation, we identified a need for interactive web-enabled logos that could efficiently render very long logos, and offer alternate letter height options, improved visualization of per-position gap parameters, and the ability to inspect underlying values. We developed Skylign to meet these needs.
Web-enabled interactive logos
Historically, all logo software has produced static images (e.g. png or vector graphics files). These are the appropriate formats for inclusion in manuscripts and slides, and may be produced with Skylign, but are suboptimal for distribution on the web. For website integration, Skylign implements interactive logos that support navigation to a requested position in the logo, scroll smoothly, and can be zoomed out for a compressed overview of several hundred positions of the logo. Because profile HMMs create positions only for consensus columns, and because a logo stack is defined only for non-empty alignment columns, not all columns in an alignment will be represented by a position in a profile logo; Skylign optionally shows the mapping between each logo position and the corresponding column in the underlying alignment. Skylign logos also support clicking on individual letter stacks to view the underlying values for all letters, as seen in Figure 2.
Skylign may be used in a variety of ways to create an image or interactive logo. The simplest option is to use the website submission form. Skylign also offers a web service via a RESTful interface , enabling scripted logo creation. Finally, the Skylign package may be downloaded for local installation. Instructions for all of these options are available at http://skylign.org.
Position-specific gap parameters
In addition to representing the letter distribution at each position, Skylign renders position-specific gap parameters. It does this by presenting up to three values for each position k:
Occupancy: the probability of observing a letter at position k. If we call this value, occ(k) the probability of observing a gap character (part of a deletion relative to the model) is 1 − occ(k).
Insert probability: the probability of observing one or more letters inserted between the letter corresponding to position k and the letter corresponding to position (k + 1).
Insert length: the expected length of an insertion following position k, if one is observed. For mathematical convenience, profile HMMs model insertions as having a geometric length distribution with position-specific parameter ϵ and mean length 1/(1 − ϵ).
The later two are only relevant for profile logos, since Skylign creates a logo position for each non-empty column in the alignment when producing an alignment logo.
The tool LogoMat  generalized alignment logos to present these gap parameters for profile HMMs. In LogoMat, occupancy is represented by varying the width of the letter stacks (the stack is thinner for positions with lower occupancy). The insertion probability and expected length are represented by placing variable-width two-toned columns between each letter stack, where the width of the darker part of the column corresponds to the insert rate and the width of the lighter part conflates expected length with insert rate. The result is that gap information is encoded by stretching the horizontal plane. As seen in Figure 3A, column width differences are difficult to discern. In Skylign, stack spacing is uniform, and these parameters are instead represented by up to three rows of numerical values placed below the letter stacks of the logo, with a heat map laid over the top of each value to provide a visual aid. See Figure 3B for an example. This approach – pulling gap information into a distinct section below the letter stacks – bears some similarity to the approach used in the SUPERFAMILY database , and simplifies visualization of gap parameters.
Unified framework for profile logos and alignment logos
Skylign can produce a profile logo based on a profile HMM, or an alignment logo based on a sequence alignment, both sharing the same interface. Generating a profile logo is a straightforward matter: a profile HMM stores estimated letter and gap parameters based on the underlying sequence alignment. Skylign simply extracts these values for use in computing stack heights, letter heights, and gap-related values. Alignment logos are more flexible, since Skylign offers four methods for computing estimated distributions from observed frequencies, demonstrated in Figure 4. For all methods, Skylign uses the hmmbuild tool from HMMER 3.1 to compute letter and gap values, with alternate option flags used for each method.
Logo height options
In the case of protein sequences, when observed counts are combined with a strong Dirichlet mixture prior, the posterior letter distribution often contains small but non-negligible probabilities for all 20 letters. This results in an illegible smear of letters at the bottom of the letter stack of the typical logo (Figure 5A). To address this, Skylign offers an alternate method of computing letter heights for a position, in which the only letters shown in each stack are those with above-background probability. Given the column letter distribution and the background distribution , the score of letter a i in that column is its log odds ratio, s i := log 2(p i /q i ). Letters with above-background probability will have a positive score. Total stack height is computed in the typical fashion (information content), and the height of the stack is subdivided according to the relative probabilities of the positive-scoring letters, as shown in Figure 5B. In the interactive web logo, clicking a column reveals a list of the probabilities of observing each letter at that position (both above- and below-background letters).
Skylign also offers an option to produce a different sort of logo in which the height of each letter is its score, s i . Only positive-scoring letters are included in the stack, as demonstrated in Figure 5C. We find this logo useful, for example, when inspecting per-position scores of an alignment of a sequence to a profile HMM. It is important to emphasize that the height of a score stack does not have any inherent meaning – it is simply the sum of all letter heights. In the interactive web logo, clicking a column reveals a list of scores for all letters of the alphabet, including those with negative scores.
Logos have long been used to visually represent the position-specific patterns of conservation in sequence alignments and profile HMMs. We developed Skylign with the aim of enabling interactive manipulation and inspection of logos, while offering a variety of logo variants for alignments and profiles. The result is a logo tool that supports scrolling, zooming, inspection of underlying values, and mapping between logo positions and alignment columns. Skylign simplifies the representation of gap parameters, offers alternate calculations to determine letter heights, and can overcome sampling bias by down-weighting redundant sequences and by combining observed counts with informed priors.
Skylign’s interactive logos are easily incorporated into a web page, and we have already used them in our HMMER and Dfam webservers, presenting logos for both protein and DNA profile HMMs [10, 27]. We anticipate that Skylign will be used to create logos, either in advance or on the fly, for other sites that present data related to multiple sequence alignments or profile HMMs.
Availability and requirements
Skylign can be accessed as a web server and web service, and may be downloaded for local use at http://skylign.org.
Krogh A, Brown M, Mian IS, Sjolander K, Haussler D: Hidden Markov models in computational biology. J Mol Biol. 1993, 235: 1501-1531.
Karplus K, Barrett C, Hughey R: Hidden Markov models for detecting remote protein homologies. Bioinformatics. 1998, 14: 846-856. 10.1093/bioinformatics/14.10.846.
Eddy SR: A probabilistic model of local sequence alignment that simplifies statistical significance estimation. PLoS Comput Biol. 2008, 4: e1000069-10.1371/journal.pcbi.1000069.
Eddy SR: Accelerated profile HMM searches. PLoS Comput Biol. 2011, 7: e1002195-10.1371/journal.pcbi.1002195.
Wheeler TJ, Eddy SR: nhmmer: DNA homology search with profile HMMs. Bioinformatics. 2013, 29: 2487-2489. 10.1093/bioinformatics/btt403.
de Lima Morais DA, Fang H, Rackham OJL, Wilson D, Pethica R, Chothia C, Gough J: SUPERFAMILY 1.75 including a domain-centric gene ontology method. Nucleic Acids Res. 2011, 39: D427-D434. 10.1093/nar/gkq1130.
Punta M, Coggill PC, Eberhardt RY, Mistry J, Tate J, Boursnell C, Pang N, Forslund K, Ceric G, Clements J, Heger A, Holm L, Sonnhammer ELL, Eddy SR, Bateman A, Finn RD: The Pfam protein families database. Nucleic Acids Res. 2011, 40: D290-D301.
Hunter S, Jones P, Mitchell A, Apweiler R, Attwood TK, Bateman A, Bernard T, Binns D, Bork P, Burge S, de Castro E, Coggill P, Corbett M, Das U, Daugherty L, Duquenne L, Finn RD, Fraser M, Gough J, Haft D, Hulo N, Kahn D, Kelly E, Letunic I, Lonsdale D, Lopez R, Madera M, Maslen J, McAnulla C, McDowall J, et al: InterPro in 2011: new developments in the family and domain prediction database. Nucleic Acids Res. 2012, 40: D306-D312. 10.1093/nar/gkr948.
Lees J, Yeats C, Perkins J, Sillitoe I, Rentzsch R, Dessailly BH, Orengo C: Gene3D: a domain-based resource for comparative genomics, functional annotation and protein network analysis. Nucleic Acids Res. 2012, 40: D465-D471. 10.1093/nar/gkr1181.
Wheeler TJ, Clements J, Eddy SR, Hubley R, Jones TA, Jurka J, Smit AFA, Finn RD: Dfam: a database of repetitive DNA based on profile hidden Markov models. Nucleic Acids Res. 2013, 41: D70-D82. 10.1093/nar/gks1265.
Henikoff S, Henikoff JG: Position-based sequence weights. J Mol Biol. 1994, 243: 574-578. 10.1016/0022-2836(94)90032-9.
Johnson S: Remote Protein Homology Detection Using Hidden Markov Models. PhD thesis. 2006, St. Louis: Washington University
Brown M, Hughey R, Krogh A, Mian IS, Sjolander K, Haussler D: Using Dirichlet mixture priors to derive hidden Markov models for protein families. Proceedings of the First International Conference on Intelligent Systems for Molecular Biology. 1993, 1: 47-55.
Sjolander K, Karplus K, Brown M, Hughey R, Krogh A, Mian IS, Haussler D: Dirichlet mixtures: a method for improved detection of weak but significant protein sequence homology. Bioinformatics. 1996, 12: 327-345. 10.1093/bioinformatics/12.4.327.
MacKay DJC: Information theory, inference, and learning algorithms. 2003, Cambridge: Cambridge Univ Press
Hughey R, Krogh A: SAM: Sequence alignment and modeling software system. 1995, Santa Cruz: University of California
Eddy SR, Wheeler TJ: HMMER User's Guide, version 3.1. 2013, http://hmmer.janelia.org/,
Schneider TD, Stormo GD, Gold L, Ehrenfeucht A: Information content of binding sites on nucleotide sequences. J Mol Biol. 1986, 188: 415-431. 10.1016/0022-2836(86)90165-8.
Schneider TD, Stephens RM: Sequence logos: a new way to display consensus sequences. Nucleic Acids Res. 1990, 18: 6097-6100. 10.1093/nar/18.20.6097.
Schuster-Böckler B, Schultz J, Rahmann S: HMM logos for visualization of protein families. BMC Bioinformatics. 2004, 5: 7-10.1186/1471-2105-5-7.
Kullback S, Leibler RA: On information and sufficiency. Ann Math Stat. 1951, 22: 79-86. 10.1214/aoms/1177729694.
Gorodkin J, Heyer LJ, Brunak S, Stormo GD: Displaying the information contents of structural RNA alignments: the structure logos. Comput Applic Biosci. 1997, 13: 583-586.
Crooks GE, Hon G, Chandonia JM, Brenner SE: WebLogo: a sequence logo generator. Genome Res. 2004, 14: 1188-1190. 10.1101/gr.849004.
Thomsen MCF, Nielsen M: Seq2Logo: a method for construction and visualization of amino acid binding motifs and sequence profiles including sequence weighting, pseudo counts and two-sided representation of amino acid enrichment and depletion. Nucleic Acids Res. 2012, 40: W281-W287. 10.1093/nar/gks469.
Fielding RT, Taylor RN: Principled design of the modern Web architecture. ACM Transactions on Internet Technology. 2002, 2: 115-150. 10.1145/514183.514185.
Gardner PP, Daub J, Tate J, Moore BL, Osuch IH, Griffiths-Jones S, Finn RD, Nawrocki EP, Kolbe DL, Eddy SR, Bateman A: Rfam: Wikipedia, clans and the “decimal” release. Nucleic Acids Res. 2010, 39: D141-D145.
Finn RD, Clements J, Eddy SR: HMMER web server: interactive sequence similarity searching. Nucleic Acids Res. 2011, 39: W29-W37. 10.1093/nar/gkr367.
Institutional support was provided by Howard Hughes Medical Institute Janelia Farm Research Campus. We thank the reviewers for their helpful comments, and Tom Jones and Sean Eddy for their insightful feedback during development of the software and manuscript.
The authors declare that they have no competing interests.
TJW and RDF motivated creation of interactive web logos with improved gap representation. JC developed the code for logo rendering and the web service. TJW implemented routines in HMMER to produce logo parameters and drafted the manuscript. All authors developed code interfacing the web front end with HMMER back end. All authors read and approved the final manuscript.
About this article
Cite this article
Wheeler, T.J., Clements, J. & Finn, R.D. Skylign: a tool for creating informative, interactive logos representing sequence alignments and profile hidden Markov models. BMC Bioinformatics 15, 7 (2014). https://doi.org/10.1186/1471-2105-15-7