A Bayesian Networks approach for inferring active Transcription Factors using logic models of transcriptional regulation.
The package includes several examples to help you get started:
- TF-inference.ipynb - Basic TF inference workflow
- TF-inference-simulation.ipynb - Simulation-based inference example
- 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
The package requires the GNU Scientific Library (GSL). Install it for your operating system:
sudo apt install -y libgsl-devbrew install gslSetup GSL using vcpkg:
- install vcpkg:
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.bat- Install GSL:
.\vcpkg install gsl:x64-windows- Set the environment variable
VCPKG_ROOTto the path of the vcpkg directory:
- PowerShell:
$env:VCPKG_ROOT = "C:\path\to\vcpkg"- Command Prompt:
set VCPKG_ROOT="C:\path\to\vcpkg"Install nlbayes directly from GitHub:
pip install git+https://github.com/umbibio/nlbayes-python.gitfrom 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)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.