Skip to main content
Log in

Reactamole: functional reactive molecular programming

  • Published:
Natural Computing Aims and scope Submit manuscript

Abstract

Chemical reaction networks (CRNs) are an important tool for molecular programming. This field is rapidly expanding our ability to deploy computer programs into biological systems for various applications. However, CRNs are also difficult to work with due to their massively parallel nature, leading to the need for higher-level languages that allow for more straightforward computation with CRNs. Recently, research has been conducted into various higher-level languages for deterministic CRNs but modeling CRN parallelism, managing error accumulation, and finding natural CRN representations are ongoing challenges. We introduce Reactamole, a higher-level language for deterministic CRNs that utilizes the functional reactive programming (FRP) paradigm to represent CRNs as a reactive dataflow network. Reactamole equates a CRN with a functional reactive program, implementing the key primitives of the FRP paradigm directly as CRNs. The functional nature of Reactamole makes reasoning about molecular programs easier, and its strong static typing allows us to ensure that a CRN is well-formed by virtue of being well-typed. In this paper, we describe the design of Reactamole and how we use CRNs to represent the common datatypes and operations found in FRP. We demonstrate the potential of this functional reactive approach to molecular programming by giving an extended example where a CRN is constructed using FRP to modulate and demodulate an amplitude-modulated signal. We also show how Reactamole can be used to specify abstract CRNs whose structure depends on the reactions and species of its input, allowing users to specify more general CRN behaviors.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9

Similar content being viewed by others

Notes

  1. Reactamole is available at https://github.com/digMP/haskell-reactamole.

