makise-bio 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MAKISE Bio contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include README.md LICENSE
2
+ recursive-include tests *.py
3
+ recursive-include examples *.py
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.4
2
+ Name: makise-bio
3
+ Version: 0.1.0
4
+ Summary: Molecular association analysis, combinatorial search and quantitative systems exploration
5
+ License-Expression: MIT
6
+ Keywords: bioinformatics,protein interactions,mutagenesis,systems biology,optimization
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: numpy>=1.24
19
+ Requires-Dist: scipy>=1.10
20
+ Requires-Dist: networkx>=3.0
21
+ Provides-Extra: test
22
+ Requires-Dist: pytest>=7; extra == "test"
23
+ Provides-Extra: release
24
+ Requires-Dist: build>=1.2; extra == "release"
25
+ Requires-Dist: twine>=5; extra == "release"
26
+ Dynamic: license-file
27
+
28
+ # MAKISE Bio
29
+
30
+ **Molecular Association Knowledge Integration and Systems Exploration**
31
+
32
+ MAKISE Bio is a Python library for molecular association analysis, multiscale representation, combinatorial optimization and quantitative systems biology. It provides algorithms for searching compatible configurations, composing molecular transformations, resolving partially observed systems and evaluating network and biochemical models.
33
+
34
+ ## Installation
35
+
36
+ ```sh
37
+ pip install makise-bio
38
+ ```
39
+
40
+ Python 3.10 or later is required. The dependencies are NumPy, SciPy and NetworkX.
41
+
42
+ ## Association observations
43
+
44
+ `AssociationProfiles` accepts an iterable of mappings with the following fields:
45
+
46
+ | Field | Description |
47
+ | --- | --- |
48
+ | `id` | Unique string or integer identifying the observation |
49
+ | `protein` | Focal molecular component |
50
+ | `variant` | Label of the molecular configuration |
51
+ | `study` | Identifier of a comparable experimental context |
52
+ | `readout` | Mapping of partner identifiers to categorical association effects |
53
+ | `edits` | Optional sequence of elementary transformation identifiers |
54
+
55
+ Association effects are `loss`, `down`, `same`, `up` and `gain`. List partners with measured effects. The collection retains additional fields. Assign a common study identifier to observations sharing a reference and comparable experimental conditions. For genotype comparisons, supply one association profile per edit set within each molecular and experimental context. By default, semicolon-separated variant labels are interpreted as elementary edits; supply `edits` explicitly for other representations.
56
+
57
+ ```python
58
+ from makise_bio import AssociationProfiles, Biology, Program
59
+
60
+ profiles = AssociationProfiles([
61
+ {"id": "v1", "protein": "A", "variant": "A10V", "study": "s1",
62
+ "readout": {"B": "loss", "C": "same"}},
63
+ {"id": "v2", "protein": "A", "variant": "G20A", "study": "s1",
64
+ "readout": {"B": "loss", "C": "same"}},
65
+ {"id": "v3", "protein": "A", "variant": "A10V;G20A", "study": "s1",
66
+ "readout": {"B": "same", "C": "same"}},
67
+ ])
68
+
69
+ for result in profiles.scan(depth=4):
70
+ print(result)
71
+
72
+ with Biology.from_profiles(profiles) as biology:
73
+ print(biology.search(strategy="compensatory_rescue"))
74
+ query = Program(biology)
75
+ results = query.resolve(target={"B": "same"}, preserve=["C"], max_edits=2)
76
+ print(results)
77
+ ```
78
+
79
+ The scan returns complete categorical control configurations, nonzero mixed finite differences and restoration histories. Mixed differences use ordinal scores of −1, 0 and +1 for decreased, unchanged and increased associations, respectively. By default, an absent unmodified reference is assigned `same`; `reference=None` restricts the analysis to observed genotypes. Each restoration history represents a class of one-edit paths with a common initial state, terminal state and pattern of preserved or restored effects.
80
+
81
+ `Biology.from_profiles` constructs an in-memory index for amino acid substitution analysis. It accepts substitution sets in one-letter notation, such as `A10V;G20A`. `AssociationProfiles` also accepts arbitrary elementary transformation identifiers. Focal and partner identifiers in this substitution analysis must be strings. Optional arguments include an undirected NetworkX graph and molecular annotations. `biology.strategies()` lists the available association criteria. `biology.expand()` retrieves indexed observations by their internal profile identifiers; `source_id` identifies the input profile.
82
+
83
+ Annotations are mappings with `kind` (`binding` or `ptm`), `protein`, `lo`, `hi`, and an optional unique `feature` identifier. Coordinates are one-based and inclusive. Binding annotations require `partner`. Optional fields include `seq` (reference sequence over the interval), `study`, `type`, `label` and `domain`. Phosphorylation annotations use a `type` containing `phospho`. Overlap is evaluated by residue coordinates and, when available, the reference sequence.
84
+
85
+ ## Molecular networks
86
+
87
+ ```python
88
+ import networkx as nx
89
+ from makise_bio import AssociationNetwork, AssociationProfiles, PropagationSearch
90
+
91
+ profiles = AssociationProfiles([
92
+ {"id": "m1", "protein": "A", "variant": "A10V", "study": "s1",
93
+ "readout": {"B": "loss"}},
94
+ {"id": "m2", "protein": "C", "variant": "G20A", "study": "s2",
95
+ "readout": {"D": "loss"}},
96
+ ])
97
+ graph = nx.Graph([("A", "B"), ("B", "T"), ("A", "C"), ("C", "D"), ("D", "T")])
98
+ network = AssociationNetwork(profiles, graph)
99
+ search = PropagationSearch(network, ["A"], ["T"], depths=[2, 3])
100
+ result = search.search([0], budget=2, cap=0.1, seconds=2)
101
+ print(result)
102
+ print(search.verify(result["ids"]))
103
+ ```
104
+
105
+ Graphs are simple and undirected. Use mutually orderable node identifiers, preferably strings. The network retains the supplied reference graph and constructs an augmented graph from observed reference associations. Loss and gain annotations specify topological changes. Down and up annotations specify weight changes in the weighted model. Joint perturbations require distinct focal components and consistent assignments for shared associations.
106
+
107
+ `PropagationSearch` optimizes finite-horizon first-arrival probabilities for profiles containing loss and unchanged association effects. Suppressed transitions carry zero probability; remaining transitions retain their reference probabilities. Histories are grouped by their interruptible associations; the search composes compatible groups and uses admissible bounds to prune subsets. By default the objective is evaluated across both the supplied and augmented graph. Alternative graph contexts can be passed explicitly. `auto_goals` generates sets of channels, and `verify` computes the relative changes using a separate sparse-matrix recurrence. Relative objectives use distinct source and target nodes with positive reference probabilities.
108
+
109
+ The optimization maximizes the smallest relative decrease across selected channels subject to bounds on protected channels. The search returns the best feasible solution, its objective value and an optimization status. `signed_search` evaluates mixed perturbations through renormalized nonnegative edge weights and uses bounded beam search for larger candidate sets.
110
+
111
+ `AssociationNetwork.structural_scan` and `cooperative_scan` calculate degree and triangle changes, including non-additive triangle-count contrasts involving two or three compatible perturbations. They export JSON Lines tables to a specified output directory.
112
+
113
+ ## Quantitative models
114
+
115
+ ```python
116
+ from makise_bio import CatalyticFlow, competitive_binding
117
+
118
+ flow = CatalyticFlow([(("precursor", "intermediate", "product"), 100.0)])
119
+ result = flow.bounds(
120
+ {"precursor": 1.0},
121
+ observed={"product": 20.0},
122
+ efficiencies={"intermediate": (0.25, 0.8)},
123
+ )
124
+ print(result.minimum, result.maximum)
125
+ print(result.maximum_witness)
126
+
127
+ binding = competitive_binding([5.0, 20.0], receptor=50.0, ligands=[30.0, 30.0])
128
+ print(binding["complexes"])
129
+ ```
130
+
131
+ Each serial processing branch has a fixed input partitioned among products. The inverse solver minimizes and maximizes a supplied linear concentration objective under measured concentration and continuation-efficiency intervals. It returns explicit feasible product concentrations. All concentration inputs within an equilibrium calculation must use the same units. The binding functions implement exclusive single-site competition and independent pair allocation under equilibrium assumptions.
132
+
133
+ ## Algorithm reference
134
+
135
+ | Function or class | Operation |
136
+ | --- | --- |
137
+ | `State`, `Action`, `Engine`, `Plan` | Finite contingent planning with cached state sets and worst-outcome evaluation |
138
+ | `Hierarchy`, `Readout`, `Evaluation` | Multiscale readout definitions and constrained evaluation |
139
+ | `FibreSearch`, `control_cubes` | Projection and exact intersection of observed categorical configurations |
140
+ | `connected`, `genotype_cubes` | Mixed finite differences over genotype configurations |
141
+ | `compose`, `history_search` | Relation composition and observed one-edit histories |
142
+ | `transport_prediction`, `sparse_distance` | Partial response comparison and local prediction |
143
+ | `policy` | Diagnostic assay selection with explicit unknown outcomes |
144
+ | `inverse`, `pareto` | Constraint-based selection and nondominated outcomes |
145
+ | `AssociationProfiles`, `Biology`, `Program` | Molecular observations, association strategies and conjunctive queries |
146
+ | `AssociationNetwork`, `PropagationSearch`, `signed_search` | Network perturbation and propagation analysis |
147
+ | `maximum_clique`, `orthogonal_modules` | Compatible component selection and alternative-pair families |
148
+ | `optimize_panel` | Fixed-cardinality optimization of worst-context association gaps |
149
+ | `CatalyticFlow` | Concentration bounds under mass balance and processing constraints |
150
+ | `competitive_binding`, `isolated_binding` | Equilibrium concentrations and component allocation |
151
+
152
+ ## Development
153
+
154
+ ```sh
155
+ python -m pip install -e '.[test,release]'
156
+ python -m pytest
157
+ python -m build
158
+ python -m twine check dist/*
159
+ ```
160
+
161
+ The tests include comparisons with independent enumeration on small finite systems, checks of biochemical mass conservation and sparse-matrix verification of network propagation. Examples illustrate the input formats and return values.
162
+
163
+ ## License
164
+
165
+ MIT.
@@ -0,0 +1,138 @@
1
+ # MAKISE Bio
2
+
3
+ **Molecular Association Knowledge Integration and Systems Exploration**
4
+
5
+ MAKISE Bio is a Python library for molecular association analysis, multiscale representation, combinatorial optimization and quantitative systems biology. It provides algorithms for searching compatible configurations, composing molecular transformations, resolving partially observed systems and evaluating network and biochemical models.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ pip install makise-bio
11
+ ```
12
+
13
+ Python 3.10 or later is required. The dependencies are NumPy, SciPy and NetworkX.
14
+
15
+ ## Association observations
16
+
17
+ `AssociationProfiles` accepts an iterable of mappings with the following fields:
18
+
19
+ | Field | Description |
20
+ | --- | --- |
21
+ | `id` | Unique string or integer identifying the observation |
22
+ | `protein` | Focal molecular component |
23
+ | `variant` | Label of the molecular configuration |
24
+ | `study` | Identifier of a comparable experimental context |
25
+ | `readout` | Mapping of partner identifiers to categorical association effects |
26
+ | `edits` | Optional sequence of elementary transformation identifiers |
27
+
28
+ Association effects are `loss`, `down`, `same`, `up` and `gain`. List partners with measured effects. The collection retains additional fields. Assign a common study identifier to observations sharing a reference and comparable experimental conditions. For genotype comparisons, supply one association profile per edit set within each molecular and experimental context. By default, semicolon-separated variant labels are interpreted as elementary edits; supply `edits` explicitly for other representations.
29
+
30
+ ```python
31
+ from makise_bio import AssociationProfiles, Biology, Program
32
+
33
+ profiles = AssociationProfiles([
34
+ {"id": "v1", "protein": "A", "variant": "A10V", "study": "s1",
35
+ "readout": {"B": "loss", "C": "same"}},
36
+ {"id": "v2", "protein": "A", "variant": "G20A", "study": "s1",
37
+ "readout": {"B": "loss", "C": "same"}},
38
+ {"id": "v3", "protein": "A", "variant": "A10V;G20A", "study": "s1",
39
+ "readout": {"B": "same", "C": "same"}},
40
+ ])
41
+
42
+ for result in profiles.scan(depth=4):
43
+ print(result)
44
+
45
+ with Biology.from_profiles(profiles) as biology:
46
+ print(biology.search(strategy="compensatory_rescue"))
47
+ query = Program(biology)
48
+ results = query.resolve(target={"B": "same"}, preserve=["C"], max_edits=2)
49
+ print(results)
50
+ ```
51
+
52
+ The scan returns complete categorical control configurations, nonzero mixed finite differences and restoration histories. Mixed differences use ordinal scores of −1, 0 and +1 for decreased, unchanged and increased associations, respectively. By default, an absent unmodified reference is assigned `same`; `reference=None` restricts the analysis to observed genotypes. Each restoration history represents a class of one-edit paths with a common initial state, terminal state and pattern of preserved or restored effects.
53
+
54
+ `Biology.from_profiles` constructs an in-memory index for amino acid substitution analysis. It accepts substitution sets in one-letter notation, such as `A10V;G20A`. `AssociationProfiles` also accepts arbitrary elementary transformation identifiers. Focal and partner identifiers in this substitution analysis must be strings. Optional arguments include an undirected NetworkX graph and molecular annotations. `biology.strategies()` lists the available association criteria. `biology.expand()` retrieves indexed observations by their internal profile identifiers; `source_id` identifies the input profile.
55
+
56
+ Annotations are mappings with `kind` (`binding` or `ptm`), `protein`, `lo`, `hi`, and an optional unique `feature` identifier. Coordinates are one-based and inclusive. Binding annotations require `partner`. Optional fields include `seq` (reference sequence over the interval), `study`, `type`, `label` and `domain`. Phosphorylation annotations use a `type` containing `phospho`. Overlap is evaluated by residue coordinates and, when available, the reference sequence.
57
+
58
+ ## Molecular networks
59
+
60
+ ```python
61
+ import networkx as nx
62
+ from makise_bio import AssociationNetwork, AssociationProfiles, PropagationSearch
63
+
64
+ profiles = AssociationProfiles([
65
+ {"id": "m1", "protein": "A", "variant": "A10V", "study": "s1",
66
+ "readout": {"B": "loss"}},
67
+ {"id": "m2", "protein": "C", "variant": "G20A", "study": "s2",
68
+ "readout": {"D": "loss"}},
69
+ ])
70
+ graph = nx.Graph([("A", "B"), ("B", "T"), ("A", "C"), ("C", "D"), ("D", "T")])
71
+ network = AssociationNetwork(profiles, graph)
72
+ search = PropagationSearch(network, ["A"], ["T"], depths=[2, 3])
73
+ result = search.search([0], budget=2, cap=0.1, seconds=2)
74
+ print(result)
75
+ print(search.verify(result["ids"]))
76
+ ```
77
+
78
+ Graphs are simple and undirected. Use mutually orderable node identifiers, preferably strings. The network retains the supplied reference graph and constructs an augmented graph from observed reference associations. Loss and gain annotations specify topological changes. Down and up annotations specify weight changes in the weighted model. Joint perturbations require distinct focal components and consistent assignments for shared associations.
79
+
80
+ `PropagationSearch` optimizes finite-horizon first-arrival probabilities for profiles containing loss and unchanged association effects. Suppressed transitions carry zero probability; remaining transitions retain their reference probabilities. Histories are grouped by their interruptible associations; the search composes compatible groups and uses admissible bounds to prune subsets. By default the objective is evaluated across both the supplied and augmented graph. Alternative graph contexts can be passed explicitly. `auto_goals` generates sets of channels, and `verify` computes the relative changes using a separate sparse-matrix recurrence. Relative objectives use distinct source and target nodes with positive reference probabilities.
81
+
82
+ The optimization maximizes the smallest relative decrease across selected channels subject to bounds on protected channels. The search returns the best feasible solution, its objective value and an optimization status. `signed_search` evaluates mixed perturbations through renormalized nonnegative edge weights and uses bounded beam search for larger candidate sets.
83
+
84
+ `AssociationNetwork.structural_scan` and `cooperative_scan` calculate degree and triangle changes, including non-additive triangle-count contrasts involving two or three compatible perturbations. They export JSON Lines tables to a specified output directory.
85
+
86
+ ## Quantitative models
87
+
88
+ ```python
89
+ from makise_bio import CatalyticFlow, competitive_binding
90
+
91
+ flow = CatalyticFlow([(("precursor", "intermediate", "product"), 100.0)])
92
+ result = flow.bounds(
93
+ {"precursor": 1.0},
94
+ observed={"product": 20.0},
95
+ efficiencies={"intermediate": (0.25, 0.8)},
96
+ )
97
+ print(result.minimum, result.maximum)
98
+ print(result.maximum_witness)
99
+
100
+ binding = competitive_binding([5.0, 20.0], receptor=50.0, ligands=[30.0, 30.0])
101
+ print(binding["complexes"])
102
+ ```
103
+
104
+ Each serial processing branch has a fixed input partitioned among products. The inverse solver minimizes and maximizes a supplied linear concentration objective under measured concentration and continuation-efficiency intervals. It returns explicit feasible product concentrations. All concentration inputs within an equilibrium calculation must use the same units. The binding functions implement exclusive single-site competition and independent pair allocation under equilibrium assumptions.
105
+
106
+ ## Algorithm reference
107
+
108
+ | Function or class | Operation |
109
+ | --- | --- |
110
+ | `State`, `Action`, `Engine`, `Plan` | Finite contingent planning with cached state sets and worst-outcome evaluation |
111
+ | `Hierarchy`, `Readout`, `Evaluation` | Multiscale readout definitions and constrained evaluation |
112
+ | `FibreSearch`, `control_cubes` | Projection and exact intersection of observed categorical configurations |
113
+ | `connected`, `genotype_cubes` | Mixed finite differences over genotype configurations |
114
+ | `compose`, `history_search` | Relation composition and observed one-edit histories |
115
+ | `transport_prediction`, `sparse_distance` | Partial response comparison and local prediction |
116
+ | `policy` | Diagnostic assay selection with explicit unknown outcomes |
117
+ | `inverse`, `pareto` | Constraint-based selection and nondominated outcomes |
118
+ | `AssociationProfiles`, `Biology`, `Program` | Molecular observations, association strategies and conjunctive queries |
119
+ | `AssociationNetwork`, `PropagationSearch`, `signed_search` | Network perturbation and propagation analysis |
120
+ | `maximum_clique`, `orthogonal_modules` | Compatible component selection and alternative-pair families |
121
+ | `optimize_panel` | Fixed-cardinality optimization of worst-context association gaps |
122
+ | `CatalyticFlow` | Concentration bounds under mass balance and processing constraints |
123
+ | `competitive_binding`, `isolated_binding` | Equilibrium concentrations and component allocation |
124
+
125
+ ## Development
126
+
127
+ ```sh
128
+ python -m pip install -e '.[test,release]'
129
+ python -m pytest
130
+ python -m build
131
+ python -m twine check dist/*
132
+ ```
133
+
134
+ The tests include comparisons with independent enumeration on small finite systems, checks of biochemical mass conservation and sparse-matrix verification of network propagation. Examples illustrate the input formats and return values.
135
+
136
+ ## License
137
+
138
+ MIT.
@@ -0,0 +1,6 @@
1
+ """Bounds on an unmeasured product of a serial catalytic process."""
2
+ from makise_bio import CatalyticFlow
3
+
4
+ flow = CatalyticFlow([(('precursor', 'intermediate', 'product'), 100.0)])
5
+ result = flow.bounds({'precursor': 1.0}, {'product': 20.0}, {'intermediate': (.25, .8)})
6
+ print(result)
@@ -0,0 +1,13 @@
1
+ """Selective perturbation of a molecular network."""
2
+ import networkx as nx
3
+ from makise_bio import AssociationNetwork, AssociationProfiles, PropagationSearch
4
+
5
+ profiles = AssociationProfiles([
6
+ {'id': 'm1', 'protein': 'A', 'variant': 'A10V', 'study': 0, 'readout': {'B': 'loss'}},
7
+ {'id': 'm2', 'protein': 'C', 'variant': 'G20A', 'study': 0, 'readout': {'D': 'loss'}},
8
+ ])
9
+ graph = nx.Graph([('A', 'B'), ('B', 'T'), ('A', 'C'), ('C', 'D'), ('D', 'T')])
10
+ search = PropagationSearch(AssociationNetwork(profiles, graph), ['A'], ['T'], [2, 3])
11
+ result = search.search([0], budget=2, seconds=2)
12
+ print(result)
13
+ print(search.verify(result['ids']))
@@ -0,0 +1,35 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "makise-bio"
7
+ version = "0.1.0"
8
+ description = "Molecular association analysis, combinatorial search and quantitative systems exploration"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ keywords = ["bioinformatics", "protein interactions", "mutagenesis", "systems biology", "optimization"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Science/Research",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
23
+ ]
24
+ dependencies = ["numpy>=1.24", "scipy>=1.10", "networkx>=3.0"]
25
+
26
+ [project.optional-dependencies]
27
+ test = ["pytest>=7"]
28
+ release = ["build>=1.2", "twine>=5"]
29
+
30
+ [tool.setuptools.packages.find]
31
+ where = ["src"]
32
+
33
+ [tool.pytest.ini_options]
34
+ testpaths = ["tests"]
35
+ addopts = "-ra"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,24 @@
1
+ """Molecular Association Knowledge Integration and Systems Exploration."""
2
+ from .planning import Action, Engine, Plan, State, connected, inverse, pareto
3
+ from .geometry import Evaluation, Hierarchy, Readout, compose, control_cubes, sparse_distance, transport_prediction
4
+ from .configurations import FibreSearch, genotype_cubes, history_search
5
+ from .assays import policy
6
+ from .profiles import AssociationProfiles
7
+ from .biology import Biology
8
+ from .program import Program
9
+ from .networks import AssociationNetwork
10
+ from .propagation import PropagationSearch
11
+ from .quantitative import CatalyticFlow, FlowResult, competitive_binding, isolated_binding
12
+ from .optimization import CliqueResult, PanelResult, maximum_clique, orthogonal_modules, optimize_panel, signed_search
13
+
14
+ __version__ = '0.1.0'
15
+ __all__ = [
16
+ 'Action', 'Engine', 'Plan', 'State', 'connected', 'inverse', 'pareto',
17
+ 'Evaluation', 'Hierarchy', 'Readout', 'compose', 'control_cubes',
18
+ 'sparse_distance', 'transport_prediction', 'FibreSearch', 'genotype_cubes',
19
+ 'history_search', 'policy', 'AssociationProfiles', 'Biology', 'Program',
20
+ 'AssociationNetwork', 'PropagationSearch', 'CatalyticFlow', 'FlowResult',
21
+ 'competitive_binding', 'isolated_binding', 'CliqueResult', 'PanelResult',
22
+ 'maximum_clique', 'optimize_panel', 'orthogonal_modules', 'signed_search',
23
+ '__version__',
24
+ ]
@@ -0,0 +1,24 @@
1
+ """Contingent assay selection over finite sets of molecular states.
2
+ Unmeasured assays branch over the supplied outcome alphabet.
3
+ """
4
+ from .planning import State, Action, Engine
5
+
6
+ def policy(profiles, labels, assays, budget, alphabet):
7
+ profiles, assays, alphabet = tuple(profiles), tuple(assays), tuple(alphabet)
8
+ if not alphabet or len(set(assays)) != len(assays):
9
+ raise ValueError('invalid assay alphabet or duplicate assay')
10
+ root = tuple(((s.key, assays) for s in profiles))
11
+ src = {s.key: s for s in profiles}
12
+
13
+ class States:
14
+
15
+ def __getitem__(self, key):
16
+ return State(key, src[key[0]].relations)
17
+
18
+ def moves(s):
19
+ k, remaining = s.key
20
+ for a in remaining:
21
+ y = s.read(a)
22
+ new = (k, tuple((x for x in remaining if x != a)))
23
+ yield Action(a, tuple(((o, new) for o in (alphabet if y is None else (y,)))))
24
+ return Engine(States(), moves, lambda s: (0,), belief_value=lambda b: (-len({labels[k] for k, _ in b}),)).search(root, budget, budget)