Skip to content

danvinci/biosensing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Biosensing

Spectral detectability and inverse design of engineered biosensors.

Model whether an engineered biosensor is detectable from orbit, and design toward it. Pin what you know about the design - the molecule, its pigment, the host organism, the habitat, the sensor, the platform - leave the rest free, and solve for the unknown. It answers one question in many directions: can this signal be read from a drone or satellite, and what should be engineered toward it?

"Detectable" means a real yes-or-no with a confidence band: the molecule's signature clears the sensor's noise floor over a real habitat, an absolute answer rather than only a ranking. Validated against Chemla et al. (Nat Biotechnol 2025), who detected pigment-engineered bacteria from a 90 m drone.

Install

From a fresh clone (Julia 1.10+); Julia resolves all dependencies, no manual system setup:

julia --project=. -e 'using Pkg; Pkg.instantiate()'
julia --project=. -e 'using Pkg; Pkg.test()'   # closed-form physics tests

The idea: one query, many unknowns

Every design question is the same physics solved for a different variable. A Session loads the expensive per-habitat state once; explore answers queries against it. Each node in a query is FIXED (pinned), FREE (uncertain, carries a prior), SOLVE (the unknown), or OBJECTIVE (optimized toward a goal).

using Biosensing

session = Session(; root = "data", manifest = "scripts/habitats.tsv")

# "Which buildable pigment stands out most over cropland?"
spec = QuerySpec(nodes = Dict(
    :habitat  => Node(role = FIXED, value = "cropland"),
    :molecule => Node(role = SOLVE)))

result = explore(session, spec)
result.chosen[:molecule]   # top pigment, screened from ~20k candidate molecules
result.frontier            # ranked: detectability, red-edge peak, biosynthetic steps

Run across its habitats, the same screen rediscovers the pigments Chemla actually used: biliverdin for soil (one biosynthetic step in P. putida) and a bacteriochlorophyll derivative for water.

What you can ask

Set one node to SOLVE; the matching physics inversion runs:

SOLVE node Question Returns
:molecule best buildable pigment for a habitat ranked molecule frontier
:wavelength best pigment absorption band for a habitat optimal peak (nm) + detectability
:fill smallest detectable patch break-even coverage + area (m²)
(none) forward SNR for a fully-pinned design absolute SNR + detect / no-detect

FREE nodes (an uncertain expression depth, say) propagate through a sample ensemble, so a forward answer comes back as a mean SNR with a 5-95% band and a detection probability.

How detection is computed

A habitat's natural spectral clutter is summarized as a covariance Σ. The matched filter scores how far the molecule's signature stands out from that clutter; detectability is √(sᵀΣ⁻¹s), largest where the pigment absorbs and the background is quiet. Absolute SNR adds the sensor's per-band noise floor and the sunlight-plus-atmosphere bridge (sunlight × transmittance / π) that converts reflectance to the radiance the noise lives in. Only then can the tool say "yes, detectable" rather than only rank options.

What's in the box

  • Core - exact physics (matched filter, design envelope, absolute SNR), the ENVI / .npy / EMIT scene readers, and the sensor ladder (drone to orbital).
  • Engine - the sample-ensemble backbone and the explore query layer. QuerySpec / QueryResult are JSON-serializable (to_json / from_json), so a notebook today and a web client later are interchangeable front-ends over the same explore.
  • outputs/ - an open detectability dataset: 500 buildable molecules over 10 real habitats, with EnMAP orbital break-even areas. See outputs/README.md.

Data

The scene library (hyperspectral cubes) and the npspec molecule extract are GB-scale and external (gitignored); sources and a 10-habitat manifest live in scripts/habitats.tsv. For a self-contained, data-free example of the query path, see the explore test in test/runtests.jl.

Status

Research tool, v0.1. Physics core complete through absolute SNR; query layer over four inversion directions. Continuous-optimization and Pareto objectives are in progress.

About

Spectral detectability and inverse design of engineered biosensors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages