1 Introduction

Genetic interactions—or dependence of the fitness effect produced by a set of mutations on the genetic background—play an important role in determining evolutionary trajectories of populations. For instance, a set of individually beneficial mutations may exhibit diminishing returns: while the combined effect of all mutations is beneficial, it is not as beneficial as one would expect given the individual mutations, for example the sum of all single mutation effects. Diminishing returns have been shown to slow down the pace of adaptation (Chou et al. 2011). Similarly, the combined effect of a set of mutations can be stronger than the effect expected from the individual mutations. This so-called synergistic epistasis between deleterious mutations has been observed for instance in human populations, where it affects the distribution of deleterious alleles in the genome (Sohail et al. 2017). Genetic interactions can affect not just the magnitude of the effect of a mutation, but also the sign of the effect. That is, a particular mutation may have a beneficial effect in one genetic background and a deleterious effect in another. This type of interaction, often termed sign epistasis, can act to constrain evolutionary trajectories by requiring that some mutations occur before others (Gong et al. 2013; Kvitek and Sherlock 2011; Weinreich et al. 2005).

In this work, we are concerned with detecting the presence of genetic interactions from limited genotype-phenotype data. We understand an interaction as a deviation from a null linear model. For example, the two-way interaction is defined as a deviation from the null assumption that

$$\begin{aligned} w_{00} + w_{11} - w_{01} - w_{10} = 0, \end{aligned}$$

and the total three-way interaction as a deviation from the null assumption that

$$\begin{aligned} w_{000} + w_{011} + w_{101} + w_{110} - w_{001} - w_{010} - w_{100} - w_{111} = 0, \end{aligned}$$

where the binary indices correspond to biallelic genotypes (e.g. 00 is the wild type and 11 is the double mutant), and w denotes fitness (see Sect. 2 for detailed definitions). Empirical data sets produced in interaction studies typically provide replicate measurements of a trait, such as antibiotic or other forms of resistance, for various genotypes. The trait is often chosen to measure fitness, or approximations thereof, and used to infer genetic interactions in the fitness landscape. However, in many cases the association between the trait and fitness is unclear. For example, comparative fitness assays (or competition experiments) produce data uninformative with respect to the distribution of the absolute fitness values of genotypes. Furthermore, assuming only comparative genotype-phenotype data, one detects the sign but not the magnitude of the interactions. This makes standard statistical methods such as ANOVA or the multiple regression framework inapplicable.

Here, we make a conservative assumption that the only available information about fitness is the (partial) ranking of genotypes, that is, we assume that no precise fitness measurements of all genotypes are available, a frequent situation in practice, for example, due to measurement noise. Specifically, we assume either that some of the information in a total order of all fitness values must be discarded, or that the only signal available in the data is of the form “genotype \(g_1\) has higher fitness than genotype \(g_2\)”, for various pairs of genotypes. We assume that these pairwise fitness comparisons are consistent with each other, i.e., the relation they define is transitive. We call this type of data a partial fitness order, which is a partial order of genotypes with respect to their fitness. Data of this type arises for example by considering certain directed acyclic graphs where the vertices are given by genotypes and where the edges between genotypes are directed towards the genotype with higher fitness. Importantly, our assumptions make our methods widely applicable as the same techniques can be applied to other types of rankings and not just genotypes ranked with respect to their fitness. For example, a partial fitness order of genotypes can be obtained in studies that involve measuring various kinds of breeding values (see for example Habier et al. 2007) or other applications of generalised linear models.

Even though we assume that accurate fitness measurements cannot be accessed for all genotypes in a given genotype space, our methods still enable us to detect interactions implied by the partial fitness order. In particular, we are able to detect sign epistasis. Moreover, even when a complete fitness ranking of genotypes is available a method to detect interactions from a partial order alone might provide additional insight. Indeed, there are cases where the rank order method fails to reveal interactions even though interactions in the system can be detected from the actual fitness measurements (Crona et al. 2017). In this case, partial fitness order methods can be used to conclude diminishing returns or synergistic epistasis and refute sign epistasis. In addition, if one is only interested in certain fitness comparisons (for instance, comparisons between mutational neighbors), our methods yield a criterion to determine whether these comparisons are sufficient to imply interaction. These observations will have implications for the evolutionary trajectories of the system and provide insight as to the mechanism of the interaction (Weinreich et al. 2005). A detailed analysis of the class of linear orders that imply interactions, including relevant literature and data, can be found in (Crona et al. 2017).

In this paper, we build on the results obtained by Crona et al. (2017) and settle the most general case of ranking data, when only a partial fitness order is available. Specifically, we present a graph-theoretic characterization of the class of partial fitness orders that imply genetic interactions (Sect. 3), thus establishing the conjecture presented by Gavryushkin at the Interactions between Algebra and the Sciences conference held in Max Planck Institute for Mathematics in the Sciences, Leipzig, on 27 May 2017. Second, we use our characterization to derive a cubic time algorithm for testing the condition when a given partial order implies such an interaction (Sect. 3). This provides an exponential improvement of the best previously known method that involves iterating through the list of all possible linear extensions of the given partial order (Crona et al. 2017). Third, we count all partial orders for up to 8 labeled elements which imply an interaction (Sect. 4), and fourth, we provide a geometric interpretation of our characterization, useful for statistical analysis of partial fitness orders that imply genetic interactions (Sect. 5). Finally, we use public data sets to demonstrate our methods (Sect. 6) and conclude by describing possible future directions for this line of research (Sect. 7).

2 Technical introduction

In this section we introduce all necessary terminology and notations and describe a basic statistical approach to probabilistic inference of (higher-order) interactions from partial fitness orders, which further motivates our results on partial fitness orders.

Consider a system \(\mathcal G\) consisting of k genotypes, where k is a positive integer. We denote the fitness of a genotype \(g \in \mathcal G\) by \(w_g\), which is a real number. Typically, we take fitness to be a positive real number, though this does not affect our arguments. All fitness measurements \((w_g)_{g \in \mathcal G}\) together then determine what is called the fitness landscape associated to \(\mathcal G\). We refer to the tuple of all the fitness measurements defining a fitness landscape by \(W = (w_g)_{g \in \mathcal G}\).

