scene_pipelines.ingestion.mouse
Write helpers for the mouse tables (Strain, Mouse).
Importing this package registers the mouse schema, so it is not re-exported
from scene_pipelines.ingestion: labs without mice never import it.
register_mouse
register_mouse(subject_code: str, sex: str, *, lab: DjKey[Lab], date_of_birth: date | None = None, strain: DjKey[Strain] | None = None, genotype: str | None = None, deployment: DjRow[Deployment] | None = None, if_exists: DuplicatePolicy = VERIFY) -> DjKey[Mouse]
Register a mouse by its lab code: the Subject and its Mouse row.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject_code
|
str
|
Pseudonymous code, unique within |
required |
sex
|
str
|
|
required |
lab
|
DjKey[Lab]
|
Existing lab primary key, e.g. |
required |
date_of_birth
|
date | None
|
Optional date of birth. |
None
|
strain
|
DjKey[Strain] | None
|
Optional existing |
None
|
genotype
|
str | None
|
Optional free-text genotype (transgenic lines, zygosity). |
None
|
deployment
|
DjRow[Deployment] | None
|
Optional deployment row. If omitted, built from
|
None
|
if_exists
|
DuplicatePolicy
|
Policy applied to the subject and to the mouse row when
already registered; see |
VERIFY
|
Returns:
| Type | Description |
|---|---|
DjKey[Mouse]
|
Mouse primary key |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
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: |
required |
deployment
|
DjRow[Deployment] | None
|
Optional deployment row. If omitted, built from
|
None
|
if_exists
|
DuplicatePolicy
|
Policy when |
VERIFY
|
Returns:
| Type | Description |
|---|---|
DjKey[Strain]
|
Strain primary key |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |