Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ jobs:
python tests/verify.py neural-fate-experiment
python tests/verify.py neural-regulation
python tests/verify.py neural-circuit
python tests/verify.py neural-v2f
python tests/verify.py neural-construction
python tests/verify.py coding-consequences
python tests/verify.py neural-binding
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ python3.11 epigenesis_cli.py circuit --list-circuits
python3.11 epigenesis_cli.py circuit --circuit tri-lineage-switch --target All
python3.11 epigenesis_cli.py circuit --benchmark
python3.11 epigenesis_cli.py scan examples/neural-patterning/reference.fasta --protein MA0069.1
python3.11 epigenesis_cli.py radar --locus chr15:90936956-90937127 --output /tmp/v2f-radar
python3.11 epigenesis_cli.py predict --kreimer --input studio/epigenesis_studio/example-edits.json --output /tmp/kreimer.json
python3.11 epigenesis_cli.py check --full
```
Expand All @@ -48,6 +49,7 @@ python3.11 examples/neural-evidence/evidence.py demo --output /tmp/neural-eviden
python3.11 examples/neural-evidence/evidence.py verify --output /tmp/neural-evidence
python3.11 examples/neural-patterning/patterning.py demo --output /tmp/neural-patterning
python3.11 examples/neural-circuit/circuit.py demo --output /tmp/neural-circuit
python3.11 examples/neural-v2f/radar.py demo --output /tmp/neural-v2f
```