We define genetic interactions using linear forms with integer coefficients in the following way. Let f be a linear form in variables W with integer coefficients which sum to 0, that is,

$$\begin{aligned} f(W) = \sum _{1 \le i \le t} c_i w_{p_i} - \sum _{1 \le j \le s} d_j w_{n_j}, \end{aligned}$$

such that

$$\begin{aligned} \sum _{1 \le i \le t} c_i - \sum _{1 \le j \le s} d_j = 0, \end{aligned}$$

where all \(c_i\), \(d_j\), t, and s are positive integer numbers such that \(t + s = k\) and \(\mathcal G= \{p_1, \ldots , p_t, n_1, \ldots , n_s\}\). We then say that the fitness landscape has positive f-interaction if \(f(W) > 0\). When \(f(W) < 0\), we say that has negative f-interaction. Hence f-interactions are a special case of what is known in applied statistics as contrasts. From now on, we will focus on determining positive f-interactions unless we explicitly state otherwise. Everything in this paper extends straightforwardly to the negative case. This definition of f-interaction generalizes several well-known and widely used notions of gene interaction, including Fourier–Walsh coefficients, interaction coordinates, and circuit interactions (Weinreich et al. 2013; Beerenwinkel et al. 2007). The detailed exposition including illustrative examples comparing all these approaches can be found in (Crona et al. 2017, Materials and methods).

Estimating the probability of f-interaction in an empirical setting amounts to quantifying the uncertainty of \(f(W) > 0\) given some comparative fitness data. Although in this setting the fitness values \(w_g\) are unavailable, the comparative fitness data typically allows to deduce a partial fitness order. For example, this type of data could arise from replicate measurements of any quantitative trait monotonic with respect to fitness. Another example of such data is fitness comparison data produced in competition or survival experiments, which are a popular method for fitness estimation.

Sometimes a partial fitness order is enough to deduce f-interactions and hence estimate the probability of interaction. We use the following definition to address such situations. We say that a partial fitness order \(\mathcal P= (\mathcal G, \prec )\) implies positive f-interaction if \(f(W) > 0\) whenever W satisfy the partial order \(\mathcal P\), that is, \(w_g < w_h\) for all \(g \prec h\).

Then the probability of f-interaction given comparative fitness data can be estimated by considering the probability support of all partial orders that imply f-interaction. However, such an estimation would require the condition of whether or not a partial order \(\mathcal P\) implies f-interaction to be checked routinely for different partial orders \(\mathcal P\). Hence the complexity of this condition might become a computational bottleneck in practice. In this paper we resolve this problem by designing an efficient polynomial-time algorithm for checking whether or not a partial order implies f-interaction.

We note that the fact that a partial order does not imply positive or negative f-interaction does not necessarily mean that the system does not have f-interaction. This situation therefore should be interpreted as the partial order being non-informative with respect to the f-interaction; the issue is discussed in more detail in (Crona et al. 2017).

We now review the results from (Crona et al. 2017) about how to detect whether a rank order implies f-interaction. In the terminology used in our paper, this situation corresponds to the case when the partial fitness order is a linear order (also called a total order or a rank order). We then study arbitrary partial orders, and present an efficient algorithm for determining when a partial order implies f-interaction.

For a linear form f as above, define a function \(\phi ^f\) from the set of (strict) linear orders on the set of genotypes to words over the alphabet \(\{P, N\}\) as follows. The linear order on k genotypes

$$\begin{aligned} g_1 \succ g_2 \succ \cdots \succ g_k \end{aligned}$$

is mapped to a word \(\omega \) consisting of \(c_i\) copies of P if \(w_{g_i}\) has a positive coefficient \(c_i\) in f; and \(d_i\) copies of N if \(w_{g_i}\) has a negative coefficient \(d_i\) in f. The subwords of \(\omega \) corresponding to different \(g_i\)’s appear according to the linear order (from highest to lowest). See (Crona et al. 2017) for various examples of this construction.

The following result from (Crona et al. 2017) depends upon the characterization of linear orders which imply interaction in terms of Dyck words.

Definition 1

Let \(\Sigma \) be an alphabet consisting of two letters P and N. A Dyck word is a word \(\omega \) consisting of an equal number of P’s and N’s such that every prefix of \(\omega \) contains at least as many P’s as N’s.

For example, PPNNPN and PNPNPN are Dyck words, but PPNNNP is not, since the prefix PPNNN contains more N’s than P’s. Clearly the definition of Dyck word does not depend on the choice of alphabet one considers. Dyck words arise in a number of contexts in discrete mathematics. For instance, they are in bijection with full binary trees with \(n+1\) leaves. If the symbols P and N are replaced with “(” and “)”, a string is a Dyck word only if all parenthesis are correctly matched. For more on Dyck words, see (Stanley 2001).

Theorem 1

(Crona et al. 2017) A linear order \(\mathcal P= (\mathcal G, \prec )\) on the set of genotypes implies positive f-interaction if and only if \(\phi ^f(\mathcal P)\) is a Dyck word that starts with P.

The statement of this theorem can equivalently be formulated by saying that a linear order \(\mathcal P\) implies positive f-interaction if and only if there exists a partition of the set of all genotypes \(\mathcal G\) into pairs \((p_i, n_j)\) such that \(p_i \succ n_j\) for all ij, where each \(p_i\) appears in \(c_i\) pairs and each \(n_j\) in \(d_j\) pairs (see Crona et al. 2017). As we will see in the next section, this formulation can be generalized to arbitrary partial orders. Note that here and also below we slightly abuse notation because for certain choices of \(c_i\)’s and \(d_j\)’s, we do not have a partition in the strict sense, but this technical difficulty can be avoided by, for example, distinguishing between the copies of \(p_i\) and \(n_j\).

3 Efficient method to infer interactions from partial orders

In this section we generalize Theorem 1 and characterize partial orders which imply f-interactions. We then apply our characterization to design an efficient algorithm for testing the condition of whether or not a partial order implies f-interaction.

Theorem 2

Let \(\mathcal G=(p_1, \ldots , p_{t}, n_1, \ldots , n_{s}) \) be a set of genotypes,

