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
31 changes: 31 additions & 0 deletions docs/source/components/subjects.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,37 @@ Description of a calibration object
| `objects` | Optional[List[[Device](devices.md#device)]] | Objects (For calibration objects that are built up from one or more devices.) |


### CellLine

Description of a cultured cell line

| Field | Type | Title (Description) |
|-------|------|-------------|
| `cell_line_name` | `str` | Cell line name |
| `cell_line_id` | `Optional[str]` | Cell line ID |
| `source` | [Organization](../biodata_models/organizations.md#organization) | Source (Where the subject was acquired from.) |
| `cell_line_type` | `biodata_models.cell_line.CellLineModel` | Cell line type |
| `species` | [Species](../biodata_models/species.md#species) | Species |
| `clone_number` | `Optional[int]` | Clone number |


### FluorescentCellLine

Description of a cultured cell line with fluorescent label

| Field | Type | Title (Description) |
|-------|------|-------------|
| `protein` | [PIDName](../biodata_models/pid_names.md#pidname) | Protein labeled (Protein uses UniProt registry) |
| `cell_structure` | `str` | Cell structure the protein is found in |
| `fluorescent_protein` | [PIDName](../biodata_models/pid_names.md#pidname) | Fluorescent protein (Uses FPbase) |
| `cell_line_name` | `str` | Cell line name |
| `cell_line_id` | `Optional[str]` | Cell line ID |
| `source` | [Organization](../biodata_models/organizations.md#organization) | Source (Where the subject was acquired from.) |
| `cell_line_type` | `biodata_models.cell_line.CellLineModel` | Cell line type |
| `species` | [Species](../biodata_models/species.md#species) | Species |
| `clone_number` | `Optional[int]` | Clone number |


### HomeCageEnrichment

Materials provided in animal home cage
Expand Down
2 changes: 1 addition & 1 deletion docs/source/subject.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ Description of a subject of data collection
| Field | Type | Title (Description) |
|-------|------|-------------|
| `subject_name` | `str` | Subject name (Unique name for the subject of data acquisition) |
| `subject_details` | [MouseSubject](components/subjects.md#mousesubject) or [HumanSubject](components/subjects.md#humansubject) or [NonHumanPrimateSubject](components/subjects.md#nonhumanprimatesubject) or [CalibrationObject](components/subjects.md#calibrationobject) | Subject Details |
| `subject_details` | [MouseSubject](components/subjects.md#mousesubject) or [HumanSubject](components/subjects.md#humansubject) or [NonHumanPrimateSubject](components/subjects.md#nonhumanprimatesubject) or [CellLine](components/subjects.md#cellline) or [FluorescentCellLine](components/subjects.md#fluorescentcellline) or [CalibrationObject](components/subjects.md#calibrationobject) | Subject Details |
| `notes` | `Optional[str]` | Notes |
24 changes: 24 additions & 0 deletions src/biodata_schema/components/subjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from enum import Enum
from typing import Annotated, List, Optional

from biodata_models.cell_line import CellLineModel
from biodata_models.organizations import Organization
from biodata_models.pid_names import PIDName
from biodata_models.species import Species, Strain
Expand Down Expand Up @@ -195,3 +196,26 @@ class CalibrationObject(DataModel):
objects: Optional[list[Device]] = Field(
default=None, title="Objects", description="For calibration objects that are built up from one or more devices."
)


class CellLine(DataModel):
"""Description of a cultured cell line"""

cell_line_name: str = Field(..., title="Cell line name")
cell_line_id: Optional[str] = Field(default=None, title="Cell line ID")
source: Organization.ONE_OF = Field(
...,
description="Where the subject was acquired from.",
title="Source",
)
cell_line_type: CellLineModel = Field(..., title="Cell line type")
species: Species.ONE_OF = Field(..., title="Species")
clone_number: Optional[int] = Field(default=None, title="Clone number")


class FluorescentCellLine(CellLine):
"""Description of a cultured cell line with fluorescent label"""

protein: PIDName = Field(..., title="Protein labeled", description="Protein uses UniProt registry")
cell_structure: str = Field(..., title="Cell structure the protein is found in") # TODO: ontology/enum in model
fluorescent_protein: PIDName = Field(..., title="Fluorescent protein", description="Uses FPbase")
17 changes: 12 additions & 5 deletions src/biodata_schema/core/subject.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
"""schema for mostly mouse metadata"""
"""schema for subject metadata"""

from typing import Annotated, Literal, Optional

from pydantic import Field, SkipValidation

from biodata_schema.base import DataCoreModel, Discriminated, DraftRequirement
from biodata_schema.components.subjects import CalibrationObject, HumanSubject, MouseSubject, NonHumanPrimateSubject
from biodata_schema.components.subjects import (
CalibrationObject,
CellLine,
FluorescentCellLine,
HumanSubject,
MouseSubject,
NonHumanPrimateSubject,
)


class Subject(DataCoreModel):
Expand All @@ -20,8 +27,8 @@ class Subject(DataCoreModel):
title="Subject name",
)

subject_details: Discriminated[MouseSubject | HumanSubject | NonHumanPrimateSubject | CalibrationObject] = Field(
..., title="Subject Details"
)
subject_details: Discriminated[
MouseSubject | HumanSubject | NonHumanPrimateSubject | CellLine | FluorescentCellLine | CalibrationObject
] = Field(..., title="Subject Details")

notes: Optional[str] = Field(default=None, title="Notes")
37 changes: 37 additions & 0 deletions tests/test_subjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from datetime import datetime

import pytest
from biodata_models.cell_line import CellLineModel
from biodata_models.organizations import Organization
from biodata_models.pid_names import PIDName
from biodata_models.registries import Registry
Expand All @@ -11,6 +12,7 @@
from biodata_schema.components.subjects import (
BreedingInfo,
CalibrationObject,
FluorescentCellLine,
Housing,
HumanSubject,
LightCycle,
Expand Down Expand Up @@ -230,3 +232,38 @@ def test_breeding_info(self):
assert breeding_info.maternal_genotype == "wt/wt"
assert breeding_info.paternal_name == "P001"
assert breeding_info.paternal_genotype == "wt/wt"


class TestCellLine:
"""Test the Cell Line model"""

def test_cellline(self):
"""Test of cell line"""

subject = FluorescentCellLine(
cell_line_name="AICS-0005",
cell_line_id="AICS-0005",
cell_line_type=CellLineModel(
name="Human induced pluripotent stem cell line cell",
registry=Registry.CLO,
registry_identifier="CLO:0037308",
),
source=Organization.AI,
species=Species.HUMAN,
protein=PIDName(
name="paxilin",
registry=Registry.UNIPROT,
registry_identifier="P49023",
),
cell_structure="cytoskeleton",
fluorescent_protein=PIDName(
name="enhanced GFP",
abbreviation="EGFP",
registry=Registry.FPbase,
registry_identifier="R9NL8",
),
clone_number=1,
)

assert subject.cell_structure == "cytoskeleton"
assert subject.species == Species.HUMAN
Loading