Skip to main content

PyDrugLogics

PyDrugLogics Logo

DOI PyPI version Test Status License: GPL v3 Documentation Status

Overview

PyDrugLogics is a Python package designed for constructing, optimizing Boolean Models and performs in-silico perturbations of the models.

Core Features

  • Construct Boolean model from .sif file
  • Load Boolean model from .bnet file
  • Optimize Boolean model
  • Generate perturbed models
  • Evaluate drug synergies

Installation

PyDrugLogics can be installed via PyPi, Conda, or directly from the source.

Install PyDrugLogics from PyPI

The process involves two steps to install the PyDrugLogics core package and its necessary external dependencies.

1. Install PyDrugLogics via pip

pip install pydruglogics

2. Install External Dependency

pip install -r https://raw.githubusercontent.com/druglogics/pydruglogics/main/requirements.txt

This will install the PyDrugLogics package and handle all dependencies automatically.

Install PyDrugLogics via conda

conda install szlaura::pydruglogics

Install from Source

For the latest development version, you can clone the repository and install directly from the source:

git clone https://github.com/druglogics/pydruglogics.git
cd pydruglogics
pip install .
pip install -r requirements.txt

CoLoMoTo Notebook environment

PyDrugLogics is available in the CoLoMoTo Docker and Notebook starting from version 2025-01-01.

Setup CoLoMoTo Docker and Notebook

  1. Install the helper script in a terminal:
    pip install -U colomoto-docker
  1. Start the CoLoMoTo Notebook (a specific tag can also be given):
    colomoto-docker    # or colomoto-docker -V 2025-01-01
  1. Open the Jupiter Notebook and navigate to the tutorials folder to find the PyDrugLogics folder hosting the pydruglogics tutorial notebook.

See more about the CoLoMoTo Docker and Notebook in the documentation.

Testing

  1. To run all tests and check code coverage, you need to install test dependencies:
    pip install -r requirements.txt
    pip install -e .[test]
  1. Then, from the repository root, run:
    pytest tests

You should see a coverage report at the end.

Documentation

For full PyDrugLogics documentation, visit the GitHub Documentation.

Quick Start Guide

Here's a simple example to get you started:

from pydruglogics.model.BooleanModel import BooleanModel
from pydruglogics.input.TrainingData import TrainingData
from pydruglogics.input.Perturbations import Perturbation
from pydruglogics.input.ModelOutputs import ModelOutputs
from pydruglogics.execution.Executor import execute

# Initialize train and predict
model_outputs_dict = {
        "RSK_f": 1.0,
        "MYC": 1.0,
        "TCF7_f": 1.0
    }
model_outputs = ModelOutputs(input_dictionary=model_outputs_dict)

observations = [(["CASP3:0", "CASP8:0","CASP9:0","FOXO_f:0","RSK_f:1","CCND1:1"], 1.0)]
training_data = TrainingData(observations=observations)


drug_data = [['PI', 'PIK3CA', 'inhibits'],
            ['PD', 'MEK_f', 'activates'],
            ['CT','GSK3_f']]
perturbations = Perturbation(drug_data=drug_data)


boolean_model = BooleanModel(file='./ags_cascade_1.0/network.bnet', model_name='test', mutation_type='topology',
                                  attractor_tool='mpbn', attractor_type='trapspaces')

observed_synergy_scores = ["PI-PD", "PI-5Z", "PD-AK", "AK-5Z"]


ga_args = {
        'num_generations': 20,
        'num_parents_mating': 3,
        'mutation_num_genes': 3,
        'fitness_batch_size': 20
}

ev_args = {
        'num_best_solutions': 3,
        'num_of_runs': 30,
        'num_of_cores': 4
}


train_params = {
        'boolean_model': boolean_model,
        'model_outputs': model_outputs,
        'training_data': training_data,
        'ga_args': ga_args,
        'ev_args': ev_args
}

predict_params = {
        'perturbations': perturbations,
        'model_outputs': model_outputs,
        'observed_synergy_scores': observed_synergy_scores,
        'synergy_method': 'bliss'
}

# run train and predict
execute(train_params=train_params, predict_params=predict_params)

For a more detailed tutorial, please visit the documentation or the tutorial.

Contributing to PyDrugLogics

We welcome contributions to PyDrugLogics!

How to Contribute

  1. Fork and clone the repository:
    git clone https://github.com/druglogics/pydruglogics.git
    cd pydruglogics
    
  2. Create a feature branch:
    git checkout -b my-feature-branch
    
  3. Make changes and write tests for new features or bug fixes.
  4. Run tests to ensure everything works:
    pytest tests
    
  5. Commit and push your changes:
    git commit -m "Describe your changes"
    git push origin my-feature-branch
    
  6. Open a pull request against the main repository.

Guidelines

  • Follow PEP8 code style.
  • Write clear commit messages.
  • Update documentation if adding new functionality.
  • Ensure all tests pass before submitting a PR.
  • For new features or significant changes, we recommend opening an issue or discussing with the maintainer @szlaura first.

Reporting Issues

If you encounter a bug or wish to request a feature, please report it on our GitHub issue tracker:

GitHub Issues Page

When reporting an issue, include:

  • Your operating system and version (e.g., Ubuntu 22.04)
  • Python version (e.g., Python 3.11.10)
  • The error message and traceback (if applicable)
  • Steps to reproduce the issue

Thank you for your help!

Citing PyDrugLogics

If you use PyDrugLogics, please cite the paper:

Szekeres, L., Zobolas, J. (2025): PyDrugLogics: A Python Package for Predicting Drug Synergies Using Boolean Models. DOI: 10.21105/joss.08038

@article{Szekeres2025,
  doi = {10.21105/joss.08038},
  url = {https://doi.org/10.21105/joss.08038},
  year = {2025},
  publisher = {The Open Journal},
  volume = {10},
  number = {114},
  pages = {8038},
  author = {Szekeres, Laura and Zobolas, John},
  title = {PyDrugLogics: A Python Package for Predicting Drug Synergies Using Boolean Models},
  journal = {Journal of Open Source Software}
}

Metadata

Release files for pydruglogics 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydruglogics 0.1.10
File Size Uploaded Provenance Actions
pydruglogics-0.1.10.tar.gz 82.4 kB Without provenance Details for pydruglogics-0.1.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydruglogics 0.1.10
File Interpreter ABI Platform Actions
pydruglogics-0.1.10-py3-none-any.whl Python 3 none any Details for pydruglogics-0.1.10-py3-none-any.whl

Total release size: 160.9 kB

Release files / pydruglogics-0.1.10.tar.gz

Download URL pydruglogics-0.1.10.tar.gz
Size 82.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3056ec042fbddf0e5dfe69f30f394cd11c1158fd1d79b25a6d7b696f1ca661f3
BLAKE2b-256 checksum
How to use checksums
1f9d51706b701f8a2b67a7906c9b442d00ea3dffcd666f24cf7d5f3ba066ae7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Release files / pydruglogics-0.1.10-py3-none-any.whl

Download URL pydruglogics-0.1.10-py3-none-any.whl
Size 78.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76c849062626e5460bef2fff5461cc28c8a8578bf69b980027f686624045a1ad
BLAKE2b-256 checksum
How to use checksums
8119a06551a047929dc0dbb63b7365a1b4f15b53e8e49b54d93e0f8acd69725b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Security for pydruglogics 0.1.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page