References

  • Angluin D, Aspnes J, Diamadi Z, Fischer MJ, Peralta R (2006) Computation in networks of passively mobile finite-state sensors. Distrib Comput 18(4):235–253

    Article  Google Scholar 

  • Aris R (1964) Prolegomena to the rational analysis of systems of chemical reactions. Arch Ration Mech Anal 19(2):81–99

    Article  MathSciNet  Google Scholar 

  • Badelt S, Shin SW, Johnson RF, Dong Q, Thachuk C, Winfree E (2017) A general-purpose CRN-to-DSD compiler with formal verification, optimization, and simulation capabilities. In: Brijder R, Qian L (eds) DNA computing and molecular programming. Springer, Cham, pp 232–248

    Chapter  Google Scholar 

  • Bainomugisha E, Carreton AL, Cutsem TV, Mostinckx S, de Meuter W (2013) A survey on reactive programming. ACM Comput Surv 45(4):1–34

    Article  Google Scholar 

  • Bournez O, Graça DS, Pouly A (2017a) Polynomial time corresponds to solutions of polynomial ordinary differential equations of polynomial length. J ACM 64(6):1–76

  • Bournez O, Graça D, Pouly A (2017b) On the functions generated by the general purpose analog computer. Inf Comput 257:34–57

  • Calzone L, Fages F, Soliman S (2006) BIOCHAM: an environment for modeling biological systems and formalizing experimental knowledge. Bioinformatics 22(14):1805–1807

    Article  Google Scholar 

  • Cardelli L (2020) Kaemika App: integrating protocols and chemical simulation. In: Abate A, Petrov T, Wolf V (eds) Computational methods in systems biology. Springer, Cham, pp 373–379

    Chapter  Google Scholar 

  • Cook M, Soloveichik D, Winfree E, Bruck J (2009) Programmability of chemical reaction networks. In: Condon A, Harel D, Kok JN, Salomaa A, Winfree E (eds) Algorithmic bioprocesses. Springer, Berlin, pp 543–584

    Chapter  Google Scholar 

  • Courtney A (2001) Frappé: functional reactive programming in Java. In: Proceedings of the third international symposium on practical aspects of declarative languages, PADL’01. Springer, Berlin, pp 29–44

  • Czaplicki E, Chong S (2013) Asynchronous functional reactive programming for GUIs. In: Proceedings of the 34th ACM SIGPLAN conference on Programming language design and implementation - PLDI’13. ACM Press, Seattle, p 411

  • Doty D, Eftekhari M, Gąsieniec L, Severson E, Uznański P, Stachowiak G (2022) A time and space optimal stable population protocol solving exact majority. In: 2021 IEEE 62nd annual symposium on foundations of computer science (FOCS), pp 1044–1055

  • Elliott CM (2009) Push–pull functional reactive programming. In: Proceedings of the 2nd ACM SIGPLAN symposium on Haskell, Haskell’09. Association for Computing Machinery, New York, pp 25–36

  • Elliott C, Hudak P (1997) Functional reactive animation. In: Proceedings of the second ACM SIGPLAN international conference on Functional programming—ICFP’97. ACM Press, Amsterdam, pp 263–273

  • Ellis SJ, Klinge TH, Lathrop JI (2019) Robust chemical circuits. Biosystems 186:103983

    Article  Google Scholar 

  • Epstein IR, Pojman JA (1998) An introduction to nonlinear chemical dynamics: oscillations, waves, patterns, and chaos. Oxford University Press, Oxford

    Book  Google Scholar 

  • Fages F, Soliman S (2018) On robustness computation and optimization in BIOCHAM-4. In: Computational methods in systems biology. Springer, Cham, pp 292–299

  • Fages F, Le Guludec G, Bournez O, Pouly A (2017) Strong turing completeness of continuous chemical reaction networks and compilation of mixed analog–digital programs. In: Feret J, Koeppl H (eds) Computational methods in systems biology. Springer, Cham, pp 108–127

    Chapter  Google Scholar 

  • Feinberg M (2019) Foundations of chemical reaction network theory. Springer, Cham

    Book  Google Scholar 

  • Finkbeiner B, Klein F, Piskac R, Santolucito M (2019) Synthesizing functional reactive programs. arXiv:1905.09825 [cs]

  • Gibbons J, Wu N (2014) Folding domain-specific languages: deep and shallow embeddings (functional pearl). In: Proceedings of the 19th ACM SIGPLAN international conference on functional programming, ICFP’14. Association for Computing Machinery, New York, pp 339–347

  • Hemery M, Fages F, Soliman S (2021) Compiling elementary mathematical functions into finite chemical reaction networks via a polynomialization algorithm for ODEs. In: Cinquemani E, Paulevé L (eds) Computational methods in systems biology. Springer, Cham, pp 74–90

    Chapter  Google Scholar 

  • Hudak P, Courtney A, Nilsson H, Peterson J (2002) Arrows, robots, and functional reactive programming. In: Advanced functional programming

  • Hughes J (2000) Generalising monads to arrows. Sci Comput Program 37(1):67–111

    Article  MathSciNet  Google Scholar 

  • Hughes J, O’Donnell J (1990) Expressing and reasoning about non-deterministic functional programs. In: Davis K, Hughes J (eds) Functional programming. Springer, London, pp 308–328

    Chapter  Google Scholar 

  • Jeffrey A (2012) LTL types FRP: linear-time temporal logic propositions as types, proofs as functional reactive programs. In: Proceedings of the sixth workshop on Programming languages meets program verification—PLPV’12. ACM Press, Philadelphia, p 49

  • Klinge TH, Lathrop JI (2020) Modulated signals in chemical reaction networks. CoRR, abs/2009.06703

  • Klinge TH, Lathrop JI, Lutz JH (2020a) Robust biomolecular finite automata. Theor Comput Sci 816:114–143

  • Klinge TH, Lathrop JI, Moreno S, Potter HD, Raman NK, Riley MR (2020b) ALCH: an imperative language for chemical reaction network-controlled tile assembly. In: Geary C, Patitz MJ (eds) 26th International conference on DNA computing and molecular programming (DNA 26), vol. 174 of Leibniz International Proceedings in Informatics (LIPIcs). Schloss Dagstuhl-Leibniz-Zentrum für Informatik, Dagstuhl, pp 6:1–6:22

  • Krantz SG, Parks HR (2002) A primer of real analytic functions. Springer, Boston

  • Lakin MR, Youssef S, Polo F, Emmott S, Phillips A (2011) Visual DSD: a design and analysis tool for DNA strand displacement systems. Bioinformatics 27(22):3211–3213

    Article  Google Scholar 

  • Nilsson H (2005) Dynamic optimization for functional reactive programming using generalized algebraic data types. In: Proceedings of the tenth ACM SIGPLAN international conference on functional programming, ICFP’05. Association for Computing Machinery, New York, pp 54–65

  • Nilsson H, Courtney A, Peterson J (2002) Functional reactive programming, continued. In: Proceedings of the 2002 ACM SIGPLAN workshop on Haskell, Haskell’02. Association for Computing Machinery, New York, pp 51–64

  • Ott J, Loveless T, Curtis C, Lesani M, Brisk P (2018) BioScript: programming safe chemistry on laboratories-on-a-chip. Proc ACM Program Lang 2(OOPSLA):1–31

    Article  Google Scholar 

  • Paterson R (2001) A new notation for arrows. Sigplan Not SIGPLAN 36:229–240

    Article  Google Scholar 

  • Pembeci I, Nilsson H, Hager G (2002) Functional reactive robotics: an exercise in principled integration of domain-specific languages. In: Proceedings of the 4th ACM SIGPLAN international conference on principles and practice of declarative programming, PPDP’02. Association for Computing Machinery, New York, pp 168–179

  • Shannon CE (1941) Mathematical theory of the differential analyzer. J Math Phys 20(1–4):337–354

    Article  MathSciNet  Google Scholar 

  • Soloveichik D (2008) Robust stochastic chemical reaction networks and bounded tau-leaping. CoRR, abs/0803.1030

  • Soloveichik D, Cook M, Winfree E, Bruck J (2008) Computation with finite stochastic chemical reaction networks. Nat Comput 7:615

    Article  MathSciNet  Google Scholar 

  • Vasić M, Soloveichik D, Khurshid S (2020) CRN++: molecular programming language. Nat Comput 19(2):391–407

    Article  MathSciNet  Google Scholar 

  • Wan Z, Hudak P (2000) Functional reactive programming from first principles. In: Proceedings of the ACM SIGPLAN 2000 conference on programming language design and implementation, PLDI’00. Association for Computing Machinery, New York, pp 242–252

  • Wan Z, Taha W, Hudak P (2001) Real-time FRP. In: Proceedings of the ACM SIGPLAN international conference on functional programming, ICFP, vol 36

Download references

Acknowledgements

The authors also thank the anonymous reviewers for their suggestions and feedback.

Funding

This work was funded in part by National Science Foundation Grants 2049911, 1651817, 1545028, 1900716, and 1909688.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to James I. Lathrop.

Ethics declarations

Conflict of interest

The authors have no relevant financial or non-financial interests to disclose.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Klinge, T.H., Lathrop, J.I., Osera, PM. et al. Reactamole: functional reactive molecular programming. Nat Comput (2024). https://doi.org/10.1007/s11047-024-09982-5

Download citation

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11047-024-09982-5

Keywords

Mathematics Subject Classification

Navigation