Modelling and visualizing fine-scale linkage disequilibrium structure

Background Detailed study of genetic variation at the population level in humans and other species is now possible due to the availability of large sets of single nucleotide polymorphism data. Alleles at two or more loci are said to be in linkage disequilibrium (LD) when they are correlated or statistically dependent. Current efforts to understand the genetic basis of complex phenotypes are based on the existence of such associations, making study of the extent and distribution of linkage disequilibrium central to this endeavour. The objective of this paper is to develop methods to study fine-scale patterns of allelic association using probabilistic graphical models. Results An efficient, linear-time forward-backward algorithm is developed to estimate chromosome-wide LD models by optimizing a penalized likelihood criterion, and a convenient way to display these models is described. To illustrate the methods they are applied to data obtained by genotyping 8341 pigs. It is found that roughly 20% of the porcine genome exhibits complex LD patterns, forming islands of relatively high genetic diversity. Conclusions The proposed algorithm is efficient and makes it feasible to estimate and visualize chromosome-wide LD models on a routine basis.


Background
Alleles at two loci are said to be in linkage disequilibrium (LD) when they are correlated or statistically dependent. The term refers to the idea that in a large homogeneous population subject to random mating, recombination between two loci will cause any initial association between them to vanish over time. In observed data, however, non-zero allelic associations are pervasive, particularly at short distances, but also at long distances and even between chromosomes. These associations arise in a complex interplay between processes such as mutation, selection, genetic drift and population admixture, and are broken down by recombination. The patterns of association are of interest, partly because they underpin the relation of genotype to phenotype at the population level, and partly because they reflect population history.
Patterns of LD may be represented in different ways. A common method is to display pairwise measures of LD as triangular heatmaps [1,2]: in these displays, LD blocks (genomic intervals within which all loci are in high LD) stand out clearly. Early work in the HapMap project led http://www.biomedcentral.com/1471-2105/ 14/179 (1, 1, 1), (1, 2, 1), (2,1,1) and (1,2,2). Observe that in general s 1 and s 3 are marginally associated (are in LD), but in the subpopulations corresponding to s 2 = 1 and s 2 = 2 they are unassociated: in other words, they are conditionally independent given s 2 . More complex mutation histories give rise to more complex patterns of conditional independences that can be represented as graphical models [8].
Other authors have used graphical models for the joint distributions of allele frequencies. Usually, in highdimensional applications, attention is restricted to a tractable subclass, the decomposable graphical models [10]. In the first use of decomposable models in this context [11], models were selected using a greedy algorithm based on significance tests. In [8,12] methods and programs for selecting decomposable graphical models using Monte Carlo Markov Chain (MCMC) sampling were described. These methods are computationally feasible for modest numbers of markers (say, several hundreds), but not for modern SNP arrays with hundreds of thousands of SNPs per chromosome. To improve efficiency, the search space may be restricted to graphical models whose dependence graphs are interval graphs [13,14]. These are graphs for which each vertex may be associated with an interval of the real line such that two vertices are connected by an edge if and only if their intervals overlap. In this context the ordering of SNPs along the real line is their physical ordering along the chromosome. MCMC sampling from this model class may be performed more efficiently [13,14]. This work was extended in [15] to a more general subclass of decomposable models, namely those in which distant marker pairs (i.e., with more than a given number of intervening markers) are conditionally independent given the intervening markers.
In an alternative approach [16][17][18] latent mixtures of forests have been applied, in order to accommodate short-, medium-and long-range LD patterns. Also directed graphs (Bayesian networks) have been applied, selecting edges and their directions using causal discovery algorithms [19]. There are close links between decomposable models and Bayesian networks ( [10], Sect. 4.5.1).
A rather different approach to modelling the joint distribution of allele frequencies [20,21] is implemented in the software package BEAGLE [22], which is widely used to process data from SNP arrays. The approach is based on a class of models arising in the machine learning literature called acyclic probabilistic finite automata (APFA) [23]. These are related to time-variant variable length Markov chains. For phase estimation and imputation BEAGLE uses an iterative scheme analogous to the EM algorithm, alternating between sampling from a haplotype-level model given the observed genotype data (the E-step) and selecting a haplotype-level model given the samples (the M-step). A similar computational scheme for decomposable graphical models has been described and implemented in the FitGMLD program [15].
Characterization of genetic variation at the population level is of fundamental importance to understanding how phenotypes relate to genotypes. Some specific uses to which joint models for allele frequencies have been put include 1. Insight into the population history of different genomic intervals. Under simplifying assumptions, the ancestral history of a short genomic interval can be reconstructed from a decomposable graphical model for the SNPs in the interval [8]. 2. Quality control of genome assembly, in that some motifs may suggest errors in SNP positioning. 3. Phase estimation and imputation as described above [15,21]. 4. Derivation of more informative covariates involving multiple loci to plug into genomic prediction models [20]. 5. Use in pedigree simulation to model LD in founders, for example in connection with gene drop simulation [14] and assessment of SNP streak statistics [24].
In this paper decomposable graphical models are used to model fine-scale, local LD patterns. By local is meant that the proposed methods are designed to capture shortrange associations between loci, but not long range ones. The same is true of other approaches [13][14][15] mentioned above. Here, an efficient, linear-time algorithm is developed to select a model using a penalized likelihood criterion, and it is shown how such a model may conveniently be displayed, allowing fine-scale LD structure to be visualized.