$$\begin{aligned} f(W) = \sum _{1 \le i \le t} c_i w_{p_i} - \sum _{1 \le j \le s} d_j w_{n_j} \end{aligned}$$

be a linear form, and \(\mathcal P= (\mathcal G, \prec )\) be a partial order on \(\mathcal G\). Then \(\mathcal P= (\mathcal G, \prec )\) implies positive f-interaction if and only if there exists a partition of the set of all genotypes \(\mathcal G\) into pairs \((p_i, n_j)\), \(p_i \succ n_j\) where each genotype \(p_i\) appears in exactly \(c_i\) pairs and each genotype \(n_j\) in exactly \(d_j\) pairs.

Before we proceed with the proof, let us illustrate Theorem 2 with the following example. Let

$$\begin{aligned} W = (w_{001}, w_{010}, w_{100}, w_{111}, w_{000}) \end{aligned}$$

and consider the linear form:

$$\begin{aligned} f(W) = w_{001} + w_{010} + w_{100} - w_{111} - 2w_{000}, \end{aligned}$$

which measures the deviation of the triple mutant’s fitness from its expectation based on single mutants only, and corresponds to one of the circuit interactions characterized in (Beerenwinkel et al. 2007). We see that there is positive f-interaction implied by the order of the fitness values if and only if for each fitness value with a positive coefficient in f, there is a strictly smaller fitness value with negative coefficient. This smaller fitness value must be unique, unless the absolute value of the coefficient is greater than one, as in this case for \(w_{000}\).


The “if” implication is clear, as

$$\begin{aligned} f(W)&= \sum _{1\le i\le t} c_i w_{p_i} - \sum _{1\le j\le s} d_j{w_{n_j}} = \sum _{\begin{array}{c} 1\le i\le t\\ 1\le j\le s \end{array}}\bigg (c_i w_{p_i} - d_j{w_{n_j}}\bigg ) \end{aligned}$$

and if there is a partition for the partial order \(\mathcal P\) as claimed and the indices ij are arranged according to the partition, each difference in the last sum is strictly greater than 0, thus \(f(W)>0\).

In order to prove the converse statement, we prove its contrapositive. That is, we prove that if there is no such partition of the set of all genotypes, f-interaction is not implied.

Construct the bipartite graph \(G=(\mathbf {P}\sqcup \mathbf {N}, E)\), where \(\mathbf {P}\) contains \(c_i\) copies of \(p_i\) for each i and \(\mathbf {N}\) contains \(d_j\) copies of \(n_j\) for each j, such that \((n_j, p_i) \in E\) whenever \(n_j \prec p_i\) in the partial order \(\mathcal P\). The number of elements in \(\mathbf {P}\) and \(\mathbf {N}\) coincide, since the coefficients of f sum to zero. Observe that a partition of the set of all genotypes \(\mathcal G\) into pairs \((n_j,p_i)\) such that \(n_j \prec p_i\) for all ij as in the theorem is exactly a perfect matching in G. By Hall’s theorem, there exists a perfect matching in G if and only if for each \(S \subseteq \mathbf {N}\), we have

$$\begin{aligned} |S| \le |N_G(S)|, \end{aligned}$$

where \(N_G(S)\subseteq \mathbf {P}\) is the set of vertices in G adjacent to a vertex in S (Diestel 2016). Suppose that there is no partition of the genotypes into pairs as above, and thus no perfect matching in G. Then there is some subset \(S \subseteq \mathbf {N}\) such that

$$\begin{aligned} |S| > |N_G(S)|. \end{aligned}$$

Using this subset S, we construct a linear extension of the partial order \(\mathcal P\) which does not map to a Dyck word under the map \(\phi ^f\), introduced above.

To do so, we first reindex \(\mathbf {N}\) so that

$$\begin{aligned} S = \{\underbrace{n_{1_1}, \ldots , n_{1_{e_1}}}_{e_1 \text { copies of } n_1}, \ldots , \underbrace{n_{j_1},\ldots , n_{j_{e_j}}}_{e_j \text { copies of } n_{j}}\} \end{aligned}$$

and the order \(n_1 \succ n_2 \succ \cdots \succ n_j\) is compatible with \(\mathcal P\). Note that \(d_1 \ge e_1 \ge 1, \ldots , d_j \ge e_j \ge 1\).

