Skip to content
Closed
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
16 changes: 16 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,18 @@ 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_type: CellLineModel = Field(
..., title="Cell line type", description="Use CellLineLookup.get_by_name/search_by_name to populate"
)
species: Species.ONE_OF = Field(..., title="Species")
protein: PIDName = Field(..., title="Protein labeled", description="Protein uses UniProt registry")
gene: PIDName = Field(..., title="Gene targeted", description="Gene uses NCBI taxonomy")
cell_structure: str = Field(..., title="Cell structure protein found in")
fluorescent_protein: PIDName = Field(..., title="Fluorescent protein", description="Uses FPbase")
clone_number: Optional[int] = Field(default=None, title="Clone number")
16 changes: 11 additions & 5 deletions src/biodata_schema/core/subject.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
"""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,
HumanSubject,
MouseSubject,
NonHumanPrimateSubject,
)


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

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

notes: Optional[str] = Field(default=None, title="Notes")
41 changes: 41 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,
CellLine,
Housing,
HumanSubject,
LightCycle,
Expand Down Expand Up @@ -230,3 +232,42 @@ def test_breeding_info(self):
assert breeding_info.maternal_genotype == "wt/wt"
assert breeding_info.paternal_id == "P001"
assert breeding_info.paternal_genotype == "wt/wt"


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

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

subject = CellLine(
cell_line_name="AICS-0005",
cell_line_type=CellLineModel(
name="Human induced pluripotent stem cell line cell",
registry=Registry.CLO,
registry_identifier="CLO:0037308",
),
species=Species.HUMAN,
protein=PIDName(
name="paxilin",
registry=Registry.UNIPROT,
registry_identifier="P49023",
),
gene=PIDName(
name="paxilin",
abbreviation="PXN",
registry=Registry.NCBI,
registry_identifier="NM_0028593",
),
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