Graphs and graphical models
The following notation and terminology is mainly based on [9]. A graph is defined as a pair G = (V , E), where V is a set of vertices or nodes and E is a set of edges. Each   duroc  1  4249  2863  4762  0  0  4340  0  0  35084  1153  37  37  15   duroc  2  4249  2113  3676  0  3  3339  2  2  18450  920  26  27  10   duroc  3  4249  1535  2873  1  13  2643  4  15  8695  679  20  20  8   duroc  4  4249  2211  4392  0  0  4012  0  0  24005  1007  35  36  11   duroc  5  4249  1255  2357  7  2  2166  8  2  6030  559  16  16  10   duroc  6  4249  1937  3358  0  0  3069  0  0  15396  778  24   The table shows the performance of the algorithms applied to the pig data. N and p denote the numbers of observations in the data and number of SNPs available after filtering. The edge sets found in steps 1 and 2 of the standard algorithm are denoted E s and E sp , respectively: for the fast algorithm they are denoted E f and E fp . The numbers of undershoots and overshoots, i.e. |E s \ E f | and |E f \ E s | for step 1, and |E sp \ E fp | and |E fp \ E sp | for step 2, are also shown. The corresponding running times in seconds are denoted t s , t f , t sp and t fp , respectively. The backward step is much faster than the forward step in both cases (t sp and t fp ). Overall, the fast algorithm is 23.4 times faster than the standard algorithm, and its inaccuracy, assessed as The last column shows the maximum width of G = (V, E s ). The computations were run under Redhat Fedora 10 Linux on a Intel i7 four-core 2.93GHz machine with 48 GB RAM.
edge is associated with a pair of nodes, its endpoints. Here only undirected graphs are considered, that is, with graphs undirected edges only. Two vertices α and β are said to be adjacent, written α ∼ β, if there is an edge between them. The neighbours of a vertex is the set of nodes that are adjacent to it. A subset A ⊆ V is complete if all vertex pairs in A are connected by an edge. A clique is a maximal complete subset, that is to say, a complete subset that is not contained in a larger complete subset.
A path (of length n) between vertices α and β in an undirected graph is a set of vertices α = α 0 , α 1 , . . . , α n = β where α i−1 ∼ α i for i = 1, . . . , n. If a path α = α 0 , α 1 , . . . , α n = β has α = β then the path is said to be a cycle of length n. If a cycle α = α 0 , α 1 , . . . , α n = α has adjacent elements α i ∼ α j with j ∈ {i − 1, i + 1} then it is said to have a chord. If it has no chords it is said to be chordless. A graph with no chordless cycles of length ≥ 4 is called triangulated or chordal.
A subset D ⊂ V in an undirected graph is said to sepa- The boundary bd(A) of a vertex set A ⊆ V is the set of vertices adjacent to a vertex in A but not in A, that is Let G = (V , E) be an undirected graph with cliques C 1 , . . . C k . Consider a joint density f () of the variables in V. If this admits a factorization of the form If all the densities in a model factorize according to G, then the model is said to be G-Markov. When this is true G encodes the conditional independence structure of the model, through the following result (the global Markov property): whenever sets A and B are separated by a set C in G, A and B are conditionally independent given C under the model. This is written as A ⊥ ⊥ B | C. A decomposable graphical model is one whose dependence graph is triangulated.

