# pGQL: A probabilistic graphical query language for gene expression time courses

- Ruben Schilling
^{1}Email author, - Ivan G Costa
^{2}and - Alexander Schliep
^{3}

**4**:9

**DOI: **10.1186/1756-0381-4-9

© Schilling et al; licensee BioMed Central Ltd. 2011

**Received: **12 April 2010

**Accepted: **18 April 2011

**Published: **18 April 2011

## Abstract

### Background

Timeboxes are graphical user interface widgets that were proposed to specify queries on time course data. As queries can be very easily defined, an exploratory analysis of time course data is greatly facilitated. While timeboxes are effective, they have no provisions for dealing with noisy data or data with fluctuations along the time axis, which is very common in many applications. In particular, this is true for the analysis of gene expression time courses, which are mostly derived from noisy microarray measurements at few unevenly sampled time points. From a data mining point of view the robust handling of data through a sound statistical model is of great importance.

### Results

We propose probabilistic timeboxes, which correspond to a specific class of Hidden Markov Models, that constitutes an established method in data mining. Since HMMs are a particular class of probabilistic graphical models we call our method Probabilistic Graphical Query Language. Its implementation was realized in the free software package pGQL. We evaluate its effectiveness in exploratory analysis on a yeast sporulation data set.

### Conclusions

We introduce a new approach to define dynamic, statistical queries on time course data. It supports an interactive exploration of reasonably large amounts of data and enables users without expert knowledge to specify fairly complex statistical models with ease. The expressivity of our approach is by its statistical nature greater and more robust with respect to amplitude and frequency fluctuation than the prior, deterministic timeboxes.

## Background

*querying*here as the evaluation of a set of conditions on time courses. The result of a query is a score for each time course that can be used to select a subset of time courses exposing behavior specified through the conditions. Among the characteristics of time courses is their variation in speed (cf. Figure 1d), i.e. delay of similar observations inducing uncertainty about exact time periods where measurements are expected to happen and phase shifts (c.f. Figure 1b). Generally, missing values, noise and outliers (cf. Figure 1c) can commonly be expected. In particular, gene expression time courses have only very few, unevenly sampled time points [3], in contrast to temporal data from other domains such as finance or multimedia. Intuitive software tools which support interactive formulation of query parameters by non-experts can foster wider and more flexible usage of time course data analysis tools by scientists and analysts in a range of disciplines. Yet an open research problem is finding a robust method to interactively query short time courses for specific qualitative and quantitative behavior.

Previously, timeboxes--specifying minimal and maximal values for a continuous range of time points--were proposed [4] to select time courses of interest. Timeboxes are rectangular, graphical user interface (GUI) widgets, that are embedded in a graphical time course data display. However the method is not robust to noise, temporal or amplitude variations (c.f. Figure 1) common in typical data sets and does not attempt to model them. We previously implemented a method called GQL for analyzing time course data that used graphical sliders to specify parameters of densities used in a HMM [5, 6]. The tool lacked however an intuitive relationship between the query parameters and the data.

We show that timeboxes have a natural interpretation as stochastic, piece-wise linear functions, or linear Hidden Markov Models (HMM) [7]. Their statistical interpretation allows for more flexible and meaningful queries, in particular in the context of analyzing biological data. We refer to our method as Probabilistic Graphical Query Language (pGQL), as HMMs are a specific class of (probabilistic) graphical models [8]. The visual query tool implementing our model allows users to define graphical model parameters; ranking time-courses by likelihood under that model and using a cut-off on the likelihood deter-mines the query result. Note that this is in contrast to the definition of query languages in the field of in-formation science, where graphical query languages are formal languages for querying graphs for graph-theoretical properties and/or attributes of nodes and edges. Although it is not possible to phrase all deterministic queries within pGQL, such as e.g. finding time courses whose values drop by 50% within a time interval or finding time courses for which there exists at least one time period, where they fluctuate by at most some quantity. However it is also not possible to phrase all probabilistic queries in a deterministic query system. The queries you can ask in pGQL are based on expected values and standard deviations. We demonstrate the effectiveness of probabilistic queries on a yeast sporulation data set using our implementation of the probabilistic time-boxes (pGQL). We discuss how our approach contrasts with deterministic timeboxes and identify impact our method has for practitioners.

## Results

### Algorithm

In the following we will refer to a set time courses as *O* = {*o*
_{
i
} }, 1 ≤ *i* ≤ *N*, where each time course
takes values
for times *t* ∈ {1, ..., *T*}.

#### Timeboxes

Let us start reviewing the definition of [4] for timeboxes and their queries formally:

