Skip to main content

A Python package to find strong correlations among P variables, each with N observations.

Project description

betaMixPy

The betaMixPy package is used to find edges in gene networks using co-expression data. The betaMixPy method is built on the insightful results of Frankl and Maehara (1990) who showed that two random vectors are approximately perpendicular with high probability, if the dimension of the space is sufficiently large. The pair-wise correlations between pairs of predictors are equal to the cosine of the angles between the pairs. From these angles we compute $z_j=\sin^2(\theta)$ and fit a mixture of two beta distributions to the $z_j$'s. For pairs of random vectors (the null set) the distribution of $z_j$ is Beta((N-1)/2, 1/2), where N is the sample size. The nonnull set is assumed to follow a Beta(a,b) distribution, and using the EM algorithm we estimate a,b, and the proportion, p0, of the null set of pairs. The betaMix function determines a threshold which will control the error rate given by the user. Any $z_j$ below that threshold corresponds to a significantly correlated pair of predictors (an edge in the graphical model.)

The input to the program is a normalized expression matrix, with predictors/genes (nodes) in the rows, and samples in the columns.

With a large number of predictors, P, the estimation may be slow, so it is recommended to set the parameter subsamplesize to something smaller than choose(P,2). The minimum allowed by the program is 20,000. Using anything smaller will cause betaMixPy to fit the model to all choose(P,2) pairs.

If the N samples can be assumed to be indepndent, set the parameter ind to True (the default). If it is set to False, the null set follows a Beta((nu-1)/2, 1/2) distribution and nu (the effective sample size) is estimated from the data in the EM algorithm.

To install the package, run

pip3 install betaMixPy

Additional documentation and examples are available in the doc, code and data folders on GitHub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

betaMixPy-0.1.2.tar.gz (8.4 kB view hashes)

Uploaded Source

Built Distribution

betaMixPy-0.1.2-py3-none-any.whl (8.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page