Using Livemore Bio
Python SDK and REST API
The SDK and the REST API reach the same twins, cohorts, programs and evidence as the console and the terminal.
Python SDK
from livemorebio import whole_human_manifest
from livemorebio.sdk import Platform
manifest = whole_human_manifest()
manifest["coverage"]["registered_systems"], manifest["coverage"]["modeled_systems"] # (15, 2)
p = Platform() # in-process; Platform(mode="attach") drives the running services
p.program_catalog() # which programs can run, and why the others cannot
run = p.run_botanical_program({"program_id": "LBHR-030", "dose_mg": 400, "cohort_size": 10})
run["outcome"] # 'BELOW_MEASURED_ACTIVE_RANGE': a negative result, reported as one
run["evidence_state"], run["qualification_state"] # ('MODELED_ONLY', 'NOT_QUALIFIED')
Platform() runs in-process. Platform(mode="attach") drives the services you started with livemore start.
REST API
The services listen on loopback only: Aegle on 127.0.0.1:8850, LIFE on 127.0.0.1:8851 and Cendos on 127.0.0.1:8852. Mutation routes and selected PHI-like reads need the local bearer token. Get it with livemore token.
auth="Authorization: Bearer $(livemore token)"
# the six programs and their executability
curl -fsS -H "$auth" http://127.0.0.1:8850/api/cendos/programs
# paired exogenous-insulin arms
curl -fsS -X POST -H "$auth" -H 'Content-Type: application/json' \
-d '{"cohort_size":8,"seed":1,"bolus_units":4,"meal_g":60}' \
http://127.0.0.1:8850/api/cendos/protocols/exogenous-insulin
# whole-human manifest
curl -fsS http://127.0.0.1:8850/api/system-manifest
Interactive OpenAPI documentation for Aegle is served by the running service at http://127.0.0.1:8850/docs.
Health check
curl -fsS http://127.0.0.1:8850/health
For worked API calls, including a genome-scale metabolism protocol on Cendos, see worked examples.
Questions about this page?
Email us