IDEAS home Printed from https://ideas.repec.org/a/plo/pcbi00/1011761.html
   My bibliography  Save this article

PyRates—A code-generation tool for modeling dynamical systems in biology and beyond

Author

Listed:
  • Richard Gast
  • Thomas R Knösche
  • Ann Kennedy

Abstract

The mathematical study of real-world dynamical systems relies on models composed of differential equations. Numerical methods for solving and analyzing differential equation systems are essential when complex biological problems have to be studied, such as the spreading of a virus, the evolution of competing species in an ecosystem, or the dynamics of neurons in the brain.Here we present PyRates, a Python-based software for modeling and analyzing differential equation systems via numerical methods. PyRates is specifically designed to account for the inherent complexity of biological systems. It provides a new language for defining models that mirrors the modular organization of real-world dynamical systems and thus simplifies the implementation of complex networks of interacting dynamic entities. Furthermore, PyRates provides extensive support for the various forms of interaction delays that can be observed in biological systems.The core of PyRates is a versatile code-generation system that translates user-defined models into “backend” implementations in various languages, including Python, Fortran, Matlab, and Julia. This allows users to apply a wide range of analysis methods for dynamical systems, eliminating the need for manual translation between code bases.PyRates may also be used as a model definition interface for the creation of custom dynamical systems tools. To demonstrate this, we developed two extensions of PyRates for common analyses of dynamic models of biological systems: PyCoBi for bifurcation analysis and RectiPy for parameter fitting. We demonstrate in a series of example models how PyRates can be used in combination with PyCoBi and RectiPy for model analysis and fitting. Together, these tools offer a versatile framework for applying computational modeling and numerical analysis methods to dynamical systems in biology and beyond.Author summary: We present PyRates, a code-generation tool for dynamical systems modeling applied to biological systems. Together with its extensions PyCoBi and RectiPy, PyRates provides a framework for modeling and analyzing complex biological systems via methods such as parameter sweeps, bifurcation analysis, and model fitting. We highlight the main features of this framework, with an emphasis on new features that have been introduced since the initial publication of the software, such as the extensive code generation capacities and widespread support for delay-coupled systems. Using a collection of mathematical models taken from various fields of biology, we demonstrate how PyRates enables analysis of the behavior of complex nonlinear systems using a diverse suite of tools. This includes examples where we use PyRates to interface a bifurcation analysis tool written in Fortran, to optimize model parameters via gradient descent in PyTorch, and to serve as a model definition interface for new dynamical systems analysis tools.

Suggested Citation

  • Richard Gast & Thomas R Knösche & Ann Kennedy, 2023. "PyRates—A code-generation tool for modeling dynamical systems in biology and beyond," PLOS Computational Biology, Public Library of Science, vol. 19(12), pages 1-24, December.
  • Handle: RePEc:plo:pcbi00:1011761
    DOI: 10.1371/journal.pcbi.1011761
    as

    Download full text from publisher

    File URL: https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1011761
    Download Restriction: no

    File URL: https://journals.plos.org/ploscompbiol/article/file?id=10.1371/journal.pcbi.1011761&type=printable
    Download Restriction: no

    File URL: https://libkey.io/10.1371/journal.pcbi.1011761?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    References listed on IDEAS

    as
    1. Ko-Fei Liu & Hsin-Chi Li & Yu-Charn Hsu, 2009. "Debris flow hazard assessment with numerical simulation," Natural Hazards: Journal of the International Society for the Prevention and Mitigation of Natural Hazards, Springer;International Society for the Prevention and Mitigation of Natural Hazards, vol. 49(1), pages 137-161, April.
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Atta-ur Rahman & Amir Khan & Andrew Collins, 2014. "Analysis of landslide causes and associated damages in the Kashmir Himalayas of Pakistan," Natural Hazards: Journal of the International Society for the Prevention and Mitigation of Natural Hazards, Springer;International Society for the Prevention and Mitigation of Natural Hazards, vol. 71(1), pages 803-821, March.
    2. Han-Chung Yang & Cheng-Wu Chen, 2012. "Potential hazard analysis from the viewpoint of flow measurement in large open-channel junctions," Natural Hazards: Journal of the International Society for the Prevention and Mitigation of Natural Hazards, Springer;International Society for the Prevention and Mitigation of Natural Hazards, vol. 61(2), pages 803-813, March.
    3. Sajid Ali & Rashid Haider & Wahid Abbas & Muhammad Basharat & Klaus Reicherter, 2021. "Empirical assessment of rockfall and debris flow risk along the Karakoram Highway, Pakistan," Natural Hazards: Journal of the International Society for the Prevention and Mitigation of Natural Hazards, Springer;International Society for the Prevention and Mitigation of Natural Hazards, vol. 106(3), pages 2437-2460, April.
    4. Hsin-Chi Li & Tingyeh Wu & Hsiao-Ping Wei & Hung-Ju Shih & Yi-Chiung Chao, 2017. "Basinwide disaster loss assessments under extreme climate scenarios: a case study of the Kaoping River basin," Natural Hazards: Journal of the International Society for the Prevention and Mitigation of Natural Hazards, Springer;International Society for the Prevention and Mitigation of Natural Hazards, vol. 86(3), pages 1039-1058, April.
    5. Chia-Jeng Chen & Tsung-Yu Lee & Che-Min Chang & Jun-Yi Lee, 2018. "Assessing typhoon damages to Taiwan in the recent decade: return period analysis and loss prediction," Natural Hazards: Journal of the International Society for the Prevention and Mitigation of Natural Hazards, Springer;International Society for the Prevention and Mitigation of Natural Hazards, vol. 91(2), pages 759-783, March.
    6. Atta-ur-Rahman & Amir Khan & Andrew Collins & Fareen Qazi, 2011. "Causes and extent of environmental impacts of landslide hazard in the Himalayan region: a case study of Murree, Pakistan," Natural Hazards: Journal of the International Society for the Prevention and Mitigation of Natural Hazards, Springer;International Society for the Prevention and Mitigation of Natural Hazards, vol. 57(2), pages 413-434, May.
    7. Victor Carvalho Cabral & Fábio Augusto Gomes Vieira Reis & Fernando Mazo D’Affonseca & Ana Lucía & Claudia Vanessa Corrêa & Vinicius Veloso & Marcelo Fischer Gramani & Agostinho Tadashi Ogura & Andrea, 2021. "Characterization of a landslide-triggered debris flow at a rainforest-covered mountain region in Brazil," Natural Hazards: Journal of the International Society for the Prevention and Mitigation of Natural Hazards, Springer;International Society for the Prevention and Mitigation of Natural Hazards, vol. 108(3), pages 3021-3043, September.

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:plo:pcbi00:1011761. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: ploscompbiol (email available below). General contact details of provider: https://journals.plos.org/ploscompbiol/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.