Skip to content

Commit

Permalink
chore: remove unused schemas (#321)
Browse files Browse the repository at this point in the history
Forgot to remove in  #304
  • Loading branch information
korikuzma authored Jul 23, 2024
1 parent ce8a3ef commit ab31d98
Showing 1 changed file with 0 additions and 281 deletions.
281 changes: 0 additions & 281 deletions src/cool_seq_tool/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,74 +116,6 @@ class BaseModelForbidExtra(BaseModel, extra="forbid"):
"""Base Pydantic model class with extra values forbidden."""


class GenomicRequestBody(BaseModelForbidExtra):
"""Define constraints for genomic to transcript exon coordinates request body"""

chromosome: StrictStr | StrictInt
start: StrictInt | None = None
end: StrictInt | None = None
strand: Strand | None = None
transcript: StrictStr | None = None
gene: StrictStr | None = None
residue_mode: ResidueMode = ResidueMode.RESIDUE

@model_validator(mode="after")
def check_start_and_end(cls, values):
"""Check that at least one of {``start``, ``end``} is set"""
start, end = values.start, values.end
if not start or end:
msg = "Must provide either `start` or `end`"
raise ValueError(msg)
return values

model_config = ConfigDict(
json_schema_extra={
"example": {
"chromosome": "NC_000001.11",
"start": 154192135,
"end": None,
"strand": Strand.NEGATIVE,
"transcript": "NM_152263.3",
"gene": "TPM3",
"residue_mode": "residue",
}
}
)


class TranscriptRequestBody(BaseModelForbidExtra):
"""Define constraints for transcript exon to genomic coordinates request body"""

transcript: StrictStr
gene: StrictStr | None = None
exon_start: StrictInt | None = None
exon_start_offset: StrictInt | None = 0
exon_end: StrictInt | None = None
exon_end_offset: StrictInt | None = 0

@model_validator(mode="after")
def check_exon_start_and_exon_end(cls, values):
"""Check that at least one of {``exon_start``, ``exon_end``} is set"""
exon_start, exon_end = values.exon_start, values.exon_end
if not exon_start or exon_end:
msg = "Must provide either `exon_start` or `exon_end`"
raise ValueError(msg)
return values

model_config = ConfigDict(
json_schema_extra={
"example": {
"gene": "TPM3",
"transcript": "NM_152263.3",
"exon_start": 1,
"exon_start_offset": 1,
"exon_end": None,
"exon_end_offset": None,
}
}
)


class TranscriptExonData(BaseModelForbidExtra):
"""Model containing transcript exon data."""

Expand Down Expand Up @@ -354,216 +286,3 @@ class GenomicDataResponse(BaseModelForbidExtra):
}
}
)


class MappedManeData(BaseModel):
"""Define mapped mane data fields"""

gene: StrictStr
refseq: StrictStr
ensembl: StrictStr | None = None
strand: Strand
status: TranscriptPriority
alt_ac: StrictStr
assembly: Assembly

model_config = ConfigDict(
json_schema_extra={
"example": {
"gene": "BRAF",
"refseq": "NM_001374258.1",
"ensembl": "ENST00000644969.2",
"strand": Strand.NEGATIVE,
"status": TranscriptPriority.MANE_PLUS_CLINICAL,
"alt_ac": "NC_000007.13",
"assembly": Assembly.GRCH37,
}
}
)


class MappedManeDataService(BaseModelForbidExtra):
"""Service model response for mapped mane data"""

mapped_mane_data: MappedManeData | None = None
warnings: list[StrictStr] = []
service_meta: ServiceMeta

model_config = ConfigDict(
json_schema_extra={
"example": {
"mapped_mane_data": {
"gene": "BRAF",
"refseq": "NM_001374258.1",
"ensembl": "ENST00000644969.2",
"strand": Strand.NEGATIVE,
"status": TranscriptPriority.MANE_PLUS_CLINICAL,
"alt_ac": "NC_000007.13",
"assembly": Assembly.GRCH37,
},
"warnings": [],
"service_meta": {
"name": "cool_seq_tool",
"version": __version__,
"response_datetime": _now,
"url": "https://github.com/GenomicMedLab/cool-seq-tool",
},
}
}
)