Selecting graphical models for chromosome-wide LD
Suppose that N observations of p SNPs from the same chromosome are sampled from some population. The variable set is written V = (v 1 , . . . v p ), and it is assumed that these are ordered by physical position on the chromosome. The variables may be either observed genotypes or inferred haplotypes, if these have been imputed: the former are trichotomous and the latter binary. Here an algorithm to use these data to select a graphical model for the distribution of V is described. It is based on a penalized likelihood criterion is the number of free parameters under G, and α is a penalization constant. For the AIC, α = 2 and for the BIC, α = log(N). The latter penalizes complex models more heavily and so selects simpler models. Under suitable regularity conditions, the BIC is consistent in the sense that for large N it will select the simplest model consistent with the data ( [25], Sect. 2.6). http://www.biomedcentral.com/1471-2105/14/179 A technical but nonetheless important point is that calculation of the correct model dimension is not straightforward for high-dimensional models, since not all parameters may be estimable. A simple expression exists however for the difference in model dimension between two decomposable models that differ by a single edge ( [10], pp. [37][38][39][40]. This is useful when the search space is restricted to decomposable models and the search algorithm only involves comparison of models differing by single edges (as here).
A forward-backward approach to estimate the graphical model for V is used. The first (forward) step is based on a greedy forward search algorithm. To take account of the physical ordering of the SNPs, the algorithm starts from a model G 0 = (V , E 0 ) where E 0 is the set of edges between physically adjacent SNPs: this model is called the skeleton. To seek the minimum BIC (or AIC) model, the algorithm repeatedly adds the edge associated with the greatest reduction in BIC (AIC): only edges whose inclusion results in a decomposable model are considered. The process continues until no more edges improve the criterion. The search space in this step is the class of decomposable models that include the skeleton. Note that this algorithm -as with almost all greedy algorithms -is not guaranteed to find the global optimum.
There are several advantages to initially constraining the search space to include the skeleton. An unconstrained search starting off from the null model (with no edges) would not take the physical ordering into account. Since the graphs considered are consistent with this ordering,  In (b), a corresponding plot of median entropy versus height is shown. The entropy was calculated for each interval of 7 adjacent SNPs using the phased data.
they are conveniently displayed as LD maps, as illustrated below. Because decomposable models contain no chordless cycles of length ≥ 4, two distal loci cannot be linked by an edge unless there are sufficiently many intermediate (chordal) edges to prevent the occurrence of such cycles. Thus the algorithm proceeds by filling out around the skeleton by incrementally adding edges. The effect of this is that only local LD is modelled. Since both association and (implicitly) proximity are required, the edges included are more likely to be for real (that is, less likely to be due to chance), so in this sense the model selection process is more reliable. In addition, restricting the search space in this way improves computational efficiency. The linear-time algorithm described in the following section also builds on the physical vertex ordering.
In the second (backward) step the graph found in the first step is pruned, again using a greedy algorithm that seeks to minimize the BIC (AIC) criterion by removing edges, without requiring that the skeletal edges are retained. Keeping these in the model would be appropriate if adjacent SNPs are in high LD, but this is not always the low complexity interval  It is seen that the interval shown in (a) has low haplotype diversity, dominated by a single common haplotype, whereas that shown in (b) has high haplotype diversity, with one or two relatively common haplotypes.
case. For example, there may be recombination hotspots, or genome assembly errors may have led to errors in positioning the SNPs. The graphs may be used to examine whether this has occurred. To display the resulting graph, a suitable graph layout is needed. After some experimentation, one such was obtained by modifying the horizontal dot layout in Rgraphviz [26], by exponentially smoothing the ycoordinates and replacing the x-coordinates with the SNP-number. In this way the y-coordinates are chosen so as to clarify the graphical structure: a consequence of this is that nodes with large absolute y-coordinates tend to signal genomic regions of high structural complexity. For some purposes it is helpful to use more objective measures of complexity, and two such measures are used here. Consider a chromosome with p SNPs. For each i = 1, . . . p−1, the height h i of the interval between SNPs i and i+1 is defined to be the number of edges of the form (j, k), where j ≤ i and i + 1 ≤ k, and the width w i is defined to be the maximum value of |k − j| of such edges. Note that by the global Markov property, when h i = 0 or equivalently As a measure of haplotype diversity, the entropy [27] is used here. Suppose that in some genomic interval there are k distinct haplotypes with relative frequencies f 1 , . . . f k . Then the entropy is defined as H = − i=1...k f i log f i . It is large when there are many distinct haplotypes that are equally frequent.
A useful way to display marker data over short genomic intervals is the sample tree [23]. This summarizes a set of discrete longitudinal data of the form A rooted tree is constructed in which the non-root nodes represent partial outcomes of the form (x 1 , . . . x k ) for k ≤ q present in the sample data. Edges may be coloured with the marker value and labelled with the corresponding sample counts, or drawn with width proportional to the sample counts.