Let \(X_1 = \{x \in \mathbf {P} \sqcup \mathbf {N} \mid n_{1} \prec x\}\) be the set of elements in \(\mathbf {P} \sqcup \mathbf {N}\) ordered above \(n_{1}\). Note that \(X_1 \subseteq \mathbf {N} \sqcup N_G(S)\), since if \(n_{1} \prec x\) and \(x \in \mathbf {P}\), then by construction, \(x \in N_G(S)\). Consider a linear extension \(\mathcal L_1\) of the partial order \(\mathcal P\) on \(X_1\) given by \(x_1 \succeq \cdots \succeq x_k\). Extend \(\mathcal L_1\) with all duplicates \(n_{1_1}, \ldots , n_{1_{e_1}}\) of \(n_1\). That is, consider the linear extension \(\mathcal L_1'\) given by

$$\begin{aligned} x_1 \succeq \cdots \succeq x_k \succ n_{1_1} \succeq \cdots \succeq n_{1_{e_1}}. \end{aligned}$$

Now, we repeat this process with \(n_2\) and the rest of elements in S. Let \(X_2\) be the set of elements in \(\mathbf {P} \sqcup \mathbf {N}\) which are required by \(\mathcal P\) to be strictly greater than \(n_{2}\) but are not contained among the elements included in \(\mathcal L_1'\). Again, \(X_2 \subseteq \mathbf {N} \sqcup N_G(S)\). Extend the previous linear order \(\mathcal L_1'\) to \(\mathcal L_2'\) as follows, maintaining the property that \(\mathcal L_2'\) is compatible with \(\mathcal P\):

$$\begin{aligned} x_1\succeq \cdots \succeq x_k\succ n_{1_1} \succeq \cdots \succeq n_{1_{e_1}}\succeq x_{k+1} \succeq \cdots \succeq x_m \succ n_{2_1}\succeq \cdots \succeq n_{2_{e_2}}. \end{aligned}$$

We repeat this process for the rest of elements in S in the same way. To complete the construction, we observe that every remaining element (not included in \(S \cup X_1 \cup \ldots \cup X_j\)) is compatible with being smaller than all elements of \(S \cup X_1 \cup \ldots \cup X_j\). Hence, we can sort all remaining elements and add them at the end of the last linear order \(\mathcal L_j\) as smaller elements, to obtain a linear order \(\mathcal L\) which extends \(\mathcal P\).

The linear order \(\mathcal L\) does not map to a Dyck word (starting in P) under \(\phi ^f\), since the image of the smallest prefix of \(\mathcal L\) which contains all elements of S contains more N’s than P’s since \(|S| > |N_G(S)| \). Therefore, by Theorem 3 from (Crona et al. 2017), this partial order does not imply positive f-interaction. \(\square \)

A variant of Theorem 2 was independently obtained in (Crona and Luo 2017).

We now proceed by designing an efficient algorithm for detecting whether or not a partial fitness order \(\mathcal P\) implies f-interaction. Recall that \(f(W) = \sum _{1\le i\le t} c_i w_{p_i} - \sum _{1\le j\le s} d_j{w_{n_j}}\) and \(\sum _{1\le i\le t} c_i = \sum _{1\le j\le s} d_j\). In the next result, denote \(m=\sum _{1\le i\le t} c_i\).

Theorem 3

There exists an \(\mathcal O(m^3)\) algorithm to determine whether a partial order \(\mathcal P= (\mathcal G, \prec )\) implies positive f-interaction.


We use the notation introduced in the proof of Theorem 2. That theorem implies that a partial order implies that \(f(W) > 0\) if and only if there exists a partition of the set \(P' \cup N'\) into pairs \((p_i, n_j)\) such that \(p_i \succ n_j\). As noted in the proof of Theorem 2, this condition is equivalent to the existence of a perfect matching in the bipartite graph \(G=(\mathbf P, \mathbf N, E)\) such that \((n_j, p_i)\in E\) whenever \(p_i \succ n_j\). Thus, we can detect whether the poset implies \(f(W) > 0\) by checking whether there exists a perfect matching in G.

Using the Hopcroft–Karp algorithm (Hopcroft and Karp 1971), we can find a perfect matching in a bipartite graph with m vertices in time \(\mathcal O(m^{5/2})\). Assume we are presented the partially ordered set \(\mathcal P\) as a directed acyclic graph. Then we can construct the bipartite graph G in time \(\mathcal O(m^3)\) using the following algorithm: for each \(p\in \mathbf P\), use breadth first search to find all elements of \(\mathbf N\) which are reachable along a directed path from p, and add these to p’s list of neighbors. The worst-case complexity of this step is \(\mathcal O(m^2)\). Repeat this process for each of the m vertices to obtain a representation of G as an adjacency list—that is, as a list containing a list of neighboring vertices for each vertex. Thus, since we can construct the graph in \(\mathcal O(m^3)\) time and determine whether a matching exists in the graph in \(\mathcal O(m^{5/2})\) time, and \(m^3 > m^{5/2}\), we can determine whether the partial order determines the sign of a linear form in \(\mathcal O(m^3)\) time. \(\square \)

The complexity of our algorithm for computing whether a partial order on a set of genotypes implies f-interaction depends not just on the number of genotypes, but also on the coefficients of f. Specifically, the worst case complexity is a function not just of the number of genotypes, but also of the number of positive summands of f (with multiplicity) \(\sum _{1\le i\le t} c_i\). In most practical cases (circuits, interaction coordinates, etc.), however, this last number is small relative to the number of genotypes.

The two upper level steps of our algorithm are

  • constructing the bipartite graph and

  • detecting whether a perfect matching exists.

We think that the upper complexity bound \(\mathcal O(m^3)\) achieved in this paper can be improved. In particular, an appropriate choice of data structures can reduce the complexity of constructing the bipartite graph, which is the most demanding step in our algorithm. However, this improvement goes beyond the scope of this work, as we found the algorithm’s performance sufficient on typical data sets used in higher-order interaction studies (see Crona et al. 2017, for a survey of such data sets). See https://github.com/gavruskin/fitlands/tree/posets/posets.ipynb, where our implementation of the algorithm designed in Theorem 3 can be accessed.

Linear programming provides an alternate method to check whether a partial order implies interaction: checking whether a system is consistent with positive interaction amounts to checking that the feasible region of the linear program with constraints coming from the partial order and the constraint \(f >0\) is nonempty. In this case, the complexity of the computation will just depend on the number of genotypes, not on the coefficients, thus with large coefficients, linear programming is a more practical approach then the one presented here. However, by providing a purely combinatorial description of when a partial order implies interaction, our method may be more useful for studying classes of partial orders.

4 Counting partial orders that imply interaction

In this section, we determine the proportion of partial orders on \(k = 2\), 4, 6, and 8 genotypes that imply positive f-interaction for an arbitrary fixed linear form f with k coefficients 1 and \(-\,1\) which sum to 0. Our results are summarized in Table 1.

Table 1 For \(k\in \{2, 4, 6, 8\}\), the number of partial orders implying positive f-interaction, the number of partial orders not implying f-interaction, and the proportion of partial orders implying either positive or negative f-interaction, truncated to the second digit. Note that the number of partial orders implying negative f-interaction is, by symmetry, equal to the number of partial orders implying positive f-interaction. Hence, the proportion is obtained by dividing twice the number of partial orders implying positive interaction by the total number of partial orders

We carried out our computations in the open-source mathematics software system Sage (http://www.sagemath.org) using the source code available at https://github.com/gavruskin/fitlands/tree/posets/. To make the computations possible, we employed the automorphism groups (Stein et al. 2008) of our partial orders in the following way.

Definition 2

An automorphism of a partial order \(\mathcal P=(V, \prec )\) is a bijection \(\sigma : V\rightarrow V\) such that if \(u \prec v\), then \(\sigma (u) \prec \sigma (v)\). The set of automorphisms of a finite partial order forms a group, denoted by \(\mathrm {Aut}(\mathcal P)\), under the operation of composition.

In our enumeration, we observe that the number of different ways to label a poset with k elements is \(\frac{k!}{|\mathrm {Aut}(\mathcal P)|}\). To see this, take a labeling of the elements on the poset. A permutation of the labels is an automorphism if and only if it does not change the partial order. Thus, each relabeling of the poset elements falls into an equivalence class of \(|\mathrm {Aut}(\mathcal P)|\) relabelings that do not change the partial order. Thus, since there are k! ways to relabel the elements, there are \(\frac{k!}{|\mathrm {Aut}(\mathcal P)|}\) non-equivalent ways to label the poset.

As an example, consider the partial order

$$\begin{aligned} \mathcal P= (\{00,01,10,11\}, \{11 \succ 01, 11 \succ 10, 10 \succ 00, 01 \succ 00\}) \end{aligned}$$

with Hasse diagram depicted on the left of the following figure:

figure a

The relabeling to the Hasse diagram on the right yields the same partial order. Thus, this permutation switching 10 and 01 is an automorphism of the graph. However, any other permutation of the labels changes the partial order. Thus, this poset has an automorphism group of cardinality 2. Then since there are \(4! = 24\) ways to relabel the elements of \(\{00,01,10,11\}\), there are \(4!/2 = 12\) different labelings of this poset.

The implementation of our algorithm proceeds as follows: Using a built in function in Sage, we produced a list of partial orders on k elements up to isomorphism. Since whether a partial order implies f-interaction depends on the element labels, not just the structure of the partial order, we have to distinguish between different labeled partial orders within each partial order automorphism class. To achieve this, for each partial order (up to automorphism), we check for f-interaction with each partition of the labels used by Sage into two classes of equal size. We let one class correspond to elements with coefficient 1 and one class correspond to elements with coefficient \(-\,1\). Then each choice of partition corresponds to \(((k/2)!)^2\) possible reassignments of the labels, since we can permute the elements within the class with coefficient 1 and the class with coefficient \(-\,1\) without changing the partition. We compute the cardinality of the automorphism group for each partial order, and add \(\frac{1}{|\mathrm {Aut}(\mathcal P)|}\) to our count of partial orders that imply positive, negative, or no f-interaction respectively.

We note that as we increase k, the proportion of partial orders implying f-interaction decreases. The sums of the values we obtained for the number of partial orders implying positive f-interaction, the number of partial orders implying negative f-interaction, and the number of partial orders not implying any f-interaction appears in OEIS (The On-Line Encyclopedia of Integer Sequences 2017) as the number of partial orders on k labeled elements, as expected. However, none of the columns of our table appear in OEIS. Further, each number is either prime or has a prime factorization including fairly large primes. Thus, the number of partial orders, the number of partial orders implying f-interaction, and the number of partial orders not implying f-interaction do not appear to be given by any simple formula.

The final computation, for \(k=8\), took approximately two hours to complete on the SageMath Cloud server. The main factor affecting the performance of these computations is that the number of partial orders on k elements is super-exponential in the number of elements (The On-Line Encyclopedia of Integer Sequences 2017). Therefore, we did not count the number of partial orders on k elements which imply f-interaction for \(k\ge 10\). Since we can still quickly check whether individual partial orders on \(k \ge 10\) elements imply f-interaction, sampling methods can be used to estimate how the proportion of partial orders which imply interaction changes as we increase k.

Our computational observation that the fraction of partial orders which imply f-interaction approaches 0 as k increases is true in general:

Theorem 4

As k approaches infinity, the fraction of partial orders which imply f-interaction approaches zero.


Partition the set of partial orders on k elements into its isomorphism classes. We show that, within each isomorphism class, the proportion of partial orders implying positive f-interaction is bounded by \(\frac{4}{k}\) whenever f is a linear form with coefficients \(\pm 1\). Consider an arbitrary isomorphism class, and take an arbitrary labeled poset \(\mathcal P\) in this class. There are \(\frac{k!}{|\mathrm {Aut}(\mathcal P)|}\) distinct labeled posets in this isomorphism class. There are \(\frac{k!\cdot 2}{k/2+1}\le 4(k-1)!\) linear orders on k elements which imply positive f-interaction (Crona et al. 2017, Proposition 1). Now, take an arbitrary linear extension of \(\mathcal P\). Each permutation of labels which takes \(\mathcal P\) to a labeled poset which implies positive f-interaction must take this linear extension to one that implies interaction, thus there are at most \(4(k-1)!\) permutations of labels which take our labeled poset to one that implies f interaction. Further, all \(|\mathrm {Aut}(\mathcal P)|\) permutations of labels which give the same labeled poset must take our linear order to one that implies interaction. Thus, there are at most \(\frac{4(k-1)!}{|\mathrm {Aut}(\mathcal P)|}\) labeled posets in this isomorphism class that imply interaction. Thus, the proportion of posets in this isomorphism class that imply interaction is at most \(\frac{4}{k}\). \(\square \)

5 Geometric interpretation

In this section, we present a geometric interpretation of Theorem 2, and derive some geometric, combinatorial, and statistical results. We denote the space \(\mathbb R^{|\mathcal G|}\) where \(|\mathcal G|\) is the number of elements in \(\mathcal G\) simply by \(\mathbb R^\mathcal G\) and index the coordinate axes by the unknown fitness values \(w_g\)’s, where \(g \in \mathcal G\). When we assume fitness values to be nonnegative, we work in the positive orthants of \(\mathbb R^\mathcal G\), which we denote by \( \mathbb R^\mathcal G_{\ge 0}\). In this case, every point of \(\mathbb R^\mathcal G_{\ge 0}\) corresponds to a possible measurement of a fitness value for each genotype. When we do not assume fitness values to be nonnegative, every point in \(\mathbb R^\mathcal G\) corresponds to a fitness value for each genotype. The geometric interpretation of our results about partial orders uses the language of polyhedral cones.

Definition 3

A convex polyhedral cone in \(\mathbb R^k\) is a subset of \(\mathbb R^k\) cut out by a finite number of linear inequalities.

Like all cones, convex polyhedral cones are closed under the operations of taking nonnegative linear combinations of their elements. For the remainder of this paper, we will refer to convex polyhedral cones simply as cones. Let \(\mathcal P= (\mathcal G, \prec )\) be a partial order (which may be a total order). Then the set of points \(x \in \mathbb R^\mathcal G\) whose coordinate order satisfies \(\mathcal P\) defines a cone. To see this, note that this set of points is cut out by a finite number of linear inequalities defined by the partial order. Hence this set is a convex polyhedral cone by definition. We call a cone associated to a partial order in this way an order cone and denote it by \(C_\mathcal P\). Further, a linear form f in the variables \(w_g\)’s defines a hyperplane through the origin, where f takes the value 0. The linear form is positive in the half space on one side of this hyperplane and negative on the other. Let \(H_{f, +}\) be the half space on which f is positive, \(H_{f}\) be the hyperplane on which f is zero, and \(H_{f, -}\) be the half space on which f is negative. Then Theorem 2 has the following geometric interpretation. Recall that \(f(W) = \sum _{1\le i\le t} c_i w_{p_i} - \sum _{1\le j\le s} d_j{w_{n_j}}\) is a linear form with integer coefficients that sum to zero, that is \(\sum _{1\le i\le t} c_i = \sum _{1\le j\le s} d_j\).

Theorem 5

The cone \(C_{\mathcal P}\subset H_{f, +}\) if and only if there exists a partition of the set of all genotypes \(\mathcal G\) into pairs \((p_i, n_j)\) such that \(p_i \succ n_j\) for all ij, where each \(p_i\) appears in \(c_i\) pairs and each \(n_j\) in \(d_j\) pairs.


Note that \(\mathcal P\) implies positive f-interaction if and only if \(C_\mathcal P\subset H_{f, +}\). Then the claim follows from Theorem 2. \(\square \)

As a corollary of Theorem 5, we obtain the following result, which will be applied in our analysis of a Malaria data set in Sect. 6.

Definition 4

Let \(\mathcal P_1\) and \(\mathcal P_2\) be partial orders. Their intersection is the partial order \(\mathcal P_1 \cap \mathcal P_2\) such that \(x \prec _{\mathcal P_1\cap \mathcal P_2} y\) if and only if \(x \prec _{\mathcal P_1} y\) and \(x \prec _{\mathcal P_2} y\).

To illustrate the above definition consider the partial orders \(\mathcal P_1 = 00 \succ 10 \succ 01\) and \(\mathcal P_2 = 10 \succ 01 \succ 00\). Then \(\mathcal P_1 \cap \mathcal P_2\) is the partial order given by \(10 \succ 01\).

Corollary 1

Let \(\mathcal A\) and \(\mathcal B\) be linear orders such that \(C_{\mathcal A},C_{\mathcal B} \subset H_{f,+}\), then the order cone \(C_{\mathcal A \cap \mathcal B}\) of the intersection of \(\mathcal A\) and \(\mathcal B\) is contained in \(H_{f,+}\) if and only if \(\mathcal A \cap \mathcal B= (\mathcal G, \prec )\) satisfies the condition in Theorem 5.


Immediately follows from Theorem 5. \(\square \)

Now, we prove the following theorem which is important for statistical analysis of interactions from fitness comparison data, for example, in the analysis of a sample from the probability distribution over the space of partial fitness orders with the aim to quantify the uncertainty of interactions. Specifically, we show the following. If two uncertain fitness measurements give distinct linear orders \(\mathcal A\) and \(\mathcal B\) both of which imply positive f-interaction, then there exist fitness measurements corresponding to a sequence of linear orders which are intermediate between \(\mathcal A\) and \(\mathcal B\) in the sense that every linear order in this sequence is different from its predecessor by just one transposition of a pair of adjacent elements, and no linear order in the sequence implies negative f-interaction.

Theorem 6

Let \(U\subset \mathbb R^k\) be a path connected, open set which has a nonempty intersection with the cones \(C_{\mathcal A}\) and \(C_{\mathcal B}\), where \(\mathcal A\) and \(\mathcal B\) are linear orders on k elements. Then there exist linear orders \(\mathcal L_1 = \mathcal A, \ldots , \mathcal L_n = \mathcal B\) such that \(\mathcal L_i\) and \(\mathcal L_{i+1}\) differ by one adjacent transposition and \(U \cap C_{\mathcal L_i} \ne \varnothing \) for each \(1 \le i < n\).


We denote cones \(C_{\mathcal L_i}\) by simply \(C_i\), for all i, throughout the proof. Note that the cones \(C_i\) and \(C_j\) have a \((k-1)\)-dimensional face as their intersection if and only if \(\mathcal L_i\) and \(\mathcal L_j\) differ by a single adjacent transposition. Further, note that any path which passes from \(C_i\) to \(C_j\) without passing through the interior of any other cone must pass through the intersection of the boundaries of \(C_i\) and \(C_j\). Either this boundary is an \((k-1)\)-dimensional face, and \(\mathcal L_i\) and \(\mathcal L_j\) differ by an adjacent transposition, or we pass through a lower dimensional face. In the latter case, this means a neighborhood of the point where we pass through the boundary contains all cones that intersect at this point. Thus, a neighborhood of this point contains a sequence of order cones of linear orders which differ by one adjacent transposition each.

Now, consider a path from a point in \(U\cap C_{\mathcal A}\) to a point in \(U\cap C_{\mathcal B}\). Since U is open and path connected, it contains some path of this form, as well as a neighborhood around the path. Consider the sequence of cones this path passes through—by the observation above, we know that if the path passes from \(C_i\) to \(C_j\), either \(\mathcal L_i\) and \(\mathcal L_j\) differ by an adjacent transposition, or a neighborhood of the point where we pass from \(C_i\) to \(C_j\) intersects the cones of a sequence of linear orders which differ by one adjacent transposition each. Thus, in either case, a path from \(C_\mathcal A\) to \(C_\mathcal B\) has a neighborhood that intersects the order cones of a sequence of linear orders \(\mathcal L_1, \ldots , \mathcal L_n\) such that \(\mathcal L_1 = \mathcal A\), \(\mathcal L_n = \mathcal B\), and \(\mathcal L_i\) and \(\mathcal L_{i+1}\) differ by one adjacent transposition for each \(1 \le i < n\). These linear orders satisfy the claim of the theorem. \(\square \)

We illustrate Theorem 6 in Fig. 1, where we depicted six regions corresponding to six slices of order cones in \(\mathbb R^3_{\ge 0}\). Each cone is associated to a linear order of three elements, \(x=w_{g_i},y=w_{g_j},z=w_{g_k}\). Points inside the cones correspond to different fitness values satisfying the linear order defining the given cone. Thus, for example a point inside \(C_{x>y>z}\) specifies three fitness values associated to three genotypes \(g_i,g_j,g_k \in \mathcal G\) and such that \(w_{g_i}>w_{g_j}>w_{g_k}\).

Fig. 1
figure 1

We show a slice of \(\mathbb R^3_{\ge 0}\), demonstrating that \(\mathbb R^3_{\ge 0}\) is divided into six cones corresponding to the six possible orders of the elements xyz. The convex hull of a ball in the order cone \(C_{z>y>x}\) and a ball in the order cone \(C_{y>x>z}\) passes through the order cone \(C_{y>z>x}\). Note that the order \(y>z>x\) differs by one adjacent transposition from both \(z>y>x\) and \(y>x>z\)

As a corollary to Theorem 6, we obtain the following result.

Corollary 2

Suppose \(\mathcal A\) and \(\mathcal B\) are linear orders which imply positive f-interaction. Then there exists a sequence of linear orders \(\mathcal L_1 = \mathcal A, \ldots , \mathcal L_k = \mathcal B\) such that \(\mathcal L_i\) and \(\mathcal L_{i+1}\) for \(1 \le i < n\) all differ by one adjacent transposition and no \(\mathcal L_i\) implies negative f-interaction.


The half-space \(H_{f, +}\) is a connected open set which has a nonempty intersection with \(C_\mathcal A\) and \(C_\mathcal B\). Thus, this result follows from Theorem 5. \(\square \)

Spaces with complicated geometries and combinatorics are known to cause significant difficulties for statistical analysis (Billera et al. 2001). For example, the space of trees, which is a particular instance of the space of partial orders, required deep mathematical advances to understand basic statistics, such as confidence regions and convex hulls, over the space (Billera et al. 2001; Gavryushkin and Drummond 2016). Advances in the geometry and combinatorics of such spaces are the stepping stone for efficient statistical methods such as Markov Chain Monte Carlo (Gavryushkin et al. 2017; Dinh et al. 2017). In a similar vein, we expect that the approach of this section allows to efficiently study probability distributions over the space of partial fitness orders. Hence our results provide a theoretical foundation for statistical analysis of partial fitness orders.

6 Applications

In this section we illustrate how our results can be used in fitness-based genetic interactions studies.

Malaria As a first application, we consider the following three linear fitness orders inferred and analyzed by Ogbunugafor and Hartl (2016) (see also Crona et al. 2017). These fitness orders have been obtained by measuring the growth rate of the parasite Plasmodium vivax exposed to various concentrations of the antimalarial drug pyrimethamine.

$$\begin{aligned}&\mathcal L_1: \,111 \succ 011 \succ 001 \succ 101 \succ 010 \succ 100 \succ 110 \succ 000\\&\mathcal L_2: \,111 \succ 011 \succ 001 \succ 010 \succ 100 \succ 101 \succ 110 \succ 000\\&\mathcal L_3: \,111 \succ 011 \succ 010 \succ 001 \succ 100 \succ 110 \succ 101 \succ 000 \end{aligned}$$

As noted in (Crona et al. 2017), each of these linear orders implies negative total 3-way interaction, which in our terms is f-interaction where

$$\begin{aligned} f(W) = w_{000} + w_{011} + w_{101} + w_{110} - w_{001} - w_{010} - w_{100} - w_{111}. \end{aligned}$$

We now strengthen this conclusion using the approach developed in this paper. To do so, we consider only the shared rankings of the genotypes across different drug concentrations, that is, the partial fitness order \(\mathcal P\) obtained by taking the intersection \(\mathcal L_1 \cap \mathcal L_2 \cap \mathcal L_3\). This intersection has the following Hasse diagram:

figure b

We then apply Theorem 2 and conclude that the obtained partial order \(\mathcal P\) implies negative f-interaction. Indeed, the three bottom genotypes with even number of ones (depicted in bold) can be matched to the three genotypes with even number of ones above them, and matching 011 to 111 completes the construction of a perfect matching in this graph.

This means that even if the only comparisons we are confident about are those that agree across the three drug concentrations, we can still conclude that this system exhibits negative total 3-way interaction. In particular, this approach shows that we can ignore the inconsistency of the three rank orders associated to the three different drug concentrations under inspection. Hence any tuple of fitness values W which satisfies every fitness comparison found in each linear order will imply interaction. Further, in this case our results from Sect. 5 imply that any point in the convex hull of the points we have measured will imply negative 3-way interaction. This region allows to incorporate the uncertainties of the measurements and provides a region within which those measurements can vary without breaking the conclusion of interaction.

Moreover, in this situation we observe that \(\mathcal L_2\) can be obtained from \(\mathcal L_1\) by two permutations (see Corollary 2), with the intermediate liner order also implying negative total 3-way interaction:

$$\begin{aligned}&\mathcal L_1: \,111 \succ 011 \succ 001 \succ 101 \succ 010 \succ 100 \succ 110 \succ 000\\&\mathcal L_i: \,111 \succ 011 \succ 001 \succ 010 \succ 101 \succ 100 \succ 110 \succ 000\\&\mathcal L_2: \,111 \succ 011 \succ 001 \succ 010 \succ 100 \succ 101 \succ 110 \succ 000\\ \end{aligned}$$

The exact same argument applies to \(L_2\) and \(L_3\). In general, intermediate linear orders of this type are examples of sequences of linear orders between two given linear orders as described in Corollary 2. These intermediate linear orders, \(\mathcal L_i\), can then be used to suggest further fitness comparisons to be tested to validated the conclusion of negative f-interaction in this data set.

To conclude this section we also observe that unlike the intersection \(\mathcal L_1 \cap \mathcal L_2 \cap \mathcal L_3\) of the three linear orders given above, the intersection of multiple linear orders, each implying f-interaction, does not necessarily imply f-interaction. To illustrate this situation, consider for example the following linear orders:

$$\begin{aligned}&\mathcal L_4: \,111 \succ 011 \succ 001 \succ 101 \succ 010 \succ 100 \succ 110 \succ 000\\&\mathcal L_5: \,111 \succ 011 \succ 010 \succ 101 \succ 001 \succ 100 \succ 110 \succ 000 \end{aligned}$$

Both linear orders \(L_4\) and \(L_5\) imply negative total 3-way interaction, as each linear order maps to the Dyck word NPNPNNPP. However, the partial order \(\mathcal L_4 \cap \mathcal L_5 = 111 \succ 011 \succ 001, 010, 101 \succ 100 \succ 110 \succ 000\) does not imply total 3-way interaction, since there is no perfect matching and \(\mathcal L_4 \cap \mathcal L_5\) extends to the following linear order:

$$\begin{aligned} \mathcal L_6: \,111 \succ 011 \succ 101 \succ 010 \succ 001 \succ 100 \succ 110 \succ 000, \end{aligned}$$

which maps to a non-Dyck word NPPNNNPP. This examples thus shows that the property “implies f-interaction” is not closed under the operation of order intersection and illustrates Corollary 1.

TEM \(\beta \)-lactamase As a second application, we consider the data produced in the antibiotic resistance study of the TEM-family of \(\beta \)-lactamase (Mira et al. 2015). In the table below we display the average growth rates of 16 genotypes grown in the antibiotic AMP in 12 replicates. The 16 genotypes include the wild type and all combinations of amino acid substitutions in TEM-50.

By using these growth rate as a measure of fitness, we deduce that this system has positive total 4-way interaction by directly computing:

$$\begin{aligned} f(W) =\,&w_{0000} + w_{0011} + w_{0101} + w_{0110} + w_{1001} + w_{1010} + w_{1100} + w_{1111} \\&-(w_{0001} + w_{0010} + w_{0100} + w_{1000} + w_{0111} + w_{1011} + w_{1101} + w_{1110}) \end{aligned}$$

and noting that \(f(W) > 0\) for the values in Table 2.

In the following, we demonstrate how our approach can be used to analyze the uncertainty of the conclusion that the system has positive total 4-way interaction. We start by ranking the genotypes according to their growth rates. This yields the linear order described in the following table (see Table 5 in Mira et al. (2015)):

Table 2 Average growth rates of the 16 genotypes grown in the antibiotic AMP
Table 3 Ranking of the 16 genotypes grown in the antibiotic AMP according to their average growth rates listed in Table 2

In the following we assume that the average growth rates of these 16 genotypes vary but that they always preserve the ranking listed in Table 3. This assumption implies that the average growth rates map to the word

$$\begin{aligned} \omega =PPNPPPNPNNPNNNPN \end{aligned}$$

according to the mapping described in Sect. 2. Reading \(\omega \) from left to right, we notice that \(\omega \) is a Dyck word. Hence, Theorem 1 can be used to confirm that the system has positive interaction. However, comparing the ranking and the average growth rates yields the following observation. The difference between the average growth rates assigned to the genotypes 0101, 1100, and 1001 as well as to the pairs of genotypes 0110, 0100 and 1110, 1011 is smaller comparing to the differences between all other average growth rates assigned to the remaining genotypes. See Fig. 2 for a visual summary of this observation.

Fig. 2
figure 2

Average growth rates of 16 genotypes grown in the antibiotic AMP

These small differences in the growth rates highlight the difficulty of finding accurate and robust linear orders among the genotypes.

In contrast, the partial order approach, developed in this work, confirms again that the system has positive total 4-way interaction using fewer and more pronounced comparisons. To illustrate this point, we follow the notations from Theorem 2 and consider the following 8 genotypes \(p_i\)’s and 8 genotypes \(n_j\)’s as in Table 4. The linear form f(W) is as above.

Table 4 Perfect matching of genotypes obtained from the partial fitness order according to the average growth rate

The rows in Table 4 indicate a perfect matching among the two sets of genotypes. Thus, for example the first row indicates that the average growth rates associated to 1101 and 1111 are such that \(w_{1101}>w_{1111}\). Similarly, for the other rows. From these 8 comparisons of the type \(w_{p_i}>w_{n_j}\) alone, one deduces that the system has positive total 4-way interaction. Moreover, comparing with the actual average growth rates from Table 2 one can observe that the 8 differences \(w_{p_i}- w_{n_j}\) (see third column in Table 4) are bigger than the differences between the averages growth rates of the critical genotypes mentioned above. Since these differences are more significant, they provide a more reliable conclusion in the empirical setting. Finally, notice that any other perfect matching between the 16 genotypes satisfying \(w_{p_i}>w_{n_j}\) would equally well yield to the same conclusion. In summary, an advantage of the partial order approach is that it relies on fewer pairwise inequalities, which makes the approach more practical.

7 Discussion and future directions

Understand genetic interactions from fitness measurements associated to genotypes represents a major challenge in evolutionary biology. In this work, we have focused on the case where only fitness comparisons between certain genotypes are available. This is a common assumption in practice, as there might be more uncertainty or cost involved in deducing some fitness measurements than others. Furthermore, this approach allows to exclude the measurements that have high uncertainty.

In this setting, we present a new algorithm to detect genetic interactions from partial fitness orders in an efficient way. Moreover, we derive a geometric characterization of the class of partial orders that imply interactions. This description, involving the geometry of convex polyhedral cones, provides a solid framework to develop statistical analysis of genetic interactions from partial fitness data.

Our work inspires a number of questions which remain open. First, while we are able to characterize the set of partial orders which imply interaction, our characterization is in terms of a matching in a separate graph which we can construct from our partial order. Thus, it is not immediately clear how to relate properties of a partial order to the probability that this partial order implies interaction. For instance, how does the number and type of incomparable pairs in linear orders affect whether an interaction is implied or not?

Second, it is important to point out that fitness measurements may produce relations which do not necessarily satisfy the transitivity assumption, see the work of (Kerr et al. 2002) were non-transitive pairwise comparisons were studied in certain microbial communities. This limitation and its implications in the theory of fitness landscapes is an important issue that will be explored in further research.