class ManeData(BaseModel):
"""Define mane data fields"""

gene: StrictStr | None = None
refseq: StrictStr | None = None
ensembl: StrictStr | None = None
pos: tuple[int, int]
strand: Strand
status: TranscriptPriority

model_config = ConfigDict(
json_schema_extra={
"example": {
"gene": "BRAF",
"refseq": "NP_004324.2",
"ensembl": "ENSP00000493543.1",
"pos": (598, 598),
"strand": Strand.NEGATIVE,
"status": TranscriptPriority.MANE_SELECT,
}
}
)


class ManeDataService(BaseModelForbidExtra):
"""Service model response for getting mane data"""

mane_data: ManeData | None = None
warnings: list[StrictStr] = []
service_meta: ServiceMeta

model_config = ConfigDict(
json_schema_extra={
"example": {
"mane_data": {
"gene": "BRAF",
"refseq": "NP_004324.2",
"ensembl": "ENSP00000493543.1",
"pos": (598, 598),
"strand": Strand.NEGATIVE,
"status": TranscriptPriority.MANE_SELECT,
},
"warnings": [],
"service_meta": {
"name": "cool_seq_tool",
"version": __version__,
"response_datetime": _now,
"url": "https://github.com/GenomicMedLab/cool-seq-tool",
},
}
}
)


# ALIGNMENT MAPPER SERVICE SCHEMAS


class CdnaRepresentation(BaseModelForbidExtra):
"""Model response for cDNA representation"""

c_ac: StrictStr
c_start_pos: StrictInt
c_end_pos: StrictInt
cds_start: StrictInt
residue_mode: Literal[ResidueMode.INTER_RESIDUE] = ResidueMode.INTER_RESIDUE.value

model_config = ConfigDict(
json_schema_extra={
"example": {
"c_ac": "NM_004333.6",
"c_start_pos": 1797,
"c_end_pos": 1800,
"cds_start": 226,
"residue_mode": ResidueMode.INTER_RESIDUE,
}
}
)


class ToCdnaService(BaseModelForbidExtra):
"""Service model response for protein -> cDNA"""

c_data: CdnaRepresentation | None = None
warnings: list[StrictStr] = []
service_meta: ServiceMeta

model_config = ConfigDict(
json_schema_extra={
"example": {
"c_data": {
"c_ac": "NM_004333.6",
"c_start_pos": 1797,
"c_end_pos": 1800,
"cds_start": 226,
"residue_mode": ResidueMode.INTER_RESIDUE,
},
"warnings": [],
"service_meta": {
"name": "cool_seq_tool",
"version": __version__,
"response_datetime": _now,
"url": "https://github.com/GenomicMedLab/cool-seq-tool",
},
}
}
)


class GenomicRepresentation(BaseModelForbidExtra):
"""Model response for genomic representation"""

g_ac: str
g_start_pos: int
g_end_pos: int
residue_mode: Literal[ResidueMode.INTER_RESIDUE] = ResidueMode.INTER_RESIDUE.value

model_config = ConfigDict(
json_schema_extra={
"example": {
"g_ac": "NC_000007.13",
"g_start_pos": 140453134,
"g_end_pos": 140453137,
"residue_mode": ResidueMode.INTER_RESIDUE,
}
}
)


class ToGenomicService(BaseModelForbidExtra):
"""Service model response for cDNA -> genomic"""

g_data: GenomicRepresentation | None = None
warnings: list[StrictStr] = []
service_meta: ServiceMeta

model_config = ConfigDict(
json_schema_extra={
"example": {
"g_data": {
"g_ac": "NC_000007.13",
"g_start_pos": 140453134,
"g_end_pos": 140453137,
"residue_mode": ResidueMode.INTER_RESIDUE,
},
"warnings": [],
"service_meta": {
"name": "cool_seq_tool",
"version": __version__,
"response_datetime": _now,
"url": "https://github.com/GenomicMedLab/cool-seq-tool",
},
}
}
)

0 comments on commit ab31d98

Please sign in to comment.