Skip to content

umbibio/nlbayes-python

Repository files navigation

Noisy Logic Bayesian Inference

A Bayesian Networks approach for inferring active Transcription Factors using logic models of transcriptional regulation.

Examples

The package includes several examples to help you get started:

Jupyter Notebooks

Python Scripts

  • tf_inference_simulation.py - Command-line example demonstrating TF inference with simulated data, including:
    • Random network generation
    • Evidence simulation
    • OR-NOR model inference
    • Performance evaluation (ROC/PR curves)
    • Terminal-based visualization

Installation Instructions

Prerequisites

The package requires the GNU Scientific Library (GSL). Install it for your operating system:

Linux (Debian/Ubuntu)

sudo apt install -y libgsl-dev

macOS

brew install gsl

Windows

Setup GSL using vcpkg:

  1. install vcpkg:
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.bat
  1. Install GSL:
.\vcpkg install gsl:x64-windows
  1. Set the environment variable VCPKG_ROOT to the path of the vcpkg directory:
  • PowerShell:
$env:VCPKG_ROOT = "C:\path\to\vcpkg"
  • Command Prompt:
set VCPKG_ROOT="C:\path\to\vcpkg"

Package Installation

Install nlbayes directly from GitHub:

pip install git+https://github.com/umbibio/nlbayes-python.git

Usage

from nlbayes import ORNOR

# Create and fit the model
model = ORNOR(network, evidence, n_graphs=5, uniform_prior=False)
model.fit(n_samples=2000, gelman_rubin=1.1, burnin=True)

# Get inference results
results = model.get_results()
print(results)

Input Data Format

The input data for the ORNOR class should be formatted as follows:

  • network: A dictionary where keys are TF IDs and values are dictionaries mapping target gene names to regulation modes (-1 for repression, 1 for activation)
  • evidence: A dictionary mapping gene names to expression states (-1 for down-regulated, 1 for up-regulated)

For more detailed examples, check the example notebooks and scripts in the nlbayes/examples directory.

About

Python package for NLBayes, an active TF inference algorithm based on noisy logic bayesian models

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors