BMSS.sbml
BMSS.sbml.sbml_converter
BMSS.sbml.OnlinetoConfig module
This module contains functions to generate config file to be used within BMSS2.
Features: -to generate SBML string from a online database -to generate Config File from SBML string -to generate Setting Template File from SBML string for BMSS simulation
- BMSS.sbml.OnlinetoConfig.Convert(string)
Converts string into list New row based on occurence of “n”
- BMSS.sbml.OnlinetoConfig.Convertplus(string)
Converts string into list New row based on occurence of “+”
- BMSS.sbml.OnlinetoConfig.build_section(section, settings, key)
Builds Section according to key
- Parameters
section – config file statement in string format
settings – settings in nested dictionary format
key – variable that determines which if statement to follow, string format
- Returns
updated section in string format
- BMSS.sbml.OnlinetoConfig.build_section_top(settings, key)
Build section for top only of config file
- Parameters
settings – settings in nested dictionary format
key – variable that determines which if statement to follow, string format
- Returns
top section in string format
- BMSS.sbml.OnlinetoConfig.build_settings(idstore, valuestore)
Combines the IDs with their respective values
- Parameters
idstore – all IDs in list format
valuestore – all values of IDS in list format
- Returns
matched ID to values in dictionary format
- BMSS.sbml.OnlinetoConfig.clean_compartment(antimony_str)
Finds the compartment to remove it from equations for simplicity
- Parameters
antimony_str – antimony string in string format
- Returns
compartment name in string format
- BMSS.sbml.OnlinetoConfig.clean_eqns(store_species)
Converts Reaction statements in antimony str into format in config file. Returns a multiplier for reaction
- Parameters
store_species – ID of species in reaction
- Returns store_species
list format if reactions have more than 1 variable in reaction
- Returns store_species
string format if reactions only have 1 variable in reaction
- Returns species_multiplier
list format if reactions have more than 1 variable in reaction
- Returns species_multiplier
string format if reactions only have 1 variable in reaction
- BMSS.sbml.OnlinetoConfig.clean_id(store)
Finds the IDs within the parsed data
- Parameters
store – stored Species/Parameters data in list format
- Returns
IDs for Species/Parameters in list format
- BMSS.sbml.OnlinetoConfig.clean_reactions(reaction)
Cleans up reactions by combining equations pertaining to the same species
- Parameters
reaction – Raw equations before cleaning in list format
- Returns
cleaned reactions in list format
- BMSS.sbml.OnlinetoConfig.clean_units(store)
Finds the Units for Parameters if declared Feels in default units if not delcared (per_sec)
- Parameters
store – List containing parsed data from Species/Parameters
- Returns
full units in list format
- BMSS.sbml.OnlinetoConfig.clean_value(value, store_clean)
Finds the values within parsed data
- Parameters
value – Line from parsed data in string format
store_clean – Existing Values for Species/Parameters in list format
- Returns
New added values for Species/Parameters in list format
- BMSS.sbml.OnlinetoConfig.eqnreplace(tempstore)
Removes unnecessary keys in reaction statement
- Parameters
tempstore – equation statement in strign format
- Returns
clean statement in string format
- BMSS.sbml.OnlinetoConfig.gen_cleanvalue(store)
Fills in ‘0’ amount for Species and Parameters without initial values
- Parameters
store – List containing parsed data from Species/Parameters
- Returns
Full Values for Species/Parameters in list format
- BMSS.sbml.OnlinetoConfig.gen_config(settings, system_type, tspan)
Generates config statment for config file
- Parameters
settings – Nested Dictionary for all settings
system_type – System Type of Model defined in String Format
tspan – Tspan of Model defined in String Format
- Returns
full config statement in string format
- BMSS.sbml.OnlinetoConfig.gen_description(desc_list)
Generates Description section
- Parameters
desc_list – parsed description data from XML in list format
- Returns
cleaned description in string format
- BMSS.sbml.OnlinetoConfig.gen_dictionary(data)
Passes XML data through beautifulsoup parser making data more easily readable
- Parameters
data – SBML string in XML string format
- Returns
all required data in list format
- BMSS.sbml.OnlinetoConfig.gen_eqns(antimony_str)
Generates all equations from assignment rules, rate rules and reactions
- Parameters
antimony_str – antimony string in string format
- Returns
all equations in list format
- BMSS.sbml.OnlinetoConfig.gen_prior_bounds(settings)
Generates Priors and Bounds from settings
- Parameters
settings – settings in nested dictionary format
- Returns
priors and bounds in string format
- BMSS.sbml.OnlinetoConfig.gen_reactions(antimony_str)
Generates the all rate rules equations from reactions from antimony string
- Parameters
antimony_str – antimony string in string format
- Returns
all reactions in list format
- BMSS.sbml.OnlinetoConfig.gen_reference(Bs_data)
Generates Reference section
- Parameters
string – parsed description data from XML
- Returns
cleaned reference in string format
- BMSS.sbml.OnlinetoConfig.gen_settingstemplate(settings, system_type, tspan, Model_name)
Generates settings template for Tutorial 2 Simulation
- Parameters
settings – Nested Dictionary for all settings
system_type – System Type of Model defined in String Format
tspan – Tspan of Model defined in String Format
Model_name – Name of Model defined in String Format, Used to name files
- Returns
full settings template in string format
- BMSS.sbml.OnlinetoConfig.gen_species_parameter_descriptions(antimony_str, species_dict, parameter_dict)
Generates Species and Parameter Descriptions if defined.
- Parameters
antimony_str – SBML Model converted to Antimony format string
species_dict – dictionary containing all species in model
parameter_dict – dictionary containing all species in model
- Returns
species and parameter description in string format
- BMSS.sbml.OnlinetoConfig.get_negreaction(reaction_formula_store, value, reaction_reactant_start, reaction_reactant_end, reactioneqns)
Gets the reaction equation is the reactions shows a usage of a reactant
- Parameters
reaction_formula_store – List containing all reactions
value – Line of equation in reaction in string format
reaction_reactant_start – Index number of the position of the start of the ID
reaction_reactant_end – Index number of the position of the end of the ID
reactioneqns – reaction equation in string format
- Returns
added “use reactant” reactions in list format
- BMSS.sbml.OnlinetoConfig.get_posreaction(reaction_formula_store, value, reaction_reactant_end, reaction_product_end, reactioneqns)
Gets the reaction equation is the reactions creates only a product
- Parameters
reaction_formula_store – List containing all reactions
value – Line of equation in reaction in string format
reaction_reactant_end – Index number of the position of the start of the ID
reaction_product_end – Index number of the position of the end of the ID
reactioneqns – reaction equation in string format
- Returns
added “create product” reactions in list format
- BMSS.sbml.OnlinetoConfig.sbmltoconfig(sbmlstr, system_type, output_path, tspan=None)
Generates the config file statment and nested dictionary.
- Parameters
sbmlstr – SBML string in string format
system_type – System Type of Model defined in String Format
tspan – Tspan of Model defined in String Format
Model_name – Name of Model defined in String Format, Used to name files
- Returns
config file in string format and nested dictionary for settings
- BMSS.sbml.OnlinetoConfig.xmlclean(xmldata)
Cleans away xml related characters
- Parameters
xmldata – parsed data from XML
- Returns
cleaned text in string format