A fast selection algorithm
For high-dimensional models, the first step of the algorithm described above can be computationally demanding. To address this a much faster algorithm for the same task is now described. This involves combining a series of overlapping marginal models of lower dimension. Call the block length (model dimension) L and the overlap K.
Thus the first block is . . v 2L−K } and so on. In the applications described here L = 100 and K = 20 are used. Suppose that the true model for V = (v 1 , . . . v p ) is G, and thatĜ is the estimate of G obtained by performing the first step of the algorithm described in the previous section. The goal is to construct an approximationG toĜ by combining modelsĜ i = (V i ,Ê i ) obtained by applying that same algorithm to blocks V i for i = 1, 2 . . . .
A way to construct a modelG 12 for V 1 ∪V 2 by combininĝ G 1 andĜ 2 is now described. Let m * = max{w : The rationale for this is that marginal models may include spurious associations on the boundaries. For example, let G 1 and G 2 be the subgraphs of G induced by V 1 and V 2 , respectively. Then the marginal distribution of V 2 will not in general be G 2 -Markov, but it will be G * 2 -Markov for a graph G * 2 derived from G 2 by completing the boundary of each connected component of G V \V 2 in G [28]. SoĜ 2 will tend to contain edges not in G 2 . To estimate the boundary of V 1 \V 2 in G,Ĝ 1 is used: the boundary is estimated to be contained in the set L − K + 1, . . . , m * . Hence by only including edges (v, w) ∈Ê 2 with w > m * edges in this boundary are omitted. Similarly, the boundary of V 2 \ V 1 in G 1 may contain spurious associations, soÊ 0 1 may contain unnecessary edges. To avoid this the overlap length K is chosen to be sufficiently large so that m * < min{v : ∃ (v, w) ∈ E 2 with w ≥ L + 1}. If the maximum width was known in advance this inequality could be ensured by setting K to be twice the maximum width, but so large a value appears to be unnecessary in practice.
The algorithm proceeds in the obvious fashion com-biningG 12 withĜ 3 and so on. Since the construction may result in chordless cycles it is necessary to triangulate the resulting graphG. This can be done using the maximum cardinality search algorithm [29] which can be implemented in linear time.
Assuming that the time for deriving the estimatesĜ i for fixed L is bounded, the algorithm described here is by construction linear in p. But the proportionality constant can http://www.biomedcentral.com/1471-2105/14/179 be expected to be depend on various factors, such as the density of the minimum AIC/BIC model.

Implementation
The methods are implemented in a set of R functions which are provided as Additional files 1 and 2 to the paper. The selection algorithms build on the forward search algorithm implemented in the stepw function in the gRapHD package [30]. Currently this function requires that there are no missing data. The backward search algorithm was developed by the author in the course of preparing this paper, and has subsequently been implemented in the gRapHD package. The functions to perform the selection algorithms, and others to work with and display the graphs, build on the following packages: igraph [31], graph [32], Rgraphviz [26] and gRapHD. The triangular heatmaps were produced using the LDheatmap package [33]. Simulation from a fitted decomposable model was carried out using the gRain package [34]. The package rJPSGCS provides an interface between R and the Fit-GMLD program which was used to perform the algorithm of [15].

Results
To illustrate the methods described above, they were applied to SNP data obtained from three commercial http://www.biomedcentral.com/1471-2105/14/179 pig breeds. In all 4239, 1979 and 2123 pigs of the Duroc, Landrace and Yorkshire breeds were genotyped using the Illumina Porcine SNP60 BeadChip [35]. After preprocessing on the basis of call rate, minimal allele frequency and other quality criteria, missing values were imputed using BEAGLE [22]. Using the methods described above, decomposable graphical models were selected for each chromosome and breed, using data at the genotype level. The BIC penalizing constant α = log(N) was used throughout. Figure 1 compares the running times of the two algorithms, and confirms that the fast algorithm is approximately linear in the number of SNPs. Table 1 gives more detailed information. It is seen that the estimateG is indeed a good approximation toĜ, and that the algorithm is considerably faster than the standard greedy algorithm. Figure 2 shows the LD graph for one chromosome (Duroc chromosome 1): the same graph is obtained with both algorithms. It is a long thin graph with 2863 nodes and 4340 edges. It has 32 connected components, of which 20 are isolated vertices -suggesting SNP positioning errors -and four are long intervals with 997, 569, 786 and 452 SNPs. Curiously, the subgraph induced by the last 35 SNPs contains 7 connected components, which suggests positioning errors in this region. The most striking feature of the graph is that for about 80% of the chromosome, a simple serial or near-serial association structure is found, but for the remaining 20% more complex patterns of LD are observed. Similar results are found for all chromosomes and breeds.
Genomic intervals with simple association structure tend to be associated with low haplotype diversity, and The table summarizes the inaccuracy of the fast selection algorithm applied to data sets simulated under two models for Duroc chromosome 1: the skeleton, and the more complex LD graph shown in Figure 2. The columns labelled undershoot and overshoot show |E \ E j | and |E j \ E|, where E and E j are the edge sets of the true model and the model found by the algorithm, respectively. For the data sets simulated under the skeleton, the edgewise false negative rate 1 10|E| j |E \ E j | is 0.029 and the false positive rate 1 10|E| j |E j \ E| is 0.00024. Under the more complex LD graph, the corresponding rates are 0.031 and 0.019. intervals with complex structure with high diversity (Figure 3). To further compare the low and high complexity regions, two representative intervals of the same length were selected: SNPs numbered 1800-1825 (low complexity), and SNPs numbered 2470-2495 (high complexity). These have sample entropies of 0.79 and 4.05, respectively. Their subgraphs are shown in Figure 4, and their sample trees in Figure 5. These show the low diversity of the low complexity interval, and the relatively high diversity of the high complexity interval. Corresponding triangular heatmaps are shown in Figures 6 and 7. The low complexity interval has high LD whereas the high complexity interval shows a more mosaic structure.
Thus low complexity regions tend to consist of series of haplotype blocks with high LD and low haplotype complexity, and may be dominated by a few common haplotypes. In contrast, regions of high complexity tend to have high haplotype diversity and little or no haplotype block structure. It must be stressed that the SNPs in such regions are not generally in linkage equilibrium: on the contrary, complex patterns of association, not marginal independences, are observed. Figure 2 and Table 1 show the results of applying the algorithms to unphased, genotype data, but as mentioned above they may also be applied to phased haplotype-level data. This implicitly regards the inferred haplotypes as a random sample of size 2N from an underlying population of haplotypes. Analyses based on inferred haplotypes may be subject to a loss of efficiency [36]. For the current data phase imputation was carried out using the BEAGLE software [22]: applying the fast algorithm to the phased data for Duroc chromosome 1 resulted in the graph shown in Figure 8. This is slightly denser than the graph in Figure 2, with 375 more edges. This may be ascribed to the reduced model dimension due to the use of binary rather than trichotomous variables, which leads to a weaker penalization of complex models in (1). Haplotype-and genotype-level graphical models are related but in general distinct: it has been shown that they are identical only when the haplotype-level graph is acyclic [37].
To assess the accuracy of the algorithm, twenty simulated data sets each with the same number of observations as the data sets analyzed above (N = 4239) were constructed. The first ten were generated by taking N random samples from the skeleton, that is, the graphical model with edges between physically adjacent SNPs only, fitted to the Duroc chromosome 1 genotype data. The second ten were generated by taking N random samples from the model shown in Figure 2, fitted to the same data. The results of applying the fast algorithm to each data set are summarized in Table 2. For the skeleton, the edgewise false negative rate was 0.029 and the edgewise false inclusion rate was 0.00024. For the model in Figure 2 the corresponding rates were 0.031 and 0.019. http://www.biomedcentral.com/1471-2105/ 14/179 To visually represent the latter results, Figure 9 shows a graph G = (V , ∪ j E j ), in which the edge colours represent the frequency that the edge was found in the 10 models. The graph suggests that model uncertainty is primarily restricted to the genomic intervals with complex dependence structure.
Finally, for comparison purposes the algorithm of [15] was applied to the Duroc chromosome 1 genotype data. This algorithm automatically imputes phase and missing marker data, cycling between imputation and model selection as sketched in the background section. The selected graph is shown in Figure 10. Like the graphs shown in Figures 2 and 8, it is long and stringy, but rather more dense. This greater density may be explained by the use in [15] of a Metropolis acceptance rule that is based on the penalized likelihood (1), but with a smaller penalizing constant α = (1/8) log(N). A detailed comparison of the two algorithms would be valuable but is not attempted here.

Discussion
This paper has introduced an efficient, linear-time forward-backward algorithm to estimate chromosomewide probabilistic graphical models of fine-scale linkage  Figure 9 The union of LD graphs for Duroc chromosome 1 derived from ten simulated data sets. The figure represents the results of applying the fast algorithm to ten data sets simulated under the LD graph shown in Figure 1. The union of the ten selected graphs is shown. Edges present in all ten graphs are black, and the colour of the others is interpolated between light blue (those found once) and blue (those found nine times).

Figure 10
Haplotype-level graph found using the algorithm of [15]. The figure shows the result of applying the algorithm of [15] to the same data set as used with Figure 2. The algorithm estimates a haplotype-level graph for the data. disequilibrium, and has described a convenient way to display these models. In illustration, the methods have been applied to data obtained from three commercial breeds of pigs using the Illumina Porcine SNP60 BeadChip. The forward part of the algorithm proceeds by combining a series of overlapping marginal decomposable models of dimension L and overlap length K. This implicitly assumes that the maximum width of the true graph is at most K. The resulting model is then triangulated and backward selection performed. The search space closely resembles that of [15], which samples from decomposable models with a given maximum width, using sliding windows. The difference in approaches lies primarily in the search method: here greedy search to optimize a penalized likelihood criterion is used, whereas in [15] MCMC sampling methods are applied.
The R function used for greedy forward search currently requires that the input data contain no missing values, so it was necessary to impute missing values prior to performing the algorithm, and the BEAGLE software [22] was used for this. This raises the possibility of circularity, or more precisely, that the model selection is influenced by constraints or assumptions implicit in the models used by BEAGLE. But given BEAGLE's high imputation accuracy with such data it seems unlikely that this plays an important role here. http://www.biomedcentral.com/1471-2105/14/179 The algorithm was found to have high accuracy when applied to simulated data sets of the dimensions considered here (N ∼ 4000; p ∼ 3000), with edgewise false positive and negative rates of around 3%. That it is good at reconstructing the model generating the data is reassuring. Needless to say, the algorithm does not necessarily identify the "true" model, which may not be in the search space. As noted previously, the approach captures short range associations, but not long range ones. Moreover, higher edgewise false negative rates may occur when observed data are used if there are infinitesimal departures from a model that are not detectable at the given sample size, as these are filtered out when data are simulated under a selected model.
A comparison of triangular heatmaps with LD graphs is instructive. The former are compact graphical representations of all pairwise marginal associations for a set of SNPs. They are particularly well-suited to identify LD blocks, which stand out as highlighted triangles. LD graphs supplement heatmaps by showing patterns of association but not their strength. Since they are parametric models they can be put to a number of quantitative uses as described in the background section. At one level, heatmaps and LD graphs convey similar information, since intervals with simple dependence structures tend to appear as series of LD blocks in the heatmap, whereas those with complex structures tend to occur in the interblock regions and have a more mosaic appearance. But the graphs provide a more incisive characterisation of genetic variation, building on the concept of conditional rather than marginal dependence. In this regard, it may be helpful to regard conditional independence statements as expressing the notion of irrelevance, in the sense that A ⊥ ⊥ B | C implies that if we know C, information about A is irrelevant for knowledge of B. Thus the graphs say something about connections between specific SNPs, for example about which SNPs are required to predict a specific SNP.
The graphs may also be useful in fine mapping. Genome-wide association studies seek to find the genetic basis of complex traits, typically using single locus methods -that is, by identifying SNPs with strong marginal association with the complex trait. Due to LD, many SNPs in a genomic region may exhibit strong association with the trait, making it hard to identify the causal loci. A way to address this is to assess the effect of a putative causal SNP on the complex trait in a linear model that also includes terms for the two flanking SNPs, in order to adjust for confounding with nearby effects due to LD. This implicitly assumes a simple serial dependence structure between the SNPs, and when the dependence structure is more complex such adjustment might be insufficient, leading to false positives. This may be prevented by including terms for the neighbours of the putative causal SNP, not just for the flanking SNPs. Any SNP is separated from the remaining SNPs by its neighbours, so by the global Markov property it is independent of the remaining SNPs given its neighbours. A similar method has been proposed based on Bayesian networks [38].
Like graphical models, the APFA models that underlie BEAGLE may be represented as graphs that encode a set of conditional independence relations, but in a very different way. In the present context, for example, nodes in APFA graphs represent haplotype clusters rather than SNPs. Where the model classes intersect, APFA graphs are much more complex than the corresponding dependence graphs, and so less amenable to visualization.
A striking feature of the LD graphs for the pig data was that for roughly 80% of the genome, simple serial or nearserial LD patterns were found, but for the remaining 20%, more complex patterns were observed. The regions with the simple serial structure tend to have low haplotype diversity, which is to be expected in livestock breeds with small effective population sizes [39]. Perhaps more unexpected is that roughly 20% of the porcine genome exhibits complex LD patterns, forming islands of relatively high genetic diversity. This information may be useful in an animal breeding context, to identify regions with high genetic variation. It will also be interesting to compare graphs obtained using different SNP densities in a given breed or species to examine whether and how their topologies change with varying marker densities.

Conclusions
The proposed algorithm is efficient and makes it feasible to estimate and visualize chromosome-wide LD models on a routine basis.