Frequently Asked Questions (FAQs)

Have a question? Try searching the FAQs!

How do I install MASSpy?

There are several ways to install MASSpy. To use pip to install MASSpy from PyPI

pip install masspy

Check out the Quick Start Guide to learn more about getting started!

How do I cite MASSpy?

To cite the MASSpy software publication:

Haiman ZB, Zielinski DC, Koike Y, Yurkovich JT, Palsson BO (2021) MASSpy: Building, simulating, and visualizing dynamic biological models in Python using mass action kinetics. PLOS Computational Biology 17(1): e1008208. https://doi.org/10.1371/journal.pcbi.1008208

Additionally, please consider citing COBRApy, libRoadRunner, and other software dependencies of MASSpy! Citations and links to several dependencies as well as other useful literature sources are found in the Works Cited and Code Repositories sections of the documentation.

How do I change the rate expression for a reaction?

Use the MassModel.add_custom_rate() method.

[1]:
import mass.example_data

model = mass.example_data.create_example_model("textbook")
Set parameter Username

When metabolites are added to reactions, MASSpy will generates rate expressions automatically based on mass action kinetics and the kinetic reversibility given by the MassReaction.reversible attribute.

[2]:
print(model.reactions.PGI.rate)
kf_PGI*(g6p_c(t) - f6p_c(t)/Keq_PGI)

If a reaction is associated with a model, a custom rate expression can be set using the MassModel.add_custom_rate() method. The add_custom_rate() method requires the corresponding reaction object and a string representing the custom rate expression to set. For example, to set a simple Michaelis Menten rate expression with \(V_{max}\) and \(K_{m}\) parameters:

[3]:
custom_parameter_dict = {"vmax_PGI": None, "Km_PGI": None}

model.add_custom_rate(
    model.reactions.PGI,
    custom_rate="(vmax_PGI * g6p_c)/(Km_PGI + g6p_c)",
    custom_parameters=custom_parameter_dict)
print(model.reactions.PGI.rate)
vmax_PGI*g6p_c(t)/(Km_PGI + g6p_c(t))

The reaction rate expression is converted from a string to a symbolic expression using the sympy.sympify() function. All metabolites and standard reaction parameters (i.e. returned by the MassReaction.all_parameter_ids), and boundary conditions are recognized. However, all additional parameters must be set as a custom parameter in the MassModel.custom_parameters attribute.

[4]:
print("Recognized Parameters: {!r}".format(model.reactions.PGI.all_parameter_ids))
print("Custom Parameters: {!r}".format(list(custom_parameter_dict)))
Recognized Parameters: ['kf_PGI', 'Keq_PGI', 'kr_PGI', 'v_PGI']
Custom Parameters: ['vmax_PGI', 'Km_PGI']

Additional information about the underlying sympify() function can be found here.