A timebox *b*
_{
j
} is defined by the 4-tuple
, where
and
. For a given set of time courses *O* = {*o*
_{
i
} }, where 1 ≤ *i* ≤ *N*,
and *d* is the number of time points observed, a time courses *o*
_{
i
} satisfies a query *b*
_{
j
} only if
for
.

*x*

^{-},

*x*

^{+}] for all time points in the time frame . That is, for a given time-box and set of time courses

*O*= {

*o*

_{ i }}, where , a query is defined as

Naturally the query operation can be easily extended for multiple timeboxes {*b*
_{1}, ..., *b*
_{
j
} , *b*
_{
j+1}, ..., *b*
_{
q
} } where
holds ∀*j* ∈ [1, *q*]. In this case, a time course satisfies the query only if
, which is the intersection of individual queries: *Q*(*b*
_{1}, ..., *b*
_{
q
} ) = ∩ _{
j
}
*Q*(*b*
_{
j
} ).

#### HMMs and Probabilistic Timeboxes

A HMM can be seen as a probabilistic function of a Markov chain [9] and is fully determined through the specification of its states *S*, the probability of starting in *s*
_{
i
} , the transition probability *π*
_{
ij
} from state *s*
_{
i
} to *s*
_{
j
} and the emission densities see [7] for details on Hidden Markov Models.

As depicted in Figure 2b, we can allow values out-side of , as long as the overall values of a time course fit the timebox. This can be obtained by modeling the value range covered by a timebox with one uni-variate Normal, where the mean defines the mid point of the value range of the timebox and the standard deviation is proportional to a half of the height of the box.

Additionally, we also want to account for variation along the time axis, in particular time courses with phase-shifts (cf. Figure 1b) and difference in speed (cf. Figure 1d). This can be achieved by modeling the time frame as an expected duration of a timebox. Such probabilistic timeboxes define a state with an uni-variate normal density emission in a lHMM [2]. In this model, we also need to assign states for time frames where no timebox is defined, such as the regions in the left of Figure 2b. Specifying states in such frames substantiates the assumption about *when* we expect the user defined normal models to occur. These hidden boxes can be interpreted as waiting timeboxes, where any observation is equally likely to occur.

*λ*with an uni-variate normal density emission (see Figure 3B). This (

*k*th) state is parametrized by the triplet (

*p*

_{ k },

*μ*

_{ k },

*σ*

_{ k }), where

*p*

_{ k }is the self transition probability or expected duration, and

*N*(

*μ*

_{ k },

*σ*

_{ k }) is the state emission density. Given the (graphical) parameters of a timebox (c.f. Figure 3A), the state parameters can be defined as,

Note that the current choice of *σ*
_{
k
} places approximately 95.5% of the density mass in the interval
, and that
is the expected duration of the timebox. The latter defines *p*
_{
k
} , which obeys a geometrical distribution [10]. The relation between transition probability and duration is detailed in [7]. The idea is to consider the probability of staying *n* times in state *s*
_{
i
} , before you make a transition to *s*
_{
i+1}.

*p*

_{ l }, and a uniform distribution U(

*x*

_{ min },

*x*

_{ max }), where

*x*

_{ min }(and

*x*

_{ max }) are the minimum (and maximum) value in

*O*. For two consecutive timeboxes,

*j*and

*j*+ 1, where , we have

Time ranges before (and after) the first and last timeboxes *b*
_{1} and *b*
_{
q
} represent special cases. We also include a state emitting a uniform distribution in these ranges when
and
.

*m*, which defines how many time courses should be returned by the query. Intuitively, the query works by estimating the time course likelihoods (

**P**[

*o*

_{ i }|

*λ*]) using the Forward-algorithm [7], followed by the selection of the

*m*time courses with highest likelihoods. In particular setting

*m*to the number of time courses will return all time courses as query result and setting

*m*to 1 will return the time course with highest likelihood. More formally, given a full parametrized lHMM

*λ*defined by the timeboxes (

*b*

_{1}, ...,

*b*

_{ q }) and

*m*, the probabilistic query is defined as,

The main computational task behind the query is computing the log-likelihood of the time-courses for a given HMM. This has the computational complexity of *O*(*N ·* *K ·* *L*), where *N* is the number of time-courses, *K* the number of states (or time-boxes) and *L* the number of time points. Note that *K* and *L* are usually small (< 10) in this application, there-fore the running time only depends linearly on the number of samples *N*.

### Testing

#### Case Study - Yeast Sporulation

