Skip to content

scene_pipelines.ingestion.mouse.strain

Add a Strain to the shared mouse vocabulary (everyday pipeline write).

Any lab adds the strains it uses; no admin role is needed. Names follow the official mouse strain nomenclature, so every lab spells a strain the same way.

Not exported from scene_pipelines.ingestion: importing this module registers the mouse schema, which labs without mice do not need.

strain_meta_payload

strain_meta_payload(row: dict[str, Any]) -> dict[str, Any]

Non-key Strain fields.

ensure_strain

ensure_strain(strain: DjRow[Strain], *, deployment: DjRow[Deployment] | None = None, if_exists: DuplicatePolicy = VERIFY) -> DjKey[Strain]

Insert a strain row and stamp the deployment that registered it.

Parameters:

Name Type Description Default
strain DjRow[Strain]

Full strain insert dict: strain_name in official nomenclature (e.g. C57BL/6J, not B6) and optional rrid.

required
deployment DjRow[Deployment] | None

Optional deployment row. If omitted, built from SCENE_DEPLOYMENT_ID / SCENE_DEPLOYMENT_LABEL.

None
if_exists DuplicatePolicy

Policy when strain_name is already stored; see DuplicatePolicy.

VERIFY

Returns:

Type Description
DjKey[Strain]

Strain primary key {strain_name: ...}.

Raises:

Type Description
ValueError

If strain_name or rrid is malformed, the name is stored under another spelling, the rrid already belongs to another strain, deployment is omitted and SCENE_DEPLOYMENT_ID is unset, or if_exists rejects the existing row.