BACKGROUND
clustering and biological data
the first step in the analysis of many biological data sets is the detection of mutually similar subgroups of samples by clustering.
there are a number of aspects of modern, high-throughput biological data sets which make clustering challenging: the data is often high-dimensional and only a subset of the features can be expected to be informative for the purpose of an analysis.
also, the values of the data points may be distorted by noise and the data set contains a non-negligible number of missing values.
in addition, many biological data sets will include outliers due to experimental artifacts.
finally, the data set might incorporate multiple sources of data from different domains , where the relative relevance for the biological question to be addressed, as well as potential dependencies between the different sources are unknown.
in particular, the latter can lead to a clustering which captures regularities not relevant to the specific biological context under consideration.
reflecting its importance in exploratory data analysis, there is a multitude of clustering methods described in the literature .
clustering methods can be divided in two major groups: hierarchical and partitional methods.
hierarchical methods, which transform a distance matrix into a dendogram, have been widely used in bioinformatics, for example in the early gene expression literature, partly due to the appealing visualization of the dendograms  <cit> .
partitional methods are based on dividing samples into non-overlapping groups by the optimization of an objective function.
for example, k-means is a iterative partitional algorithm that minimizes the sum of squared errors between samples and the centroids they have been assigned to  <cit> .
a classical statistical framework for performing partitional clustering, which has attractive properties for biological data, are mixture models  <cit> .
on the clustering level, due to their probabilistic nature, mixture models acknowledge the inherent ambiguity of any group assignment in exploratory biological data analysis, in a structured and theoretically sound way.
this leads to a certain robustness towards noise in the data and makes mixtures a superior choice of model for data sets where hard partitioning is inappropriate.
on the level of representing individual data points, mixtures are highly flexible and can adapt to a wide range of data sets and applications.
finally, there is a wealth of extensions to the basic mixture framework.
for example semi-supervised learning or context-specific independence .
in practice, the first big stepping stone for the analysis of any data set by clustering is the choice of model to be used.
this can be burdensome, as most available packages are rather narrowly aimed at one specific type of model and re-implementation is time intensive.
the pymix software package aims to provide a general, high-level implementation of mixture models and the most important extensions in an object oriented setup .
this allows for rapid evaluation of modeling choices in an unified framework.
implementation
mixture models
formally, a mixture model is defined as follows.
let x = x <dig> ..., xp denote random variables  representing the features of a p dimensional data set d with n samples xi, i =  <dig> ..., n where each xi consists of a realization  of .
a k component mixture distribution is given by
where the πk ≥  <dig> are the mixture coefficients with .
each of the k clusters is identified with one of the components.
in the most straightforward case, the component distributions p are given by a product distribution over x <dig> ..., xp parameterized by parameters θk = ,
this is the well known naïve bayes model .
however, the formulation can accommodate more complex component distributions, including any multivariate distribution from the exponential family.
one advantage of adopting naïve bayes models as component disributions is that they allow the seamless integration of heterogeneous sources of data  in a single model.
this has been made use of, for instance, for the joined analysis of gene expression and transcription factor binding data  <cit>  or geno- and phenotype data of complex diseases  <cit> .
when using mixtures in a clustering context, the aim is to find the assignment of data points to components which maximizes the likelihood of the data.
the classical algorithm for obtaining the maximum likelihood parameters, which is also employed in pymix, is the expectation maximization  algorithm  <cit> .
the basic idea of the em procedure is to use the current model parameters to obtain conditional expectations of the component memberships of the data points.
these expectations in turn can be used to update the model parameters in a maximum likelihood fashion.
iteration over these two steps can be shown to converge to a local maximum in the likelihood.
the central quantity of em for mixtures is the component membership posterior, i.e.
the probability that a data point xi was generated by component k. by applying bayes' rule, this posterior is given by
the final cluster assignments are then also obtained based on this posterior.
each data point is assigned to the component which generated it with the highest probability, i.e.
xi is assigned to k* = argmaxk p .
method extensions
pymix includes several theoretical extensions of the basic mixture framework which can be employed to adapt the method for specific applications.
context-specific independence mixtures
in the case of naïve bayes component distributions, the component parameterization consists of a set of
parameters θkj for each component k and feature xj.
this can be visualized in a matrix as shown in figure 1a).
here each cell in the matrix represent one of the θkj.
the different values of the parameters for each feature and component express the regularities in the data which characterize and distinguish the components.
the basic idea of the context-specific independence   <cit>  extension to the mixture framework is that very often the regularities found in the data do not require a separate set of parameters for all features in every component.
rather there will be features where several component share a parameterization.
this leads to the csi parameter matrix shown in figure 1b).
as before each cell in the matrix represents a set of parameters, but now several component might share a parameterization for a feature, as indicated by the cells spanning several rows.
the csi structure conveys a number of desirable properties to the model.
first of all, it reduces the number of free parameters which have to be estimated from the data.
this leads to more robust parameter estimates and reduces the risk of overfitting.
also, the csi structure makes explicit which features characterize respectively, discriminate between clusters.
in the example in figure 1b), one can see that for feature x <dig> components  and  share characteristics and are represented by one set of parameters.
on the other hand component c <dig> does not share its parameterization for x <dig>  moreover, if components share the same group in the csi structure for all positions, they can be merged thus reducing the number of components in the model.
therefore learning of a csi structure can amount to an automatic reduction of the number of components as an integral part of model training.
such a csi structure can be inferred from the data by an application of the structural em  <cit>  framework.
in terms of the complexity of the mixture distribution, a csi mixture can be seen as lying in between a conventional naive bayes mixture  and a single naive bayes model .
a comparison of the performance of csi mixtures and these two extreme cases in a classical model selection setup can be found in  <cit> .
the basic idea of the csi formalism to fit model complexity to the data is also shared by approaches such as variable order markov chains  <cit>  or topology learning for hidden markov models  <cit> .
the main difference of csi to these approaches is that csi identifies parameters across components  and the resulting structure therefore carries information about the regularities captured by a clustering.
in this csi mixtures bear some similarity to clustering methods such as the shrunken nearest centroid  algorithm  <cit> .
however the csi structure allows for a richer, more detailed representation of the regularities characterizing a cluster.
another important aspect is the relation of the selection of variables implicit in the csi structure to pure feature selection methods .
these methods typically make a binary decision about the relevance or irrelevance of variables for the clustering.
in contrast to that, csi allows for more fine grained models where a variable is of relevance to distinguish subsets of clusters.
dependence trees
the dependence tree  model extends the naive bayes model  by assuming first-order dependencies between features.
given a directed tree, where nodes of the tree represent the features  and a map pa represents the parent relationships between features, the dtree model assumes that the distribution of feature xj is conditional on the feature xpa.
for a given tree topology defined by pa, the joint distribution of a dtree is defined as  <cit> ,
where p is a conditional distribution, such as conditional gaussians  <cit> , and θjk are the parameters of the conditional distribution.
see figure  <dig> for an example of a dtree and its distribution.
one important question is how to obtain the tree structure.
for some particular applications, the structure is given by prior knowledge.
in the analysis of gene expression of developmental processes for instance, the tree structure is given by the tree of cell development  <cit> .
when the structure is unknown, the tree structure with maximum likelihood can be estimated from the data  <cit> .
the method works by applying a maximum weight spanning tree algorithm on a fully connected, undirected graph, where vertices represent the variables and the weights of edges are equal to the mutual information between variables  <cit> .
when the dtree models are used as components in a mixture model, a tree structure can be inferred for each component model  <cit> .
this can be performed by applying the tree structure estimation method for each model at each em iteration.
when conditional normals are used in eq.
<dig>  the dtree can be seen as a particular type of covariance matrix parameterization for a multivariate normal distribution  <cit> .
there, the number of free parameters is linear to the number of variables, as in the case of multivariate normals with diagonal covariance matrices, while it models first-order variable dependencies.
in experiments performed in  <cit> , dependence trees compares favorably to naive bayes models  and full dependence models  for finding groups of co-expressed genes and even for simulated data arising from variable dependence structures.
in particular, dependence trees are not susceptible to over-fitting, which is otherwise a frequent problem in the estimation of mixture models with full diagonal matrices from sparse data.
in summary, the dtree model yields a better approximation of joint distribution in relation to the the simple naive bayes model.
furthermore, the estimated structure can be useful in the indication of important dependencies between features in a cluster  <cit> .
semi-supervised learning
in classical clustering the assignments of samples to clusters is completely unknown and has to be learned from the data.
this is referred to as unsupervised learning.
however, in practice there is often prior information for at least a subset of samples.
this is especially true for biological data, where there is often detailed expert annotation for at least some of the samples in a data set.
integrating this partial prior knowledge into the clustering can potentially greatly increase the performance of the clustering.
this leads to a semi-supervised learning setup.
pymix includes semi-supervised learning with mixtures for both hard labels as well as a formulation of prior knowledge in form of soft pairwise constraints between samples  <cit> .
in this context, in addition to the data xi, we have a set of positive  constraints  ∈  <cit>  , where xi, xj,  <dig> ≤ i <j ≤ n. the constraints indicate a preference for pair of data points to be clustered together , or not clustered together .
the main idea behind the semi-supervised method implemented in pymix is to find a clustering solution y where the least number of constraints are violated  <cit>  .
this can be achieved by redefining the posterior assignment rule of the em , as
where rjk = p , w is the set of all positive and negative constraints and  are lagrange parameters defining the penalty weights of positive and negative constraint violations.
hard labels arise as a special case of the above, when the constraints are binary  such that there is no overlap in the constraints, and the penalty parameters are set to high values λ+ = λ-~∞.
in this scenario, only solutions in full accordance with the constraints are possible  <cit> .
there are several semi-supervised/constraint-based clustering methods described in the literature  <cit> .
we choose to implement the method proposed in  <cit> , because it can be used within the mixture model framework and supports the use of soft-constraints.
therefore, we can take simultaneous advantage of the characteristics of the probability distribution offered in pymix and the semi-supervised framework.
moreover, the soft-constraints allow for the inclusion of our prior believes into the constraints, an important aspect in error prone biological data.
dependencies
pymix is written in the python programming language http://www.python.org.
it includes a custom written c extension and makes use of the numpy http://numpy.scipy.org array package, the gnu scientific library  http://www.gnu.org/software/gsl/ and matplotlib http://matplotlib.sourceforge.net plotting capabilities.
overall architecture
pymix represents finite mixture models in an object oriented framework.
figure  <dig> shows the class tree for the mixturemodel class.
mixturemodel represents the standard finite mixture model.
all the extensions to the mixture framework implemented in pymix mentioned previously, are derived as specialized classes from mixturemodel.
the csi structure learning is implemented as part of bayesmixturemodel.
labeledmixturemodel and constrainedmixturemodel represent two different approaches to semi-supervised learning.
the former implements semi-supervised learning with hard labels, the latter with pairwise constraints on the data points.
full documentation of the objects hierarchy in pymix  can be found on the pymix website http://www.pymix.org.
currently, the framework supports mixtures of gaussians, discrete distributions and exponential distributions.
furthermore, the framework has an extension that allows hidden markov models as components by the use of the ghmm library http://www.ghmm.org and is also used by the gql tool  <cit> .
moreover, due to the object oriented setup, it is easily extendable and more distributions will be added in the future.
prior work
due to the popularity and versatility of the mixture approach, there is a considerable number of software packages available.
for instance the r package mclust http://www.stat.washington.edu/mclust/ implements algorithms for gaussian mixture estimation.
the mixmod http://www-math.univ-fcomte.fr/mixmod/ c++ package contains algorithms for conventional mixtures of gaussian and multinomial distributions with matlab bindings.
another r package for conventional mixture analysis is the mix http://icarus.math.mcmaster.ca/peter/mix/mix.html package.
an example for a rather specialized package would be mtreemix http://mtreemix.bioinf.mpi-sb.mpg.de/ which allows estimation of mixtures of mutagenic trees.
in general it can be said that most of these packages focus rather narrowly on specific model types.
the main advantage of pymix is that the general, object oriented approach allows for a wide variety of mixture variants to be integrated in a single, unified framework.
the different advanced models  and component distributions  available in pymix, make the software applicable for many applications.
also, the object orientation means that the software can be straightforwardly extended with additional model types by advanced users.
RESULTS
pymix example session
assume we have a data set of dna sequences of length ten and we would like to perform clustering with a standard mixture model.
the data is stored in a fasta-file format 'dataset.fa'.
after starting the python interpreter we first import the required pymix modules.
>>> import mixture, biomixture
here, mixture is the main pymix module, biomixture contains convenience functions for the work with dna and protein sequences.
the next step is to read in the data from the flat file.
>>> data = biomixture.readfastasequences
the function readfastasequences parses the sequences in dataset.fa and returns a new dataset object.
now that the data is available we set up the model and perform parameter estimation using the em algorithm.
>>> m = biomixture.getmodel
>>> m.em
parsing data set.done
step 1: log likelihood: - <dig>
step 2: log likelihood: - <dig>
step 3: log likelihood: - <dig>
step 4: log likelihood: - <dig>
step 5: log likelihood: - <dig>
step 6: log likelihood: - <dig>
step 7: log likelihood: - <dig>
step 8: log likelihood: - <dig>
step 8: log likelihood: - <dig>
convergence reached with log_p - <dig>  after  <dig> steps.
the first argument to getmodel is the number of clusters , the second gives the length of the sequences .
the em function takes a dataset as input and performs parameter estimation.
the second and third argument are the maximum number of iterations and the convergence criterion respectively.
the output shows that in the exmaple the em took  <dig> iterations to converge.
note that in practice one would perform multiple em runs from different starting points to avoid local maxima.
this is implemented in the randmaxem function.
finally, we perform cluster assignment of the sequences.
>>> c = m.classify
classify loglikelihood: - <dig> .
** clustering **
cluster  <dig>  size 4
cluster  <dig>  size 6
unassigend due to entropy cutoff:
the classify function returns a list with the cluster label of each sequence .
this list can now be used to perform subsequent analysis'.
pymix offers various functionalities for visualization or printing of clusterings, ranking of features by relevance for the clustering or cluster validation.
this and other examples for working with pymix can be found in the examples directory in the pymix release.
documentation for the pymix library and a more detailed tutorials can be found on the pymix website http://www.pymix.org.
pymix applications
pymix has been applied on clustering problems in a variety of biological settings.
in the following we give a short description of some these applications.
for more details we refer to the original publications.
context-specific independence mixtures
the csi structure gives an explicit, high level overview of the regularities that characterize each cluster.
this greatly facilitates the interpretation of the clustering results.
for instance the csi formalism has been made use of for the analysis of transcription factor binding sites  <cit> .
there, the underlying biological question under investigation was whether there are transcription factors which have several, distinct patterns of binding in the known binding sites.
in this study csi mixtures were found to outperform conventional mixture models and biological evidence for factors with complex binding behavior were found.
an example for the two clusters of binding sites found for the transcription factor leu <dig> is shown in figure  <dig>  the double arrows indicate the positions where the learned csi structure assigned a separate distribution for each cluster.
these positions coincide with the strongest difference in the sequence composition of the two clusters.
in a comparison on a data set of  <dig> jaspar  <cit>  transcription factors, the csi mixtures outperformed conventional mixtures and positional weight matrices with respect to human-mouse sequence conservation of predicted hits  <cit> .
another application of csi mixtures was the clustering of protein subfamily sequences with simultaneous prediction of functional residues  <cit> .
here, the csi structure was made use of to find residues which differed strongly and consistently between the clusters.
combined with a ranking score for the residues, this allowed the prediction of putative functional residues.
the method was evaluated with favorable results on several data sets of protein sequences.
finally, csi mixture were brought to bear on the elucidation of complex disease subtypes on a data set of attention deficit hyperactivity  phenotypes  <cit> .
the clustering and subsequent analysis of the csi structure revealed interesting patterns of phenotype characteristics for the different clusters found.
dependence trees
the dependence tree distribution allows modeling of first order dependencies between features.
in experiments performed with simulated data  <cit> , dependence trees compared favorably to naive bayes and full dependence models for finding groups arising from variable dependence structures.
in particular, dependence trees are not susceptible to over-fitting, which is otherwise a frequent problem in the estimation of mixture models from sparse data.
thus, it offers a better approximation of the joint distribution in relation to the the simple naive bayes model.
one particular application is the analysis of patterns of gene expression in the distinct stages of a developmental tree, the developmental profiles of genes.
it is assumed that, in development, the sequence of changes from a stem cell to a particular mature cell, as described by a developmental tree, are the most important in modeling gene expression from developmental processes.
for example in  <cit> , we analyzed a gene expression compendia of lymphoid development, which contained expression from lymphoid stem cells, b cells, t cells and natural killer cells .
by combining the methods for mixture estimation and for the inference of the dtree structure, it is possible to find dtree dependence structure specific to groups of co-regulated genes .
in the left cluster, genes have a over-expression patterns for t cell developmental stages ; while in the right cluster, we have over-expression of b cell developmental stages .
there, the estimated structure indicates important dependencies between features  in a cluster.
we also carried out a comparative analysis, where mixtures of dtrees had a higher recovery of groups of genes participating in the same biological pathways than other methods, such as normal mixture models, k-means and som.
semi-supervised learning
semi-supervised learning can improve clustering performance for data sets where there is at least some prior knowledge on either cluster memberships or relations between samples in the data.
an example for the former has been investigated in the context of protein subfamily clustering  <cit> .
there, the impact of differing amounts of labeled samples on the clustering of protein subfamilies is investigated.
for several data sets of protein sequences the impact and practical implications of the semi-supervised setup are discussed.
in  <cit> , the impact of adding a few high quality constraints for identifying cell cycle genes in data from gene expression time courses with a mixture of hidden markov models was demonstrated.
if there is prior knowledge on the relations of pairs of samples, this can be expressed in form of pairwise must-link or must-not-link constraints.
this leads to another variant of semi-supervised learning.
one application of this framework was the clustering of gene expression time course profiles and in-situ rna hybridization images of drosophila embryos  <cit> .
there, the constraints were obtained by measuring the correlation between in-situ rna hybridization images of genes pairs .
these constraints differentiate between genes showing co-expression only by chance from those temporal co-expression supported by spatial co-expression .
it could be shown that with the inclusion of few high quality soft constraints derived from in-situ data, there was an improvement in the detection of syn-expressed genes  <cit> .
CONCLUSIONS
pymix-the python mixture package is a powerful tool for the analysis of biological data with basic and advanced mixture models.
due to the general formulation of the framework, it can be readily adapted and extended for a wide variety of applications.
this has been demonstrated in multiple publications dealing with a wide variety of biological applications.
availability and requirements
project name: pymix - the python mixture package
project home page: http://www.pymix.org
operating system: platform independent
programming language: python, c
other requirements: gsl, numpy, matplotlib
license gpl
authors' contributions
bg is the main pymix developer.
ic contributed code for the semi-supervised learning and the mixtures of dependence trees.
as provided supervision and guidance.
all authors have contributed to the manuscript.
supplementary material
additional file 1
pymix release  <dig> a. sources for the latest pymix release.
for the most recent version visit http://www.pymix.org.
click here for file

 clustering and biological data the first step in the analysis of many biological data sets is the detection of mutually similar subgroups of samples by clustering. there are a number of aspects of modern, high-throughput biological data sets which make clustering challenging: the data is often high-dimensional and only a subset of the features can be expected to be informative for the purpose of an analysis. also, the values of the data points may be distorted by noise and the data set contains a non-negligible number of missing values. in addition, many biological data sets will include outliers due to experimental artifacts. finally, the data set might incorporate multiple sources of data from different domains, where the relative relevance for the biological question to be addressed, as well as potential dependencies between the different sources are unknown. in particular, the latter can lead to a clustering which captures regularities not relevant to the specific biological context under consideration. reflecting its importance in exploratory data analysis, there is a multitude of clustering methods described in the literature. clustering methods can be divided in two major groups: hierarchical and partitional methods. hierarchical methods, which transform a distance matrix into a dendogram, have been widely used in bioinformatics, for example in the early gene expression literature, partly due to the appealing visualization of the dendograms. partitional methods are based on dividing samples into non-overlapping groups by the optimization of an objective function. for example, k-means is a iterative partitional algorithm that minimizes the sum of squared errors between samples and the centroids they have been assigned to. a classical statistical framework for performing partitional clustering, which has attractive properties for biological data, are mixture models. on the clustering level, due to their probabilistic nature, mixture models acknowledge the inherent ambiguity of any group assignment in exploratory biological data analysis, in a structured and theoretically sound way. this leads to a certain robustness towards noise in the data and makes mixtures a superior choice of model for data sets where hard partitioning is inappropriate. on the level of representing individual data points, mixtures are highly flexible and can adapt to a wide range of data sets and applications. finally, there is a wealth of extensions to the basic mixture framework. for example semi-supervised learning or context-specific independence. in practice, the first big stepping stone for the analysis of any data set by clustering is the choice of model to be used. this can be burdensome, as most available packages are rather narrowly aimed at one specific type of model and re-implementation is time intensive. the pymix software package aims to provide a general, high-level implementation of mixture models and the most important extensions in an object oriented setup. this allows for rapid evaluation of modeling choices in an unified framework. implementation mixture models formally, a mixture model is defined as follows. let x = x..., xp denote random variables representing the features of a p dimensional data set d with n samples xi, i =..., n where each xi consists of a realization of. a k component mixture distribution is given by where the πk ≥ are the mixture coefficients with. each of the k clusters is identified with one of the components. in the most straightforward case, the component distributions p are given by a product distribution over x..., xp parameterized by parameters θk =, this is the well known naïve bayes model. however, the formulation can accommodate more complex component distributions, including any multivariate distribution from the exponential family. one advantage of adopting naïve bayes models as component disributions is that they allow the seamless integration of heterogeneous sources of data in a single model. this has been made use of, for instance, for the joined analysis of gene expression and transcription factor binding data or geno- and phenotype data of complex diseases. when using mixtures in a clustering context, the aim is to find the assignment of data points to components which maximizes the likelihood of the data. the classical algorithm for obtaining the maximum likelihood parameters, which is also employed in pymix, is the expectation maximization algorithm. the basic idea of the em procedure is to use the current model parameters to obtain conditional expectations of the component memberships of the data points. these expectations in turn can be used to update the model parameters in a maximum likelihood fashion. iteration over these two steps can be shown to converge to a local maximum in the likelihood. the central quantity of em for mixtures is the component membership posterior, i.e. the probability that a data point xi was generated by component k. by applying bayes' rule, this posterior is given by the final cluster assignments are then also obtained based on this posterior. each data point is assigned to the component which generated it with the highest probability, i.e. xi is assigned to k* = argmaxk p. method extensions pymix includes several theoretical extensions of the basic mixture framework which can be employed to adapt the method for specific applications. context-specific independence mixtures in the case of naïve bayes component distributions, the component parameterization consists of a set of parameters θkj for each component k and feature xj. this can be visualized in a matrix as shown in figure 1a). here each cell in the matrix represent one of the θkj. the different values of the parameters for each feature and component express the regularities in the data which characterize and distinguish the components. the basic idea of the context-specific independence extension to the mixture framework is that very often the regularities found in the data do not require a separate set of parameters for all features in every component. rather there will be features where several component share a parameterization. this leads to the csi parameter matrix shown in figure 1b). as before each cell in the matrix represents a set of parameters, but now several component might share a parameterization for a feature, as indicated by the cells spanning several rows. the csi structure conveys a number of desirable properties to the model. first of all, it reduces the number of free parameters which have to be estimated from the data. this leads to more robust parameter estimates and reduces the risk of overfitting. also, the csi structure makes explicit which features characterize respectively, discriminate between clusters. in the example in figure 1b), one can see that for feature x components and share characteristics and are represented by one set of parameters. on the other hand component c does not share its parameterization for x moreover, if components share the same group in the csi structure for all positions, they can be merged thus reducing the number of components in the model. therefore learning of a csi structure can amount to an automatic reduction of the number of components as an integral part of model training. such a csi structure can be inferred from the data by an application of the structural em framework. in terms of the complexity of the mixture distribution, a csi mixture can be seen as lying in between a conventional naive bayes mixture and a single naive bayes model. a comparison of the performance of csi mixtures and these two extreme cases in a classical model selection setup can be found in. the basic idea of the csi formalism to fit model complexity to the data is also shared by approaches such as variable order markov chains or topology learning for hidden markov models. the main difference of csi to these approaches is that csi identifies parameters across components and the resulting structure therefore carries information about the regularities captured by a clustering. in this csi mixtures bear some similarity to clustering methods such as the shrunken nearest centroid algorithm. however the csi structure allows for a richer, more detailed representation of the regularities characterizing a cluster. another important aspect is the relation of the selection of variables implicit in the csi structure to pure feature selection methods. these methods typically make a binary decision about the relevance or irrelevance of variables for the clustering. in contrast to that, csi allows for more fine grained models where a variable is of relevance to distinguish subsets of clusters. dependence trees the dependence tree model extends the naive bayes model by assuming first-order dependencies between features. given a directed tree, where nodes of the tree represent the features and a map pa represents the parent relationships between features, the dtree model assumes that the distribution of feature xj is conditional on the feature xpa. for a given tree topology defined by pa, the joint distribution of a dtree is defined as, where p is a conditional distribution, such as conditional gaussians, and θjk are the parameters of the conditional distribution. see figure for an example of a dtree and its distribution. one important question is how to obtain the tree structure. for some particular applications, the structure is given by prior knowledge. in the analysis of gene expression of developmental processes for instance, the tree structure is given by the tree of cell development. when the structure is unknown, the tree structure with maximum likelihood can be estimated from the data. the method works by applying a maximum weight spanning tree algorithm on a fully connected, undirected graph, where vertices represent the variables and the weights of edges are equal to the mutual information between variables. when the dtree models are used as components in a mixture model, a tree structure can be inferred for each component model. this can be performed by applying the tree structure estimation method for each model at each em iteration. when conditional normals are used in eq. the dtree can be seen as a particular type of covariance matrix parameterization for a multivariate normal distribution. there, the number of free parameters is linear to the number of variables, as in the case of multivariate normals with diagonal covariance matrices, while it models first-order variable dependencies. in experiments performed in, dependence trees compares favorably to naive bayes models and full dependence models for finding groups of co-expressed genes and even for simulated data arising from variable dependence structures. in particular, dependence trees are not susceptible to over-fitting, which is otherwise a frequent problem in the estimation of mixture models with full diagonal matrices from sparse data. in summary, the dtree model yields a better approximation of joint distribution in relation to the the simple naive bayes model. furthermore, the estimated structure can be useful in the indication of important dependencies between features in a cluster. semi-supervised learning in classical clustering the assignments of samples to clusters is completely unknown and has to be learned from the data. this is referred to as unsupervised learning. however, in practice there is often prior information for at least a subset of samples. this is especially true for biological data, where there is often detailed expert annotation for at least some of the samples in a data set. integrating this partial prior knowledge into the clustering can potentially greatly increase the performance of the clustering. this leads to a semi-supervised learning setup. pymix includes semi-supervised learning with mixtures for both hard labels as well as a formulation of prior knowledge in form of soft pairwise constraints between samples. in this context, in addition to the data xi, we have a set of positive constraints ∈, where xi, xj, ≤ i <j ≤ n. the constraints indicate a preference for pair of data points to be clustered together, or not clustered together. the main idea behind the semi-supervised method implemented in pymix is to find a clustering solution y where the least number of constraints are violated. this can be achieved by redefining the posterior assignment rule of the em, as where rjk = p, w is the set of all positive and negative constraints and are lagrange parameters defining the penalty weights of positive and negative constraint violations. hard labels arise as a special case of the above, when the constraints are binary such that there is no overlap in the constraints, and the penalty parameters are set to high values λ+ = λ-~∞. in this scenario, only solutions in full accordance with the constraints are possible. there are several semi-supervised/constraint-based clustering methods described in the literature. we choose to implement the method proposed in, because it can be used within the mixture model framework and supports the use of soft-constraints. therefore, we can take simultaneous advantage of the characteristics of the probability distribution offered in pymix and the semi-supervised framework. moreover, the soft-constraints allow for the inclusion of our prior believes into the constraints, an important aspect in error prone biological data. dependencies pymix is written in the python programming language http://www.python.org. it includes a custom written c extension and makes use of the numpy http://numpy.scipy.org array package, the gnu scientific library http://www.gnu.org/software/gsl/ and matplotlib http://matplotlib.sourceforge.net plotting capabilities. overall architecture pymix represents finite mixture models in an object oriented framework. figure shows the class tree for the mixturemodel class. mixturemodel represents the standard finite mixture model. all the extensions to the mixture framework implemented in pymix mentioned previously, are derived as specialized classes from mixturemodel. the csi structure learning is implemented as part of bayesmixturemodel. labeledmixturemodel and constrainedmixturemodel represent two different approaches to semi-supervised learning. the former implements semi-supervised learning with hard labels, the latter with pairwise constraints on the data points. full documentation of the objects hierarchy in pymix can be found on the pymix website http://www.pymix.org. currently, the framework supports mixtures of gaussians, discrete distributions and exponential distributions. furthermore, the framework has an extension that allows hidden markov models as components by the use of the ghmm library http://www.ghmm.org and is also used by the gql tool. moreover, due to the object oriented setup, it is easily extendable and more distributions will be added in the future. prior work due to the popularity and versatility of the mixture approach, there is a considerable number of software packages available. for instance the r package mclust http://www.stat.washington.edu/mclust/ implements algorithms for gaussian mixture estimation. the mixmod http://www-math.univ-fcomte.fr/mixmod/ c++ package contains algorithms for conventional mixtures of gaussian and multinomial distributions with matlab bindings. another r package for conventional mixture analysis is the mix http://icarus.math.mcmaster.ca/peter/mix/mix.html package. an example for a rather specialized package would be mtreemix http://mtreemix.bioinf.mpi-sb.mpg.de/ which allows estimation of mixtures of mutagenic trees. in general it can be said that most of these packages focus rather narrowly on specific model types. the main advantage of pymix is that the general, object oriented approach allows for a wide variety of mixture variants to be integrated in a single, unified framework. the different advanced models and component distributions available in pymix, make the software applicable for many applications. also, the object orientation means that the software can be straightforwardly extended with additional model types by advanced users.  pymix example session assume we have a data set of dna sequences of length ten and we would like to perform clustering with a standard mixture model. the data is stored in a fasta-file format'dataset.fa'. after starting the python interpreter we first import the required pymix modules.    >>> import mixture, biomixture here, mixture is the main pymix module, biomixture contains convenience functions for the work with dna and protein sequences. the next step is to read in the data from the flat file.    >>> data = biomixture.readfastasequences the function readfastasequences parses the sequences in dataset.fa and returns a new dataset object. now that the data is available we set up the model and perform parameter estimation using the em algorithm.    >>> m = biomixture.getmodel    >>> m.em    parsing data set.done    step 1: log likelihood: -    step 2: log likelihood: -    step 3: log likelihood: -    step 4: log likelihood: -    step 5: log likelihood: -    step 6: log likelihood: -    step 7: log likelihood: -    step 8: log likelihood: -    step 8: log likelihood: -    convergence reached with log_p - after steps. the first argument to getmodel is the number of clusters, the second gives the length of the sequences. the em function takes a dataset as input and performs parameter estimation. the second and third argument are the maximum number of iterations and the convergence criterion respectively. the output shows that in the exmaple the em took iterations to converge. note that in practice one would perform multiple em runs from different starting points to avoid local maxima. this is implemented in the randmaxem function. finally, we perform cluster assignment of the sequences.    >>> c = m.classify    classify loglikelihood: -.    ** clustering **    cluster size 4        cluster size 6        unassigend due to entropy cutoff:     the classify function returns a list with the cluster label of each sequence. this list can now be used to perform subsequent analysis'. pymix offers various functionalities for visualization or printing of clusterings, ranking of features by relevance for the clustering or cluster validation. this and other examples for working with pymix can be found in the examples directory in the pymix release. documentation for the pymix library and a more detailed tutorials can be found on the pymix website http://www.pymix.org. pymix applications pymix has been applied on clustering problems in a variety of biological settings. in the following we give a short description of some these applications. for more details we refer to the original publications. context-specific independence mixtures the csi structure gives an explicit, high level overview of the regularities that characterize each cluster. this greatly facilitates the interpretation of the clustering results. for instance the csi formalism has been made use of for the analysis of transcription factor binding sites. there, the underlying biological question under investigation was whether there are transcription factors which have several, distinct patterns of binding in the known binding sites. in this study csi mixtures were found to outperform conventional mixture models and biological evidence for factors with complex binding behavior were found. an example for the two clusters of binding sites found for the transcription factor leu is shown in figure the double arrows indicate the positions where the learned csi structure assigned a separate distribution for each cluster. these positions coincide with the strongest difference in the sequence composition of the two clusters. in a comparison on a data set of jaspar transcription factors, the csi mixtures outperformed conventional mixtures and positional weight matrices with respect to human-mouse sequence conservation of predicted hits. another application of csi mixtures was the clustering of protein subfamily sequences with simultaneous prediction of functional residues. here, the csi structure was made use of to find residues which differed strongly and consistently between the clusters. combined with a ranking score for the residues, this allowed the prediction of putative functional residues. the method was evaluated with favorable results on several data sets of protein sequences. finally, csi mixture were brought to bear on the elucidation of complex disease subtypes on a data set of attention deficit hyperactivity phenotypes. the clustering and subsequent analysis of the csi structure revealed interesting patterns of phenotype characteristics for the different clusters found. dependence trees the dependence tree distribution allows modeling of first order dependencies between features. in experiments performed with simulated data, dependence trees compared favorably to naive bayes and full dependence models for finding groups arising from variable dependence structures. in particular, dependence trees are not susceptible to over-fitting, which is otherwise a frequent problem in the estimation of mixture models from sparse data. thus, it offers a better approximation of the joint distribution in relation to the the simple naive bayes model. one particular application is the analysis of patterns of gene expression in the distinct stages of a developmental tree, the developmental profiles of genes. it is assumed that, in development, the sequence of changes from a stem cell to a particular mature cell, as described by a developmental tree, are the most important in modeling gene expression from developmental processes. for example in, we analyzed a gene expression compendia of lymphoid development, which contained expression from lymphoid stem cells, b cells, t cells and natural killer cells. by combining the methods for mixture estimation and for the inference of the dtree structure, it is possible to find dtree dependence structure specific to groups of co-regulated genes. in the left cluster, genes have a over-expression patterns for t cell developmental stages; while in the right cluster, we have over-expression of b cell developmental stages. there, the estimated structure indicates important dependencies between features in a cluster. we also carried out a comparative analysis, where mixtures of dtrees had a higher recovery of groups of genes participating in the same biological pathways than other methods, such as normal mixture models, k-means and som. semi-supervised learning semi-supervised learning can improve clustering performance for data sets where there is at least some prior knowledge on either cluster memberships or relations between samples in the data. an example for the former has been investigated in the context of protein subfamily clustering. there, the impact of differing amounts of labeled samples on the clustering of protein subfamilies is investigated. for several data sets of protein sequences the impact and practical implications of the semi-supervised setup are discussed. in, the impact of adding a few high quality constraints for identifying cell cycle genes in data from gene expression time courses with a mixture of hidden markov models was demonstrated. if there is prior knowledge on the relations of pairs of samples, this can be expressed in form of pairwise must-link or must-not-link constraints. this leads to another variant of semi-supervised learning. one application of this framework was the clustering of gene expression time course profiles and in-situ rna hybridization images of drosophila embryos. there, the constraints were obtained by measuring the correlation between in-situ rna hybridization images of genes pairs. these constraints differentiate between genes showing co-expression only by chance from those temporal co-expression supported by spatial co-expression. it could be shown that with the inclusion of few high quality soft constraints derived from in-situ data, there was an improvement in the detection of syn-expressed genes.  pymix-the python mixture package is a powerful tool for the analysis of biological data with basic and advanced mixture models. due to the general formulation of the framework, it can be readily adapted and extended for a wide variety of applications. this has been demonstrated in multiple publications dealing with a wide variety of biological applications. availability and requirements project name: pymix - the python mixture package project home page: http://www.pymix.org operating system: platform independent programming language: python, c other requirements: gsl, numpy, matplotlib license gpl authors' contributions bg is the main pymix developer. ic contributed code for the semi-supervised learning and the mixtures of dependence trees. as provided supervision and guidance. all authors have contributed to the manuscript. supplementary material additional file 1 pymix release a. sources for the latest pymix release. for the most recent version visit http://www.pymix.org. click here for file
the advanced models include context-specific independence mixtures, mixtures of dependence trees and semi-supervised learning. mixtures are versatile and powerful statistical models which perform robustly for clustering in the presence of noise and have been successfully applied in a wide range of applications. due to the general nature of the framework, pymix can be applied to a wide range of applications and data sets. pymix - the python mixture package implements algorithms and data structures for clustering with basic and advanced mixture models. cluster analysis is an important technique for the exploratory analysis of biological data. pymix is a useful tool for cluster analysis of biological data.
 cluster analysis is an important technique for the exploratory analysis of biological data. such data is often high-dimensional, inherently noisy and contains outliers. this makes clustering challenging. mixtures are versatile and powerful statistical models which perform robustly for clustering in the presence of noise and have been successfully applied in a wide range of applications.  pymix - the python mixture package implements algorithms and data structures for clustering with basic and advanced mixture models. the advanced models include context-specific independence mixtures, mixtures of dependence trees and semi-supervised learning. pymix is licenced under the gnu general public licence. pymix has been successfully used for the analysis of biological sequence, complex disease and gene expression data.  pymix is a useful tool for cluster analysis of biological data. due to the general nature of the framework, pymix can be applied to a wide range of applications and data sets. 