Open `index.html` in each output directory.
Expand Down Expand Up @@ -115,6 +117,7 @@ These identities are recorded in [expected.json](examples/minimal-development/ex
| [Coding consequences](examples/coding-consequences/README.md) | Reconstructs *Sox2* edits from genomic sequence, applies the declared coding annotation and checks the resulting peptides against independent reference sequences | Gong et al. (2020) |
| [Neural patterning](examples/neural-patterning/README.md) | Connects an *Nkx2.2* enhancer substitution and measured GLI binding profiles to a four-gene model; tests signal history, rescue and phenocopy under an explicit affinity-transfer assumption | Peterson et al. (2012); Cohen et al. (2014) |
| [Neural circuit](examples/neural-circuit/README.md) | Scans arbitrary enhancers via Boltzmann TF partition physics (Hallikas `GLI2`/`GLI3`, `532` JASPAR 2024 motifs, or custom PWMs) into arbitrary $N$-gene ODEs (`neural-tube`, `mutual-toggle`, `tri-lineage-switch`, or custom JSON `CircuitSpec`s), compares SNV/MNV/indel alleles in sealed `brainc` v2/v3 modules, finds epistatic second-site rescues, and bridges steady states into CX3D + LIF | Hallikas et al. (2006); Herrera-Delgado et al. (2020); JASPAR 2024 |
| [V2F tipping-point & rescue radar](examples/neural-v2f/README.md) | Sweeps full morphogen regimes ($S \in [0, 1]$) with exact 12-step tipping-point bisection ($\Delta S_{\mathrm{crit}}$), flags passive-reporter-silent and optional doubly-silent switches, proposes dual cis-epistatic + trans-dose rescues, evaluates arbitrary SNV/MNV/indel variant tables, and falsifies claims against exact Altschul–Erickson dinucleotide shuffles, scrambled PWMs, and sealed `brainc` causal controls (`biological_acceptance = False`) | Altschul & Erickson (1985); Kreimer et al. (2022); JASPAR 2024 |
| [Neural construction](examples/neural-construction/README.md) | Grows cells, neurites and contacts from one founder and a shared artificial DNA recipe; tests signal transmission and contact lesions on the developed network | Zubler et al. (2011, 2013) |
| [Neural evidence](examples/neural-evidence/README.md) | Reconstructs 109 published CHE-1 depletion observations, traces them to workbook cells and intended DNA edits, and compares competing explanations | Traets et al. (2021) |
| [Neural fate](examples/neural-fate/README.md) | An artificial DNA parameter recipe driving published regulatory dynamics | Balaskas et al. (2012) |
Expand Down Expand Up @@ -169,6 +172,7 @@ python3.11 tests/verify.py minimal-example
python3.11 tests/verify.py universal-translation
python3.11 tests/verify.py boundary
python3.11 tests/verify.py neural-circuit
python3.11 tests/verify.py neural-v2f
python3.11 tests/verify.py neural-regulation-motif # requires NumPy
PIP_NO_INDEX=1 python3.11 tests/verify.py wheel
PIP_NO_INDEX=1 python3.11 tests/verify.py sdist
Expand Down
88 changes: 86 additions & 2 deletions epigenesis_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def _append_circuit_opts(cmd: list[str | Path], args: argparse.Namespace) -> Non
cmd.extend(["--target", str(args.target)])
if getattr(args, "signal", None) is not None:
cmd.extend(["--signal", str(args.signal)])
if getattr(args, "background_floor", None) is not None:
cmd.extend(["--background-floor", str(args.background_floor)])


def _cmd_circuit(args: argparse.Namespace) -> int:
Expand Down Expand Up @@ -168,6 +170,68 @@ def _cmd_scan(args: argparse.Namespace) -> int:
return rc


def _cmd_radar(args: argparse.Namespace) -> int:
repo = _find_repo(args.repo)
script = repo / "examples/neural-v2f/radar.py"
modes = sum([bool(args.fasta is not None), bool(args.variants is not None), bool(args.benchmark)])
if modes > 1:
print("radar accepts at most one of --fasta, --variants, or --benchmark", file=sys.stderr)
return 2

common: list[str | Path] = []
if args.circuit is not None:
common.extend(["--circuit", str(args.circuit)])
if args.protein is not None:
common.extend(["--protein", str(args.protein)])
if args.target is not None:
common.extend(["--target", str(args.target)])
if args.signal_min is not None:
common.extend(["--signal-min", str(args.signal_min)])
if args.signal_max is not None:
common.extend(["--signal-max", str(args.signal_max)])
if args.steps is not None:
common.extend(["--steps", str(args.steps)])
if getattr(args, "background_floor", None) is not None:
common.extend(["--background-floor", str(args.background_floor)])
if args.no_sequence_models:
common.append("--no-sequence-models")

if args.benchmark:
out = _resolve_out(args.output, "v2f-benchmark")
cmd: list[str | Path] = [script, "benchmark", *common, "--output", out]
if args.shuffles is not None:
cmd.extend(["--shuffles", str(args.shuffles)])
rc = _run_py(cmd)
if rc == 0:
print(f"\nV2F benchmark report: {out / 'radar_benchmark.json'}")
return rc
if args.variants is not None:
out = _resolve_out(args.output, "v2f-variants")
cmd = [script, "variants", "--variants", args.variants, *common, "--output", out]
rc = _run_py(cmd)
if rc == 0:
print(f"\nWet-lab candidates CSV: {out / 'wetlab_candidates.csv'}")
return rc
if args.fasta is not None:
out = _resolve_out(args.output, "v2f-scan")
cmd = [script, "scan", "--fasta", args.fasta, *common, "--output", out]
if args.shuffles is not None:
cmd.extend(["--shuffles", str(args.shuffles)])
rc = _run_py(cmd)
if rc == 0:
print(f"\nOpen {out / 'index.html'} in your browser.")
return rc

out = _resolve_out(args.output, "v2f-radar")
cmd = [script, "demo", "--locus", args.locus, *common, "--output", out]
if args.shuffles is not None:
cmd.extend(["--shuffles", str(args.shuffles)])
rc = _run_py(cmd)
if rc == 0:
print(f"\nOpen {out / 'index.html'} in your browser.")
return rc


def _cmd_predict(args: argparse.Namespace) -> int:
repo = _find_repo(args.repo)
legacy = args.activity or args.attention
Expand Down Expand Up @@ -242,6 +306,7 @@ def _cmd_check(args: argparse.Namespace) -> int:
if args.full:
steps.extend([
[repo / "tests/verify.py", "neural-circuit"],
[repo / "tests/verify.py", "neural-v2f"],
[repo / "tests/verify.py", "neural-construction"],
[repo / "tests/verify.py", "contract-attacks"],
])
Expand Down Expand Up @@ -277,6 +342,7 @@ def build_parser() -> argparse.ArgumentParser:
cc.add_argument("--target", help="regulated target gene in the chosen circuit (e.g. Nkx2.2, Olig2, Both, All, or GeneA)")
cc.add_argument("--protein", help="TF motif: GLI2, GLI3, any bundled JASPAR ID (e.g. MA0069.1), or custom PWM JSON path")
cc.add_argument("--signal", type=float, help="morphogen input fraction S in [0, 1]")
cc.add_argument("--background-floor", type=float, help="non-specific partition floor Z_ns >= 0 (default 2e-4)")
cc.add_argument("--reference", help="custom reference DNA sequence or FASTA path for pairwise comparison")
cc.add_argument("--variant", help="custom variant DNA sequence or FASTA path (SNV, MNV, or indel)")
cc.add_argument("--mapping", type=Path, help="optional JSON mapping of GRN gene steady state to CX3D Program fields")
Expand All @@ -291,10 +357,27 @@ def build_parser() -> argparse.ArgumentParser:
sc.add_argument("fasta", type=Path, help="FASTA file containing a single enhancer sequence")
sc.add_argument("--circuit", help="circuit preset ('neural-tube', 'mutual-toggle', 'tri-lineage-switch') or JSON spec path")
sc.add_argument("--protein", help="TF motif: GLI2, GLI3, any bundled JASPAR ID (e.g. MA0069.1), or custom PWM JSON path")
sc.add_argument("--target", help="regulated target gene in the chosen circuit")
sc.add_argument("--target", help="regulated target gene name in the chosen circuit")
sc.add_argument("--signal", type=float, help="morphogen input fraction S in [0, 1]")
sc.add_argument("--background-floor", type=float, help="non-specific partition floor Z_ns >= 0 (default 2e-4)")
sc.add_argument("--output", type=Path, help="output directory")

rd = sub.add_parser("radar", help="run V2F tipping-point, dual rescue, and null-control radar for silent non-coding variants")
rd.add_argument("--locus", default="chr15:90936956-90937127", help="GSE188264 reference enhancer locus for demo")
rd.add_argument("--fasta", type=Path, help="optional FASTA enhancer to scan across full signaling regime")
rd.add_argument("--variants", type=Path, help="optional JSON/CSV/TSV table of targeted variants (SNVs, MNVs, indels)")
rd.add_argument("--benchmark", action="store_true", help="benchmark across curated GSE188264 loci + measured perturbations")
rd.add_argument("--circuit", help="circuit preset ('neural-tube', 'mutual-toggle', 'tri-lineage-switch') or JSON spec path")
rd.add_argument("--protein", help="TF motif: GLI2, GLI3, any bundled JASPAR ID, or custom PWM JSON path")
rd.add_argument("--target", help="regulated target gene in the chosen circuit")
rd.add_argument("--signal-min", type=float, help="minimum morphogen signal S (default 0.06)")
rd.add_argument("--signal-max", type=float, help="maximum morphogen signal S (default 0.85)")
rd.add_argument("--steps", type=int, help="number of morphogen signal grid points >= 3 (default 9)")
rd.add_argument("--shuffles", type=int, help="dinucleotide-shuffled decoy controls per locus")
rd.add_argument("--background-floor", type=float, help="non-specific partition floor Z_ns >= 0 (default 2e-4)")
rd.add_argument("--no-sequence-models", action="store_true", help="skip optional Siraj/Kreimer sequence predictor scoring")
rd.add_argument("--output", type=Path, help="output directory")

pr = sub.add_parser("predict", help="score DNA edit pairs with Huber-linear (default) or Kreimer 0-72h")
pr.add_argument("--input", type=Path, required=True, help="JSON list of {id, reference, sequence, optional family}")
pr.add_argument("--output", type=Path, required=True, help="new JSON file to write")
Expand All @@ -319,7 +402,7 @@ def build_parser() -> argparse.ArgumentParser:
cx.add_argument("--output", type=Path, help="output directory")

ck = sub.add_parser("check", help="run self-checks (unit tests, compiler boundary, research freeze)")
ck.add_argument("--full", action="store_true", help="also run neural-circuit, construction, attacks, and studio checks")
ck.add_argument("--full", action="store_true", help="also run neural-circuit, neural-v2f, construction, attacks, and studio checks")

return parser

Expand All @@ -334,6 +417,7 @@ def main(argv: list[str] | None = None) -> int:
"studio": _cmd_studio,
"circuit": _cmd_circuit,
"scan": _cmd_scan,
"radar": _cmd_radar,
"predict": _cmd_predict,
"evidence": _cmd_evidence,
"patterning": _cmd_patterning,
Expand Down
Loading
Loading