API Documentation

common.analyzer Module

class common.analyzer.Analyzer(model_str: str, rate_law_classifications_path: str = None, abort_on_complicated_rate_laws: bool = True)[source]

The Analyzer class analyzes SBML models to check if the rate laws are following some rules. It uses sympy for processing mathematical symbol expressions, libsbmlpython for processing SBML models, and SBMLKinetics for analyzing SBML models and classifying rate laws. The class can return errors and warnings based on the specified checks.

results

An instance of the Results class used to store and retrieve

Type:

Results

analysis results. For more details, refer to the documentation of the Results class.
check_all()[source]

Performs all checks.

Updates:

The results of the check_all to self.results.

check_except(excluded_codes: List[int] | None = [])[source]

Performs all checks except the ones corresponding to the provided list of error or warning codes.

Parameters:

excluded_codes (Optional[List[int]]) – List of codes of the checks to exclude. If None, all checks are performed.

Updates:

The results of the check(s) to self.results.

checks(codes)[source]

Performs multiple checks based on the provided list of error or warning codes. If no codes are provided, all checks are performed.

Parameters:

codes (List[int]) – List of codes of the checks to perform.

Updates:

The results of the checks to self.results.

static list_all_checks()[source]

Returns a string representation of all the checks.

static list_check(code)[source]

Returns a string representation of the check corresponding to the provided code.

Parameters:

code (int) – The code of the check.

class common.analyzer.ReactionData(reaction_id: str, kinetics: str, kinetics_sim: str, reactant_list: List[str], product_list: List[str], species_in_kinetic_law: List[str], parameters_in_kinetic_law: List[str], ids_list: List[str], sorted_species: List[str], boundary_species: List[str], parameters_in_kinetic_law_only: List[str], compartment_in_kinetic_law: List[str], is_reversible: bool, sbo_term: int, codes: List[int], non_constant_params: List[str])[source]
common.analyzer.check_model(model_str: str, rate_law_classifications_path: str = None, abort_on_complicated_rate_laws: bool = True, excluded_codes: List[int] = [])[source]

Checks the SBML model for rate law errors and warnings.

Parameters:
  • model_str (str) – Path to the model file, or the string representation of model.

  • rate_law_classifications_path (str) – Path to the rate law classification file.

  • abort_on_complicated_rate_laws (bool) – If True, the check will abort if the rate law is too complicated to process.

  • excluded_codes (List[int]) – List of codes of the checks to exclude. If None, all checks are performed.

Returns:

The results of the checks as a result object, can be printed or converted to string.

Results

class common.results.Results[source]

A class to represent the analysis results of a model.

add_message(reaction_name: str, code: int, message: str, is_warning: bool = True)[source]

Adds a new message to the results list.

Parameters:
  • reaction_name (str) – The name of the reaction.

  • code (int) – The code associated with the message.

  • message (str) – The message content.

  • is_warning (bool) – Indicates if the message is a warning. Defaults to True.

Raises:

None

clear_results()[source]

Clears all results from the results list, resetting the number of errors and warnings.

Parameters:

None

Raises:

None

count_errors()[source]

Counts the total number of errors.

Returns:

The total number of errors.

Return type:

int

count_messages()[source]

Counts the total number of messages (errors and warnings).

Returns:

The total number of messages.

Return type:

int

count_warnings()[source]

Counts the total number of warnings.

Returns:

The total number of warnings.

Return type:

int

get_all_errors()[source]

Retrieves all errors as a dictionary of reaction names to error messages.

Returns:

A dictionary containing errors grouped by reaction names.

Return type:

OrderedDict

get_all_warnings()[source]

Retrieves all warnings as a dictionary of reaction names to warning messages.

Returns:

A dictionary containing warnings grouped by reaction names.

Return type:

OrderedDict

get_messages_by_reaction(reaction_name: str)[source]

Retrieves all messages for a specific reaction.

Parameters:

reaction_name (str) – The name of the reaction.

Returns:

A list of messages for the specified reaction.

Return type:

list

remove_messages_by_reaction(reaction_name: str)[source]

Removes all messages for a specific reaction.

Parameters:

reaction_name (str) – The name of the reaction.

Raises:

None