Skip to content

Commit 36921c1

Browse files
authored
0.2.0 release (#15)
* Implemented SVD solution for MLE results * Added standard errors for state free energies and transition rates * `Multibind.effective_energy_difference` now returns an error estimate in addition to the macroscopic free energy difference * Added CHANGELOG and increased version to 0.2.0
1 parent f317900 commit 36921c1

32 files changed

Lines changed: 1232 additions & 436 deletions

.github/workflows/tests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ master, develop ]
6+
pull_request:
7+
branches: [ master, develop ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up Python 3.10
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: "3.10"
20+
- name: Install poetry
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install poetry
24+
- name: Install multibind with poetry
25+
run: |
26+
poetry install
27+
- name: Test with pytest
28+
run: |
29+
cd tests/
30+
poetry run pytest -v --cov=multibind --cov-report=xml
31+
- name: Upload coverage to Codecov
32+
uses: codecov/codecov-action@v2
33+
with:
34+
directory: .
35+
fail_ci_if_error: true
36+
files: coverage.xml
37+
name: codecov-umbrella
38+
verbose: true

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ __pycache__/
66
.pytest_cache
77
poetry.lock
88
dist/
9+
.coverage
10+
coverage.xml
11+
docs/build/
12+
docs/_build/
13+
docs/generated/

.readthedocs.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Build documentation in with Sphinx
9+
sphinx:
10+
configuration: docs/conf.py
11+
12+
# Set the version of Python and other tools you might need
13+
build:
14+
os: ubuntu-20.04
15+
tools:
16+
python: "3.9"
17+
18+
# Optionally set the version of Python and requirements required to build your docs
19+
python:
20+
install:
21+
- method: pip
22+
path: .

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2022-02-22 0.2.0
2+
ianmkenney
3+
4+
Fully functional with tests and basic documentation.
5+
For details see the git log.

README.md

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Multibind
22

33

4-
[![DOI](https://zenodo.org/badge/301552078.svg)](https://zenodo.org/badge/latestdoi/301552078)
4+
[![DOI](https://zenodo.org/badge/301552078.svg)](https://zenodo.org/badge/latestdoi/301552078) ![Tests](https://github.com/BecksteinLab/multibind/actions/workflows/tests.yml/badge.svg?branch=develop) [![codecov](https://codecov.io/gh/Becksteinlab/multibind/branch/develop/graph/badge.svg?token=7T3Z19P4W5)](https://codecov.io/gh/Becksteinlab/multibind) [![docs](https://readthedocs.org/projects/multibind/badge/?version=latest)](https://multibind.readthedocs.io/en/latest/?badge=latest)
55

66

77
Thermodynamic cycles which are defined by a set of individually determined free energy differences are not guaranteed to be thermodynamically consistent.
@@ -12,14 +12,14 @@ Additionally, multibind supports cycles whose free energies are dependent on mul
1212
## State definitions
1313

1414
States are minimally defined by a name and should be added to a csv file.
15-
Macrostates can be added as additional columns with the name of the category being the column header.
15+
Macrostate classes can be added as additional columns with the name of the class being the column header.
1616

1717
```text
18-
name,bound
19-
1,unbound
20-
2,bound
21-
3,bound
22-
4,unbound
18+
name,n_protons,n_sodium
19+
1,0,0
20+
2,0,1
21+
3,1,0
22+
4,1,1
2323
```
2424

2525
## Graph definition
@@ -30,12 +30,16 @@ These edges are the free energy differences between states and are characterized
3030
Multibind allows for three process type, which are specified under the ligand column:
3131

3232
- "H+": proton binding which takes as its free energy value, the pKa.
33-
- "helm": undefined process which takes a free energy directly in kT.
3433
- general ligand: binding of a general ligand. The standard state free energy in kT. By defining the concentration to build the cycle, this free energy becomes concentration dependent.
34+
- "helm": undefined process which takes a free energy directly in kT.
3535

36-
In defining the edges, always treat the free energies as going from state 1 to state 2.
36+
In defining the edges, always treat the free energies as going from state 1 to state 2 for that process.
37+
For 'H+', state 1 should be the deprotonated state and state 2 is the protonated state.
38+
For a general ligand, state 1 is the unbound state and state 2 is the bound state.
39+
Failure to do so will assign the negative of the desired free energy to that edge.
3740

3841
```text
42+
# graph.csv
3943
state1,state2,value,variance,ligand,standard_state
4044
1,2,-10,0.1,Na+,1
4145
2,3,5.697116,0.1,H+,1
@@ -45,16 +49,38 @@ state1,state2,value,variance,ligand,standard_state
4549

4650
## Example code
4751

52+
The standard `Multibind` object is used to solve the graph at one point in concentration space.
53+
4854
```python
4955
import multibind as mb
5056

57+
concentrations = {'Na': 0.150}
58+
5159
c = mb.Multibind()
5260
c.read_graph("examples/input/4-state-diamond/graph.csv",comment="#")
5361
c.read_states("examples/input/4-state-diamond/states.csv")
62+
c.concentrations = concentrations
5463
c.build_cycle(pH=7)
55-
c.MLE()
64+
c.MLE(svd=True)
5665
# compute the effective energy difference between two macrostates
5766
# if you are unsure of the values to pass to the function, look
5867
# at either your state file or the contents of c.states
59-
c.effective_energy_difference("Nprotons",1,2)
68+
c.effective_energy_difference("N_protons",1,2)
69+
```
70+
71+
The `MultibindScanner` can be used to scan across a bunch of concentrations.
72+
73+
```python
74+
import multibind as mb
75+
76+
state_file = 'examples/input/4-state-diamond/states.csv'
77+
graph_file = 'examples/input/4-state-diamond/graph.csv'
78+
79+
scanner = mb.MultibindScanner(state_file, graph_file, comment_char='#')
80+
81+
concentrations = {'H+': [7, 8, 9], 'Na+': [0.200, 0.150, 0.100]}
82+
# This will MLE calculations across 9 points in concentration space
83+
# the results will be in an xarray Dataset that can be accessed with
84+
# scanner.results
85+
scanner.run(concentrations, svd=True)
6086
```

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/api.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
API
2+
===
3+
4+
.. autosummary::
5+
:toctree: generated
6+
7+
multibind.multibind
8+
multibind.nonequilibrium

docs/conf.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
13+
import os
14+
import sys
15+
sys.path.insert(0, os.path.abspath('../'))
16+
17+
import multibind as mb
18+
19+
# -- Project information -----------------------------------------------------
20+
21+
project = 'multibind'
22+
copyright = '2022, Ian M. Kenney'
23+
author = 'Ian M. Kenney'
24+
25+
# The full version, including alpha/beta/rc tags
26+
release = mb.__version__
27+
28+
29+
# -- General configuration ---------------------------------------------------
30+
31+
# Add any Sphinx extension module names here, as strings. They can be
32+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33+
# ones.
34+
extensions = ['sphinx.ext.autodoc',
35+
'sphinx.ext.autosummary',
36+
]
37+
38+
# Add any paths that contain templates here, relative to this directory.
39+
templates_path = ['_templates']
40+
41+
# List of patterns, relative to source directory, that match files and
42+
# directories to ignore when looking for source files.
43+
# This pattern also affects html_static_path and html_extra_path.
44+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
45+
46+
47+
# -- Options for HTML output -------------------------------------------------
48+
49+
# The theme to use for HTML and HTML Help pages. See the documentation for
50+
# a list of builtin themes.
51+
#
52+
html_theme = 'default'
53+
54+
# Add any paths that contain custom static files (such as style sheets) here,
55+
# relative to this directory. They are copied after the builtin static files,
56+
# so a file named "default.css" will overwrite the builtin "default.css".
57+
html_static_path = ['_static']

docs/derivations.pdf

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/index.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.. multibind documentation master file, created by
2+
sphinx-quickstart on Tue Feb 15 11:00:52 2022.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Multibind documentation
7+
=======================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
usage
14+
api
15+
16+
Indices and tables
17+
==================
18+
19+
* :ref:`genindex`
20+
* :ref:`modindex`
21+
* :ref:`search`

0 commit comments

Comments
 (0)