File size: 6,530 Bytes
9ae68e3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | [](https://opensource.org/licenses/BSL-1.0)
[](https://www.gnu.org/licenses/agpl-3.0)
[](https://www.mozilla.org/en-US/MPL/2.0/)
[](https://python.org)
[](https://mc-stan.org)
[](https://www.minizinc.org)
[](#)
# bio-semantics
**ๅบๅ ่กจ้่ช็พฉๅปบๆจก็ฎก็ท (ุฎุท ุฃูุงุจูุจ ุงููู
ุฐุฌุฉ ุงูุฏูุงููุฉ ููุชุนุจูุฑ ุงูุฌููู)**
Gene-expression semantic modeling pipeline โ Stan + MiniZinc + cDNA sequencing visualizer with immutable artifact provenance, PTM verification, and RPG/JCL integration templates.
Authors: Ahmad Ali Parr, Jessica L. Williams (SNAPKITTYWEST)
---
## Architecture
```
BIOLOGICAL OBSERVATIONS
โ
โผ
cDNA EXPRESSION DATA
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ DATA VALIDATION โ โ semantics.py (10 validator rules)
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
GENE EXPRESSION
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ STAN MODEL โ โ Bayesian inference
โ priors โ
โ likelihood โ
โ posterior โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
POSTERIOR STATE
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ MINIZINC MODEL โ โ Constraint reasoning
โ constraints โ
โ optimization โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
COMPUTATIONAL RESULT
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ VISUALIZER โ โ dashboard.html (8 panels)
โ HTML + CSS โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
HUMAN-READABLE MODEL
```
---
## Repository Structure
```
bio-semantics/
โโโ src/
โ โโโ semantics.py Validator + PTM parity machine
โ โโโ test_semantics.py Unit tests (6 test classes)
โ โโโ dashboard.html 8-panel semantic report viewer
โโโ spec/
โ โโโ types.ts TypeScript type definitions (bio-semantics/1.0.0)
โ โโโ contract.md Gate 1 integration contract
โ โโโ system_prompt.md Agent system prompt specification
โโโ templates/
โโโ workflow.rpgle RPG workflow coordinator (IBM i)
โโโ vault.jcl JCL vault archival template
```
---
## Quantity Kinds
| Kind | Meaning | ๆ็พฉ (ุงูู
ุนูู) |
|------|---------|--------------|
| observed | Measurement with source record locator | ่งๆธฌๅผ (ุงูููู
ุฉ ุงูู
ุฑุตูุฏุฉ) |
| inferred | Posterior with model/run references and uncertainty | ๆจๆทๅผ (ุงูููู
ุฉ ุงูู
ุณุชูุชุฌุฉ) |
| derived | Deterministic transformation with algorithm references | ่ก็ๅผ (ุงูููู
ุฉ ุงูู
ุดุชูุฉ) |
| predicted | Unobserved modeled quantity | ้ ๆธฌๅผ (ุงูููู
ุฉ ุงูู
ุชููุนุฉ) |
| constrained | Declared relation or solver result | ็ดๆๅผ (ุงูููู
ุฉ ุงูู
ููุฏุฉ) |
| encoded | Representation with codec identifier | ็ทจ็ขผๅผ (ุงูููู
ุฉ ุงูู
ุฑู
ุฒุฉ) |
| executed | Actual execution event with run evidence | ๅท่กไบไปถ (ุญุฏุซ ุงูุชูููุฐ) |
---
## Validator Rules
1. Reject unsupported versions, unknown discriminants, duplicate IDs
2. Require exactly one of present value or missing reason
3. Raw counts: canonical unsigned decimal only
4. Decimal quantities: reject NaN/infinity, require units
5. Require sample/gene references to resolve
6. Reject inferred/predicted/constrained labeled as observed
7. Preserve excluded rows with explicit inclusion map
8. Missing source bytes block verified-ingestion claims
9. Synthetic-origin propagation through every descendant
10. Never create model-results merely because a process was scheduled
---
## PTM: ptm-bit-parity/1
| State | Read | Write | Move | Next |
|-------|------|-------|------|------|
| q_even | 0 | 0 | R | q_even |
| q_even | 1 | 1 | R | q_odd |
| q_odd | 0 | 0 | R | q_odd |
| q_odd | 1 | 1 | R | q_even |
| q_even | _ | 0 | Stay | q_accept |
| q_odd | _ | 1 | Stay | q_accept |
For input length n: exactly n+1 transitions, constant auxiliary storage.
---
## Run Tests
```bash
cd src && python -m pytest test_semantics.py -v
```
---
## Gated Phases
| Gate | What | Status |
|------|------|--------|
| 1. Contract | Contracts accepted, encodings documented, provenance validated | Ready for review |
| 2. Engine | Stan/MiniZinc/Quipper sources exist, native validation recorded | Not started |
| 3. Integration | All panels rendered, WORM loaded, governance preserved | Not started |
---
## License
This project is released under a **trilicense** model. You may choose any one of the following:
| License | SPDX | Link |
|---------|------|------|
| Boost Software License 1.0 | BSL-1.1 | [LICENSE-BSL](https://opensource.org/licenses/BSL-1.0) |
| GNU Affero General Public License v3 | AGPL-3.0 | [LICENSE-AGPL](https://www.gnu.org/licenses/agpl-3.0) |
| Mozilla Public License 2.0 | MPL-2.0 | [LICENSE-MPL](https://www.mozilla.org/en-US/MPL/2.0/) |
Unauthorized cloud SaaS redistribution without source disclosure is prohibited under all three licenses.
---
SnapKitty West / SNAPKITTYWEST โ Evidence or Silence โ 2026
|