To show the usefulness of the probabilistic timeboxes in the analysis of gene expression, we perform a case study with the time courses of Yeast during sporulation [11] There, the expression values of approximately 6,200 genes have been measured through the course of seven time points (0 h, 0.5 h, 2 h, 5 h, 7 h, 9 h and 11 h). The biological process is formed by a cascade of transcriptional events, which can be subdivided in three main consecutive events: DNA replication, meiosis and spore maturation. We pre-processed the data, as described in [2], to discard time courses with a large number of missing values or with small temporal expression change, which resulted in a data set with 1,171 genes. In [11], authors hand selected seven groups of genes as prototypes of interesting expression patterns. For example, genes with an increase in expression in early, middle or late time points. The mean expression value of each group was taken, and a nearest neighbor approach based on the correlation coefficient was used to assign other genes to each of the expression patterns.

### Implementation

The software is implemented in Python and Tkinter using the GHMM library [5] and was tested on Linux and Mac OS X, but works on other modern operating systems including Windows as well. It is licensed under the GPL. The software is available from our web site http://algorithmics.molgen.mpg.de/Software/pGQL/.

The tool automatically inserts (and removes) hidden states into (from) regions, where the user has not (has) defined a PTB for a state corresponding to a normal emission density. These hidden states correspond to uniform emission densities. While drawing and editing PTBs consistency constraints are automatically checked and create a frame for specifying useful models. In particular pGQL checks, that users draw boxes with a minimum of 1.0 expected duration, since we do not assume any interpolation model on the discrete data. Users are also automatically guided to never produce overlapping states or states extending beyond the graph display. When-ever a query is graphically modified pGQL automatically recomputes the query and updates the result. It is possible to display PTBs on top of the time course data for query redefinition or below to inspect query results. pGQL also implements deterministic timebox queries to enable direct comparisons of the methods by switching between query types on the fly.

#### Functional Analysis

An important method for the biological analysis of a group of genes, as the one returned by a query, is the so called enrichment functional analysis [12]. This method uses databases with functional annotation of genes, such as Gene Ontology [13] to search for functional groups, whose genes are also within the query result. pGQL provides an out-link to the G: Profiler tool [12] to perform an enrichment functional analysis based on the current working query.

## Discussion

The PTB based graphical query approach enables users to phrase their hypotheses in a fashion many are already familiar with, i.e. defining normal distributions in the value domain and placing them as expected durations. Uncertainty is naturally incorporated in such models, while the user is not required to bother with the formalisms, but can simply use an interactive tool, that alleviates the usage of these models. The specificity of queries can easily be in-creased by adding more PTBs to a query. It would be interesting to combine pGQL with formal queries known from other field s to benefit from many deterministic queries as well. It is a future research problem how to translate such queries into one common graphical query interface. The only deterministic query pGQL currently provides is of the basic time box query type [4]. Although beyond the scope of the present article, it would be interesting to perform a full usability study of our tool in the future to conduct a user related performance evaluation as well.

The interpretation of query results from pGQL is straightforward: The result set will contain the *m* top ranking time courses, where obviously the highest scores will be assigned to time courses that lie centrally to the query. In contrast deterministic queries do not have a notion of rank as their scoring is binary.

We could in principle approximate the behavior of deterministic boxes by imposing peak like boxes on time periods. From a statistical point of view this is equivalent to overfitting the query model on the time dimension. Since the measurements will be taken in units of time, it generally doesn't make much sense from a modeling perspective to expect any measurement to last shorter than a a full time unit. Thus pGQL requires at least a unit of time for each timebox. This choice leads to query models, that are robust to time delays, since the self-transition probability in the HMM will not be forced to be infinitesimally small. If a user has a strong belief in values taking place in an exact, predefined time period he might get additional time courses returned from the query model, that exhibit similar behavior delayed in time. The ranking of time courses is one way to re ne the selection of such a result set: Time courses that adhere to the query during the exact time periods of the probabilistic boxes, should always be contained in the results, as they will be ranked highly by the query model.

Deterministic timeboxes could in principle be made approximate by requiring only a certain fraction of measurements to lie within a box. This shifts the problem to determining what this fraction really is. It is unclear how well this concept could capture common time course characteristics we mentioned in the Background section.

An example (again on the yeast sporulation data) demonstrating the robustness of the probabilistic queries is shown in Figure 2b: Despite of outliers on time points four and five the query result shows time courses displaying strongly similar behavior. The ex-act same graphical query in the deterministic setting shown in Figure 2a returns only a subset of the probabilistic query result, which is owed to the sensitivity to outliers. Moreover the result contains a few time courses, that do not seem to fit the overall trend specified by the query well. The latter is an artifact owed to the over fitting in time.

## Conclusions

