Bio Models

Created on Fri Sep 22 11:48:48 2025

@author: ckadelka

boolforge.bio_models.get_content_in_remote_folder(url: str) tuple[source]

Retrieve file names and download URLs from a remote GitHub folder.

Parameters:

  • url (str): GitHub API URL pointing to a repository folder.

Returns:

  • tuple[list[str], list[str]]: (file_names, file_download_urls), where file_names is a list of files in the folder and file_download_urls is a list containing the raw download URL.

boolforge.bio_models.fetch_file(download_url: str) str[source]

Download raw text content of a file.

Parameters:

  • download_url (str): Direct download URL to the file.

Returns:

  • str: File content as plain text.

boolforge.bio_models.fetch_file_bytes(download_url: str) bytes[source]

Download raw bytes content of a file.

Parameters:

  • download_url (str): Direct download URL to the file.

Returns:

  • bytes: File content as raw bytes.

boolforge.bio_models.load_model(download_url: str, max_degree: int = 24, possible_separators: list = ['* =', '*=', '=', ','], original_not: str = 'NOT', original_and: str = 'AND', original_or: str = 'OR', IGNORE_FIRST_LINE: bool = False) BooleanNetwork | None[source]

Load a Boolean network model from a remote text file.

Parameters:

  • download_url (str): Direct download URL to the model file.

  • max_degree (int, optional): Maximum in-degree allowed for nodes (default: 24).

  • possible_separators (list[str], optional): Possible assignment separators in model files (default: [’* =’, ‘*=’, ‘=’, ‘,’]).

  • original_not (str, optional): Possible logical negation operator in the model file.

  • original_and (str, optional): Possible logical AND operator in the model file.

  • original_or (str, optional): Possible logical OR operator in the model file.

  • IGNORE_FIRST_LINE (bool, optional): If True, skip the first line of the file (default: False).

Returns:

  • BooleanNetwork: Parsed Boolean network. If parsing fails, returns None.

boolforge.bio_models.get_bio_models_from_repository(repository: str) tuple[source]

Load Boolean network models from selected online repositories.

Parameters:

  • repository (str:{‘expert-curated (ckadelka)’, ‘pystablemotifs (jcrozum)’, ‘biodivine (sybila)’}): Source repository identifier.

Returns:

  • tuple[list[BooleanNetwork], list[str], list[str]]: (bns, successful_download_urls, failed_download_urls) where bns is a list of successfully parsed Boolean networks, successful_download_urls is a list of URLs of models successfully loaded, and failed_download_urls is a list of URLs where models could not be parsed.