Skip to main content

Bayesian tests for set enrichment.

Project description


Bayesian tests for set enrichment.

Tests!

Installation

Install from PyPI

pip install brioche-enrichment

or install from the Github repository

git clone git@github.com:dpohanlon/brioche.git
pip install -r requirements.txt .

Usage

Prepare some data in a contingency table format, with row and column set annotations

row_names = ["a", "b", "c", ...]
col_names = ["l", "m", "n", ...]

data = np.array([[30, 27, 10, ...], [28, 25, 11, ...], [31, 29, 15, ...], ...])

Import Brioche and create the multi-set enrichment object

from brioche.multisetEnrichment import MultisetEnrichment

enrichment = MultisetEnrichment(data, col_names, row_names, likelihood_type="sum")

Optionally, specify whether there are total-sum constraints on the rows or columns

enrichment = MultisetEnrichment(data, row_names, col_names, row_constraint = True,
								col_constraint = False, likelihood_type="sum")

likelihood_type determines the form of the likelihood model for each cell, and also therefore what the 'null' model is. Both assume that each cell is a combination of a row and a column term, and a term that describes the deviation of the cell from the row and column terms:

$$n_{ij} = r_i + c_j + d_{ij}$$

When likelihood_type = 'sum', these are combined with a sum (the default), and when likelihood_type = 'prod' these are multiplied.

Run the Markov-chain Monte Carlo inference on the enrichment model, retrieve samples from the posterior, and return a Pandas DataFrame of enrichment z scores

samples = enrichment.runMCMC(num_samples=10000)

results = enrichment.getSummary(samples)

Plot model parameters and enrichment posterior probability distributions

from brioche.plot import plotDeviations

plotDeviations(samples, threshold=2, x_labels=col_names, y_labels=row_names, name="test-")

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

brioche_enrichment-0.1.2a0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brioche_enrichment-0.1.2a0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file brioche_enrichment-0.1.2a0.tar.gz.

File metadata

  • Download URL: brioche_enrichment-0.1.2a0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for brioche_enrichment-0.1.2a0.tar.gz
Algorithm Hash digest
SHA256 5ccc3ce8fb1a63cb673fd235e833ef53395e7025320b4246140c269a7aed0843
MD5 2e8bc5f493636696bf02ed05c7002e48
BLAKE2b-256 c61a8edb3358820ad8eb5a554fa1de4b12dbc339ea497c33c21527cabcab611c

See more details on using hashes here.

File details

Details for the file brioche_enrichment-0.1.2a0-py3-none-any.whl.

File metadata

File hashes

Hashes for brioche_enrichment-0.1.2a0-py3-none-any.whl
Algorithm Hash digest
SHA256 1729e9b84ea2ebbd9573ff18b244fe326515d0655c8f3d5bd50214f9e1d7d317
MD5 590046e1da9ec7177a7ede01431991db
BLAKE2b-256 3368c4bd37dd31237d1f105436c8e7ff3d6355de074d8ccc2fafa3cfa502fa23

See more details on using hashes here.

Supported by

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