Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
be57ad5
Change default parameter handling
Oct 24, 2022
9d952fc
Remove unnecessary line from test
Oct 24, 2022
2297bf9
Add first 4 models. Add tests to generate .mmt and graph files
Oct 24, 2022
ae770ab
Add tests for connectedness as reversibility. Add models 4,5
Oct 25, 2022
0b6f9d8
Fix draw_graph handling of transition rates
Nov 1, 2022
d502827
Add more models
Nov 1, 2022
beacf8f
Fix get_transition_matrix. Fix reversibility check. Add show_html swi…
Apr 28, 2023
8904c6b
Merge branch 'master' into fix_transition_matrix
Apr 28, 2023
051a36f
Add models 11 and 30. Remove duplicated test file
May 3, 2023
a4b97e2
Merge branch 'fix_transition_matrix' of github.com:CardiacModelling/M…
May 3, 2023
5310b55
Lint and isort
May 3, 2023
57415dc
Update test_parameterise_rates
May 3, 2023
f199b6f
Add test_30_models.py
May 3, 2023
79f7295
Add myokit files for testing
May 3, 2023
7e21caf
Update pytest.yml
May 3, 2023
0afb97b
Update pytest.yml
May 3, 2023
bc4c4c9
Make single quote use more consistent
Jun 13, 2023
2d6c990
Fix indentation. Distribute trajectories according to number of traje…
Jun 13, 2023
17027f4
Fix sympy depreciation warning (latex output)
Jun 13, 2023
fe4f333
Add test for dataclass exception (must be subclass of state_attribute…
Jun 13, 2023
23835be
Merge branch 'fix_transition_matrix' of github.com:CardiacModelling/M…
Jun 13, 2023
b6ef7da
Raise TypeError not Exception
Jun 13, 2023
215898f
Remove old, broken test output
Jun 13, 2023
de33024
Fix test_bad_dataclass_exception
Jun 13, 2023
4d86220
Remove unnecessary checks on attribute dataclass
Jun 13, 2023
fef0edf
Lint
Jun 13, 2023
f1e03cb
Add models
Jun 13, 2023
f58dcc7
Add some models with HH-style gating
Jun 16, 2023
c2ccada
Sort imports
Jun 16, 2023
93b454f
Fix myokit model generation
Jun 16, 2023
663313a
Modify model3 to be disconnected model
Aug 2, 2023
351f199
Update tests for disceonnected model_03. Add auxiliary_variables dict…
Aug 2, 2023
fed5036
Change model parameterisation
Sep 5, 2023
846a079
Standardise model parameterisation
Sep 6, 2023
205efd3
Fix model generation
Nov 14, 2023
6ed6f62
Simplify Kemp model into two connected components
Dec 6, 2023
a1a2777
Replace depcreciated np.NaN with np.nan
Jun 25, 2024
a9916e4
NaN -> nan
Jul 8, 2024
f440e56
Add model 20
Mar 17, 2025
aa7b755
Add model20.py
Mar 17, 2025
ab8aed9
Parameterise Mazhari model. Fix parameter bug
Mar 18, 2025
b5e072c
Change order of state addition
Mar 18, 2025
c4843a3
Reorder parameters
Mar 18, 2025
2f43fa2
Strenghten test for "get_eliminate_state..." Move permutation code to…
Oct 6, 2025
909b14b
Remove print
Oct 6, 2025
bd92d1c
Fix doctstring
Oct 7, 2025
a3dbc80
Update build system
Nov 20, 2025
a1206b3
Fix whitespace
Nov 20, 2025
cb10d50
Update docstrings, .gitignore, and type hints
Nov 27, 2025
b37b182
Update init and use clearer param names. Update models
Nov 27, 2025
1fc213e
Update models and tests
Nov 27, 2025
d277853
Simplify exception for undefined parameters
Nov 27, 2025
2c29004
Change error type to align with code
Nov 27, 2025
c62b4bd
More docstring change. Variable name change
Nov 28, 2025
7ee29d3
Lint
Nov 28, 2025
09c802a
Add drug_bound field by default
Nov 28, 2025
84f6bf2
Update param names. Remove debug format string
Nov 28, 2025
b997979
Turn off E501 "line too long"
Nov 28, 2025
f3da65d
Lint
Nov 28, 2025
b39677f
Remove () from class defn
Nov 28, 2025
3f166b5
Fix unused var
Nov 28, 2025
4654c81
Modify project setup for isort
Nov 28, 2025
94ecad8
Merge branch 'master' into HEAD
Nov 28, 2025
035f681
Update workflow
Nov 28, 2025
f42b1df
Update isort conf
Nov 28, 2025
32c6d39
Update isort settings (again)
Nov 28, 2025
95dedd7
Change isort settings
Nov 28, 2025
afd9926
Update isort settings
Nov 28, 2025
fb54457
Remove unnecessary "get" function
Nov 28, 2025
d6f257c
Fix docstrings using ruff. Add ruff and sphinx to docs optional depen…
Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ignore =
W504,
# missing whitespace around arithmetic operator
E226,
# Line length
E501
exclude=
.git,
venv,
venv,
4 changes: 3 additions & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install libsundials-dev -y
python -m pip install --upgrade pip
python -m pip install .[test]
- name: Lint with flake8
run: |
python -m flake8
- name: Import sorting with isort
run: |
python -m isort --verbose --check-only --diff markov_builder tests setup.py
python -m isort . --show-config
python -m isort --verbose --check-only --diff . --skip .venv
- name: Test with pytest
run: |
python -m pytest --cov --cov-config=.coveragerc
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ wheels/
*.egg
MANIFEST

markov_builder/_version.py

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
Expand Down Expand Up @@ -106,3 +108,8 @@ venv.bak/
# MacOS extensions
**.DS_Store

# Test output
test_output/*

# output
output/*
14 changes: 0 additions & 14 deletions .isort.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@


## Description
`markov_builder` is a Python package for constructing Markov models of ion-channel kinetics. These models may be thought of as chemical reaction networks where the transition rate matrix depends on the cell's transmembrane potential (and sometimes the concentration of a drug). This package uses 'networkx' to allow the user to specify the graph associated with the model (model topology). Many models of ion channel kinetics can be expressed in this way. For example, Markov models equivalent to Hodgkin-Huxley style conductance models are straightforward to generate. The transition rates may then be parameterised with any choice of equation, and depend on any number of 'shared variables' such as transmembrane potential, drug concentration, temperature, etc...
`markov_builder` is a Python package for constructing Markov models of ion-channel kinetics. These models may be thought of as chemical reaction networks where the transition rate matrix depends on the cell's transmembrane potential (and sometimes the concentration of a drug). This package uses 'networkx' to allow the user to specify the graph associated with the model (model topology). Many models of ion channel kinetics can be expressed in this way. For example, Markov models equivalent to Hodgkin-Huxley style conductance models are straightforward to generate. The transition rates may then be parameterised with any choice of equation, and depend on any number of 'shared variables' such as transmembrane potential, drug concentration, temperature, etc...

Given the graph for a model and a parameterisation, you may then:
1. Output latex describing the model
2. Visualise the model using pyvis
3. Output the system of equations as `sympy` expressions for use in other code
4. Model drug trapping by composing models together
5. Simulate a small number of channels using the Gillespie algorithm
6. Check the model satisfies properties such as microscopic reversibility and connectedness
6. Check the model satisfies properties such as microscopic reversibility and connectedness


## Getting Started
Expand Down
Loading