Probabilistic timeboxes introduced new semantics to timeboxes proposed by [4]. Graphical queries are interactively created and manipulated by enabling users to draw, delete, move and resize any number of PTB's with respect to the incorporated constraints of this approach. This allows for easy and comfortable definition of meaningful, flexible queries even in complex data analysis scenarios. Probabilistic models, in particular in use for gene expression data, are known to be much more appropriate and flexible than their deterministic counter parts [2, 14–16]. The ease of the graphical definition encapsulates a sound method for query definition, requiring no in-depth knowledge of the underlying probabilistic methods to use this tool. We have demonstrated the method on a real world data set of yeast sporulation. This case study also revealed typical advantages our method has over deterministic methods. We contrasted the PTBs with the original timeboxes and shown how they cope better with many properties of gene expression time courses. pGQL can be of great help in finding interesting clusters in time course data.

A straight-forward extension to our method would be modeling cyclic data. All that is needed for this is to insert a transition from the end state to the start state and specify the transition probability favoring more or fewer cycles. Then we expect cyclic or periodic data to benefit from queries with probabilistic timeboxes just as well. GHMM supports cyclic queries already.

## Declarations

## Authors’ Affiliations

## References

- Bar-Joseph Z: Analyzing time series gene expression data. Bioinformatics. 2004, 20 (16): 2493-503. 10.1093/bioinformatics/bth283.View ArticlePubMedGoogle Scholar
- Schliep A, Costa IG, Steinhoff C, Schönhuth AA: Analyzing Gene Expression Time-Courses. IEEE/ACM Transactions on Computational Biology and Bioinformatics. 2005, 2 (3): 179-193. 10.1109/TCBB.2005.31.View ArticlePubMedGoogle Scholar
- Ernst J, Bar-Joseph Z: STEM: a tool for the analysis of short time series gene expression data. BMC Bioinformatics. 2006, 7: 191-10.1186/1471-2105-7-191. [http://www.biomedcentral.com/1471-2105/7/191]View ArticlePubMedPubMed CentralGoogle Scholar
- Hochheiser H, Shneiderman B: Dynamic query tools for time series data sets: Timebox widgets for interactive exploration. Information Visualization. 2004, 3: 1-18. 10.1057/palgrave.ivs.9500061.View ArticleGoogle Scholar
- Costa IG, Schönhuth A, Schliep A: The Graphical Query Language: a tool for analysis of gene expression time-courses. Bioinformatics. 2005, 21 (10): 2544-5. 10.1093/bioinformatics/bti311.View ArticlePubMedGoogle Scholar
- The Graphical Query Language (GQL). 2003, Accessed 13.4.2011, [http://ghmm.org/gql]
- Rabiner LR: A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition. Proceedings of the IEEE. 1989, 77 (2): 257-285. 10.1109/5.18626.View ArticleGoogle Scholar
- Jordan MI, (Ed): Learning in graphical models. 1999, Cambridge, MA, USA: MIT PressGoogle Scholar
- Schliep A, Schonhuth A, Steinhoff C: Using hidden Markov models to analyze gene expression time course data. Bioinformatics. 2003, 19 (suppl_1): i255-263.View ArticlePubMedGoogle Scholar
- Durbin R, Eddy S, Krogh A, Mitchison G: Biological Sequence Analysis: probabilistic models of proteins and nucleic acids. 1998, Cambridge PressView ArticleGoogle Scholar
- Chu S, DeRisi J, Eisen M, Mulholland J, Botstein D, Brown PO, Herskowitz I: The Transcriptional Program of Sporulation in Budding Yeast. Science. 1998, 282 (5389): 699-705.View ArticlePubMedGoogle Scholar
- Reimand J, Kull M, Peterson H, Hansen J, Vilo J: g: Profiler-a web-based toolset for functional profiling of gene lists from large-scale experiments. Nucleic Acids Res. 2007, W193-W200. 35 Web Server
- Ashburner M: Gene Ontology: tool for the unification of biology. Nature Genetics. 2000, 25: 25-29. 10.1038/75556.View ArticlePubMedPubMed CentralGoogle Scholar
- Bar-Joseph Z, Gerber GK, Gifford DK, Jaakkola TS, Simon I: Continuous representations of time-series gene expression data. J Comput Biol. 2003, 10 (3-4): 341-356. 10.1089/10665270360688057.View ArticlePubMedGoogle Scholar
- Ramoni MF, Sebastiani P, Kohane IS: Cluster analysis of gene expression dynamics. Proc Natl Acad Sci USA. 2002, 99 (14): 9121-9126. 10.1073/pnas.132656399.View ArticlePubMedPubMed CentralGoogle Scholar
- Yeung KY, Fraley C, Murua A, Raftery AE, Ruzzo WL: Model-based clustering and data transformations for gene expression data. Bioinformatics. 2001, 17 (10): 977-987. 10.1093/bioinformatics/17.10.977.View ArticlePubMedGoogle Scholar

## Copyright

This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.