<jupyter_start><jupyter_text>How to create a new bioscrape model?Creating a bioscrape model is simple, you could use the bioscrape API to write a simple Python script to generate the bioscrape XML, or you could simple write your own bioscrape XML file. This notebook describes both of these methods.You could also import SBML models into bioscrape, this is demonstrated at the end.  Using bioscrape Python APIWe will create a model for the following simple chemical reaction system $\emptyset \xrightarrow[]{k_1} X \; \; \; \; X \xrightarrow[]{d_1} \emptyset$<jupyter_code>from bioscrape.types import Model

species = ['X']
reactions = [(['X'], [], 'massaction', {'k':'d1'}), ([], ['X'], 'massaction', {'k':'k1'})]
k1 = 10.0
d1 = .2
params = [('k1', k1), ('d1', d1)]
initial_condition = {'X':0}
M = Model(species = species, reactions = reactions, parameters = params, 
          initial_condition_dict = initial_condition)<jupyter_output><empty_output><jupyter_text>Now write the model to an XML file (the XML file is printed here as well)<jupyter_code>M.write_bioscrape_xml('models/txtl_model.xml')
f = open('models/txtl_model.xml')
print("Bioscrape Model XML:\n", f.read())<jupyter_output>Bioscrape Model XML:
 <model>
<species name="X" value="0.0" />

<parameter name="d1" value="0.2" />
<parameter name="k1" value="10.0" />

<reaction text= "X -- ">
	<propensity type="massaction" k="d1" species="X" />
	<delay type="none" />
</reaction>
<reaction text= "-- X ">
	<propensity type="massaction" k="k1" species="" />
	<delay type="none" />
</reaction>

</model><jupyter_text>Use bioscrape XML specification languageTo directly write the bioscrape XML model, use the following guideline available at this linkhttps://github.com/ananswam/bioscrape/wiki/BioSCRAPE-XML  Import SBML model into bioscrape<jupyter_code>from bioscrape.sbmlutil import import_sbml
from bioscrape.types import Model
M = Model()
M_imported = import_sbml('models/repressilator_sbml.xml', bioscrape_model = M)<jupyter_output>C:\Users\apand\Anaconda3\lib\site-packages\bioscrape\sbmlutil.py:186: UserWarning: Compartments, UnitDefintions, Events, and some other SBML model components are not recognized by bioscrape. Refer to the bioscrape wiki for more information.
  warnings.warn('Compartments, UnitDefintions, Events, and some other SBML model components are not recognized by bioscrape. ' +<jupyter_text>M_imported is the bioscrape Model object imported from the SBML filename above.<jupyter_code>M_imported.get_species_dictionary()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12450748620961387, 'fraction_numerical': 0.01182033096926714, 'mean_word_length': 5.806970509383378, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '85312', 'license': 'MIT', 'n_tokens_mistral': 887, 'n_tokens_neox': 816, 'n_words': 251, 'path': 'examples/Create a bioscrape model - Tutorial.ipynb', 'repo_name': 'zoltuz/bioscrape', 'size': '2538'}