API Documentation¶
Analyzer¶
- class ratesb_python.common.analyzer.Analyzer(model_str: str, rate_law_classifications_path: str = None, abort_on_complicated_rate_laws: bool = True)[source]¶
Bases:
objectThe 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.
- Parameters:
results – An instance of the Results class used to store and retrieve analysis results. :type results: 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.
- class ratesb_python.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]¶
Bases:
object- boundary_species: List[str]¶
- codes: List[int]¶
- compartment_in_kinetic_law: List[str]¶
- ids_list: List[str]¶
- is_reversible: bool¶
- kinetics: str¶
- kinetics_sim: str¶
- non_constant_params: List[str]¶
- parameters_in_kinetic_law: List[str]¶
- parameters_in_kinetic_law_only: List[str]¶
- product_list: List[str]¶
- reactant_list: List[str]¶
- reaction_id: str¶
- sbo_term: int¶
- sorted_species: List[str]¶
- species_in_kinetic_law: List[str]¶
- ratesb_python.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 ratesb_python.common.results.Results[source]¶
Bases:
objectA 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