Bio Models

This module provides functionality for retrieving, parsing, and loading biological Boolean network models from public online repositories.

The boolforge.bio_models module allows users to programmatically access and import published Boolean and logical gene regulatory network models from GitHub repositories such as:

  • expert-curated (ckadelka): manually curated models from the Design Principles of Gene Regulatory Networks repository.

  • pystablemotifs (jcrozum): models accompanying the PyStableMotifs library.

  • biodivine (sybila): models from the Sybila Biodivine Boolean Models repository.

Functions are provided to:

  • Recursively list and download files from GitHub folders using the REST API.

  • Fetch raw text or byte content from remote sources.

  • Parse Boolean network models into BooleanNetwork objects.

  • Batch-download and convert all models from supported repositories.

This module is intended to facilitate reproducible research by providing direct access to real-world Boolean GRN models for simulation, comparison, and benchmarking.

Example

>>> from boolforge import bio_models
>>> result = bio_models.get_bio_models_from_repository('')
>>> len(result['BooleanNetworks'])
122
boolforge.bio_models.load_model(download_url: str, max_degree: int = 24, possible_separators: list[str] = ['* =', '*=', '=', ','], ignore_first_line: bool = False, simplify_functions: bool = False) BooleanNetwork[source]

Load and parse a Boolean network model from a remote text file.

Parameters

download_urlstr

Direct download URL to the model file.

max_degreeint, optional

Maximum allowed in-degree for nodes (default: 24).

possible_separatorslist[str], optional

Possible assignment separators used in the model file.

ignore_first_linebool, optional

If True, skip the first line of the file (default: False).

simplify_functionsbool, optional

If True, Boolean update functions are simplified after initialization. Default is False.

Returns

BooleanNetwork

Parsed Boolean network.

Raises

ValueError

If the model cannot be parsed.

boolforge.bio_models.get_bio_models_from_repository(repository: str = 'expert-curated (ckadelka)', download_urls_pystablemotifs: list[str] | None = None, max_degree: int = 24, simplify_functions: bool = False) dict[source]

Load Boolean network models from selected online repositories.

This function downloads, parses, and constructs Boolean network models from several curated online repositories. Models that cannot be parsed are skipped and recorded separately.

Parameters

repositorystr, optional

Identifier of the source repository. Supported values are:

  • ‘expert-curated (ckadelka)’ (default)

  • ‘pystablemotifs (jcrozum)’

  • ‘biodivine (sybila)’

download_urls_pystablemotifslist[str] or None, optional

Optional list of direct download URLs for PyStableMotifs models. If provided, these URLs are used instead of querying the GitHub API (faster). If None (default), model URLs are fetched dynamically from GitHub.

max_degreeint, optional

Maximum allowed in-degree for nodes (default: 24).

simplify_functionsbool, optional

If True, Boolean update functions are simplified after initialization. Default is False.

Returns

dict

Dictionary with the following keys:

  • ‘BooleanNetworks’list[BooleanNetwork]

    List of successfully parsed Boolean network models.

  • ‘SuccessfulDownloadURLs’list[str]

    URLs corresponding to models that were successfully loaded.

  • ‘FailedDownloadURLs’list[str]

    URLs corresponding to models that could not be parsed or loaded.