sbmlutils.report.sbmlinfo
¶
Creates dictionary of information for given model.
The model dictionary can be used for rendering the HTML report. The information can be serialized to JSON for later rendering in web app.
Module Contents¶
Classes¶
Class for collecting information in JSON on an SBMLDocument to create reports. |
Functions¶
|
Get SBase attribute. |
|
Remove empty fields from JSON. |
Attributes¶
- sbmlutils.report.sbmlinfo._get_sbase_attribute(sbase, key)[source]¶
Get SBase attribute.
- Parameters
sbase (libsbml.SBase) –
key (str) –
- Return type
Optional[Any]
- sbmlutils.report.sbmlinfo.clean_empty(d)[source]¶
Remove empty fields from JSON.
Reducing to core information.
- Parameters
d (Union[Dict, List, str]) –
- Return type
Union[Dict, List, str]
- class sbmlutils.report.sbmlinfo.SBMLDocumentInfo(doc)[source]¶
Class for collecting information in JSON on an SBMLDocument to create reports.
A single document can contain multiple models or be a hierarchical model (comp package).
- Parameters
doc (libsbml.SBMLDocument) –
- static from_sbml(source)[source]¶
Read model info from SBML.
- Parameters
source (Union[pathlib.Path, str]) –
- Return type
- to_json(strip=True, indent=2)[source]¶
Serialize to JSON representation.
- Parameters
strip (bool) –
indent (int) –
- Return type
str
- create_info()[source]¶
Create information dictionary for report rendering.
- Return type
Dict[str, Any]
- model_dict(model)[source]¶
Create information for a given model.
- Parameters
model (Union[libsbml.Model, libsbml.ModelDefinition]) –
- Return type
Dict[str, Any]
- add_compartment_links(compartments, species, reactions)[source]¶
Add species and reaction links to compartment.
- Parameters
compartments (List[Dict[str, Any]]) –
species (List[Dict[str, Any]]) –
reactions (List[Dict[str, Any]]) –
- Return type
None
- add_species_links(species, reactions)[source]¶
Add reaction links to species.
- Parameters
species (List[Dict[str, Any]]) –
reactions (List[Dict[str, Any]]) –
- Return type
None
- static _sbaseref(sbaseref)[source]¶
Format the SBaseRef instance.
Used to figure out the type of the SBaseRef.
- Parameters
sbaseref (libsbml.SBaseRef) – SBaseRef instance
- Returns
Dictionary containing formatted SBaseRef instance’s data
- Return type
Optional[Dict]
- _create_port_map(model)[source]¶
Create dictionary of symbols:port for symbols in model.
This allows to lookup port for a given Sbase.
- Returns
port dictionary for model
- Parameters
model (libsbml.Model) –
- Return type
Dict
- _create_assignment_map(model)[source]¶
Create dictionary of symbols:assignment for symbols in model.
This allows to lookup assignments for a given variable.
- Returns
assignment dictionary for model
- Parameters
model (libsbml.Model) –
- Return type
Dict
- static _get_pk(sbase)[source]¶
Calculate primary key.
- Parameters
sbase (libsbml.SBase) –
- Return type
str
- static _uuid(xml)[source]¶
Generate unique identifier.
SHA1 digest of the identifier (mostly the xml string).
- Parameters
xml (str) –
- Return type
str
- classmethod sbase_dict(sbase)[source]¶
Info dictionary for SBase.
- Parameters
sbase (libsbml.SBase) – SBase instance for which info dictionary is to be created
- Return type
Dict[str, Any]
:return info dictionary for item
- sbaseref_dict(sbaseref)[source]¶
Info dictionary for SBaseRef.
- Parameters
sbaseref (libsbml.SBaseRef) – SBaseRef instance for which information dictionary is created
- Returns
information dictionary for SBaseRef
- Return type
Dict[str, Any]
- classmethod cvterms(sbase)[source]¶
Parse CVTerms information.
- Parameters
sbase (libsbml.SBase) – SBase instance
- Return type
Optional[List]
- classmethod model_history(sbase)[source]¶
Parse model history information.
:return
- Parameters
sbase (libsbml.SBase) –
- Return type
Optional[Dict]
- document(doc)[source]¶
Info for SBMLDocument.
- Parameters
doc (libsbml.SBMLDocument) – SBMLDocument
- Returns
information dictionary for SBMLDocument
- Return type
Dict[str, str]
- model(model)[source]¶
Info for SBML Model.
- Parameters
model (libsbml.Model) – Model
- Returns
information dictionary for Model
- Return type
Dict[str, str]
- function_definitions(model)[source]¶
Information dictionaries for FunctionDefinitions.
- Returns
list of info dictionaries for FunctionDefinitions
- Parameters
model (libsbml.Model) –
- Return type
List
- unit_definitions(model)[source]¶
Information for UnitDefinitions.
- Returns
list of info dictionaries for UnitDefinitions
- Parameters
model (libsbml.Model) –
- Return type
List
- compartments(model, assignments)[source]¶
Information for Compartments.
- Returns
list of info dictionaries for Compartments
- Parameters
model (libsbml.Model) –
assignments (Dict[str, Dict[str, str]]) –
- Return type
List[Dict]
- species(model, assignments)[source]¶
Information for Species.
- Returns
list of info dictionaries for Species
- Parameters
model (libsbml.Model) –
assignments (Dict[str, Dict[str, str]]) –
- Return type
List[Dict]
- parameters(model, assignments)[source]¶
Information for SBML Parameters.
- Returns
list of info dictionaries for Reactions
- Parameters
model (libsbml.Model) –
assignments (Dict[str, Dict[str, str]]) –
- Return type
List[Dict]
- initial_assignments(model)[source]¶
Information for InitialAssignments.
- Returns
list of info dictionaries for InitialAssignments
- Parameters
model (libsbml.Model) –
- Return type
List
- rules(model)[source]¶
Information for Rules.
- Returns
list of info dictionaries for Rules
- Parameters
model (libsbml.Model) –
- Return type
Dict
- static _rule_variable_to_string(rule)[source]¶
Format variable for rule.
- Parameters
rule (libsbml.Rule) – SBML rule instance
- Return type
str
:return formatted string representation of the rule
- constraints(model)[source]¶
Information for Constraints.
- Returns
list of info dictionaries for Constraints
- Parameters
model (libsbml.Model) –
- Return type
List[Dict[str, Any]]
- reactions(model)[source]¶
Information dictionaries for ListOfReactions.
- Returns
list of info dictionaries for Reactions
- Parameters
model (libsbml.Model) –
- Return type
List[Dict[str, Any]]
– take a look at local parameter once
- static _species_reference(species)[source]¶
Resolve species reference.
- Parameters
species (libsbml.SpeciesReference) –
- Return type
Dict[str, Any]
- static _bounds_dict_from_reaction(reaction, model)[source]¶
Render string of bounds from the reaction.
- Parameters
reaction (libsbml.Reaction) – SBML reaction instance
model (libsbml.Model) – SBML model instance
- Returns
String of bounds extracted from the reaction
- Return type
Optional[Dict]
- static _gene_product_association_from_reaction(reaction)[source]¶
Render string representation of the GeneProductAssociation for given reaction.
- Parameters
reaction (libsbml.Reaction) – SBML reaction instance
- Returns
string representation of GeneProductAssociation
- Return type
Optional[str]
- static _equation_from_reaction(reaction, sep_reversible='⇆', sep_irreversible='➞', modifiers=False)[source]¶
Create equation for reaction.
- Parameters
reaction (libsbml.Reaction) – SBML reaction instance for which equation is to be generated
sep_reversible (str) – escape sequence for reversible equation (<=>) separator
sep_irreversible (str) – escape sequence for irreversible equation (=>) separator
modifiers (bool) – boolean flag to use modifiers
- Return type
str
:return equation string generated for the reaction
- static _modifier_equation(modifierList)[source]¶
Render string representation for list of modifiers.
- Parameters
modifierList (libsbml.ListOfSpeciesReferences) – list of modifiers
- Returns
string representation for list of modifiers
- Return type
str
- static _half_equation(speciesList)[source]¶
Create equation string of the half reaction of the species in the species list.
- Parameters
speciesList (libsbml.ListOfSpecies) – list of species in the half reaction
- Returns
half equation string
- Return type
str
- events(model)[source]¶
Information dictionaries for Events.
- Returns
list of info dictionaries for Events
- Parameters
model (libsbml.Model) –
- Return type
List[Dict[str, Any]]
- model_definitions()[source]¶
Information for comp:ModelDefinitions.
- Returns
list of info dictionaries for comp:ModelDefinitions
- Return type
Dict
- submodels(model)[source]¶
Information dictionaries for comp:Submodels.
- Returns
list of info dictionaries for comp:Submodels
- Parameters
model (libsbml.Model) –
- Return type
List[Dict[str, Any]]
- ports(model)[source]¶
Information for comp:Ports.
- Returns
list of info dictionaries for comp:Ports
- Parameters
model (libsbml.Model) –
- Return type
List