{"id":19339492,"url":"https://github.com/becksteinlab/kda","last_synced_at":"2025-04-23T02:30:48.375Z","repository":{"id":42361926,"uuid":"257095410","full_name":"Becksteinlab/kda","owner":"Becksteinlab","description":"Python package used for the analysis of biochemical kinetic diagrams.","archived":false,"fork":false,"pushed_at":"2025-04-20T13:58:09.000Z","size":6566,"stargazers_count":5,"open_issues_count":11,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T14:44:15.304Z","etag":null,"topics":["graph","kinetics","python"],"latest_commit_sha":null,"homepage":"https://kda.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Becksteinlab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-04-19T20:27:21.000Z","updated_at":"2025-04-16T04:20:07.000Z","dependencies_parsed_at":"2024-01-06T05:34:34.556Z","dependency_job_id":"cedad3e5-a4e8-438a-9ba5-b70ba2707516","html_url":"https://github.com/Becksteinlab/kda","commit_stats":{"total_commits":152,"total_committers":3,"mean_commits":"50.666666666666664","dds":"0.20394736842105265","last_synced_commit":"533d24336d0988c6135f3d2eea9440425b63d5f2"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Becksteinlab%2Fkda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Becksteinlab%2Fkda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Becksteinlab%2Fkda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Becksteinlab%2Fkda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Becksteinlab","download_url":"https://codeload.github.com/Becksteinlab/kda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250357551,"owners_count":21417305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graph","kinetics","python"],"created_at":"2024-11-10T03:22:27.870Z","updated_at":"2025-04-23T02:30:48.353Z","avatar_url":"https://github.com/Becksteinlab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Kinetic Diagram Analysis\n==============================\n[//]: # (Badges)\n[![CI](https://github.com/Becksteinlab/kda/actions/workflows/test.yml/badge.svg)](https://github.com/Becksteinlab/kda/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/Becksteinlab/kda/branch/master/graph/badge.svg)](https://codecov.io/gh/Becksteinlab/kda/branch/master)\n[![Documentation Status](https://readthedocs.org/projects/kda/badge/?version=latest)](https://kda.readthedocs.io/en/latest/?badge=latest)\n[![asv](http://img.shields.io/badge/benchmarked%20by-asv-blue.svg?style=flat)](https://github.com/Becksteinlab/kda/actions/workflows/test.yml)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5826393.svg)](https://doi.org/10.5281/zenodo.5826393)\n\nPython package used for the analysis of biochemical kinetic diagrams using the diagrammatic approach developed by [T.L. Hill](https://link.springer.com/book/10.1007/978-1-4612-3558-3).\n\n**WARNING:** this software is in flux and is not API stable.\n\n## Examples\n\nKDA has a host of capabilities, all beginning with defining the connections and reaction rates (if desired) for your system. This is done by constructing an `NxN`array with diagonal values set to zero, and off-diagonal values `(i, j)` representing connections (and reaction rates) between states `i` and `j`. If desired, these can be the edge weights (denoted `kij`), but they can be specified later.\n\nThe following is an example for a simple 3-state model with all nodes connected:\n```python\nimport numpy as np\nimport kda\n\n# define matrix with reaction rates set to 1\nK = np.array(\n    [\n        [0, 1, 1],\n        [1, 0, 1],\n        [1, 1, 0],\n    ]\n)\n# create a KineticModel from the rate matrix\nmodel = kda.KineticModel(K=K, G=None)\n# get the state probabilities in numeric form\nmodel.build_state_probabilities(symbolic=False)\nprint(\"State probabilities: \\n\", model.probabilities)\n# get the state probabilities in expression form\nmodel.build_state_probabilities(symbolic=True)\nprint(\"State 1 probability expression: \\n\", model.probabilities[0])\n```\n\nThe output from the above example:\n```bash\n$ python example.py\nState probabilities:\n [0.33333333 0.33333333 0.33333333]\nState 1 probability expression:\n (k21*k31 + k21*k32 + k23*k31)/(k12*k23 + k12*k31 + k12*k32\n    + k13*k21 + k13*k23 + k13*k32 + k21*k31 + k21*k32 + k23*k31)\n```\nAs expected, the state probabilities are equal because all edge weights are set to a value of 1.\n\nAdditionally, the transition fluxes (one-way or net) can be calculated from the `KineticModel`:\n```python\n# make sure the symbolic probabilities have been generated\nmodel.build_state_probabilities(symbolic=True)\n# iterate over all edges\nprint(\"One-way transition fluxes:\")\nfor (i, j) in model.G.edges():\n    flux = model.get_transition_flux(state_i=i+1, state_j=j+1, net=False, symbolic=True)\n    print(f\"j_{i+1}{j+1} = {flux}\")\n```\n\nThe output from the above example:\n```bash\n$ python example.py\nOne-way transition fluxes:\nj_12 = (k12*k21*k31 + k12*k21*k32 + k12*k23*k31)/(k12*k23 + k12*k31 + k12*k32 + k13*k21 + k13*k23 + k13*k32 + k21*k31 + k21*k32 + k23*k31)\nj_13 = (k13*k21*k31 + k13*k21*k32 + k13*k23*k31)/(k12*k23 + k12*k31 + k12*k32 + k13*k21 + k13*k23 + k13*k32 + k21*k31 + k21*k32 + k23*k31)\nj_21 = (k12*k21*k31 + k12*k21*k32 + k13*k21*k32)/(k12*k23 + k12*k31 + k12*k32 + k13*k21 + k13*k23 + k13*k32 + k21*k31 + k21*k32 + k23*k31)\nj_23 = (k12*k23*k31 + k12*k23*k32 + k13*k23*k32)/(k12*k23 + k12*k31 + k12*k32 + k13*k21 + k13*k23 + k13*k32 + k21*k31 + k21*k32 + k23*k31)\nj_31 = (k12*k23*k31 + k13*k21*k31 + k13*k23*k31)/(k12*k23 + k12*k31 + k12*k32 + k13*k21 + k13*k23 + k13*k32 + k21*k31 + k21*k32 + k23*k31)\nj_32 = (k12*k23*k32 + k13*k21*k32 + k13*k23*k32)/(k12*k23 + k12*k31 + k12*k32 + k13*k21 + k13*k23 + k13*k32 + k21*k31 + k21*k32 + k23*k31)\n```\n\nContinuing with the previous example, the KDA `plotting` module can be leveraged to display the diagrams that lead to the above probability expression:\n```python\nimport os\nfrom kda import plotting\n\n# generate the directional diagrams\nmodel.build_directional_diagrams()\n# get the current working directory\ncwd = os.getcwd()\n# specify the positions of all nodes in NetworkX fashion\nnode_positions = {0: [0, 1], 1: [-0.5, 0], 2: [0.5, 0]}\n# plot and save the input diagram\nplotting.draw_diagrams(model.G, pos=node_positions, path=cwd, label=\"input\")\n# plot and save the directional diagrams as a panel\nplotting.draw_diagrams(\n    model.directional_diagrams,\n    pos=node_positions,\n    path=cwd,\n    cbt=True,\n    label=\"directional_panel\",\n)\n```\n\nThis will generate two files, `input.png` and `directional_panel.png`, in your current working directory:\n\n#### `input.png`\n\u003cimg src=\"https://github.com/Becksteinlab/kda-examples/blob/master/kda_examples/test_model_3_state/diagrams/input.png\" width=300, alt=\"3-state model input diagram\"\u003e\n\n#### `directional_panel.png`\n\u003cimg src=\"https://github.com/Becksteinlab/kda-examples/blob/master/kda_examples/test_model_3_state/diagrams/directional.png\" width=300, alt=\"3-state model directional diagrams\"\u003e\n\n**NOTE:** For more examples (like the following) visit the [KDA examples](https://github.com/Becksteinlab/kda-examples) repository:\n\n\u003cimg src=\"https://github.com/Becksteinlab/kda-examples/blob/master/kda_examples/test_model_4_state_leakage/diagrams/input.png\" width=250, alt=\"4-state model with leakage input diagram\"\u003e \u003cimg src=\"https://github.com/Becksteinlab/kda-examples/blob/master/kda_examples/test_model_5_state_leakage/diagrams/input.png\" width=250, alt=\"5-state model with leakage input diagram\"\u003e \u003cimg src=\"https://github.com/Becksteinlab/kda-examples/blob/master/kda_examples/test_model_6_state_leakage/diagrams/input.png\" width=250, alt=\"6-state model with leakage input diagram\"\u003e\n\n## Installation\n### Development version from source\n\nTo install the latest development version from source, run\n```bash\ngit clone git@github.com:Becksteinlab/kda.git\ncd kda\npython setup.py install\n```\n\n## Citation\n\nWhen using Kinetic Diagram Analysis in published work, please cite the following paper:\n\n*   N. C. Awtrey and O. Beckstein. Kinetic Diagram Analysis: A Python Library for Calculating\n    Steady-State Observables of Biochemical Systems Analytically. *J. Chem. Theory Comput.* **2024**, *30*(17), 7646–7666. doi: [10.1021/acs.jctc.4c00688](https://pubs.acs.org/doi/10.1021/acs.jctc.4c00688)\n\n\n## Copyright\n\nCopyright (c) 2020, Nikolaus Awtrey\n\n## Acknowledgements\n\nProject based on the\n[Computational Molecular Science Python Cookiecutter](https://github.com/molssi/cookiecutter-cms) version 1.2.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecksteinlab%2Fkda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbecksteinlab%2Fkda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecksteinlab%2Fkda/lists"}