import typing as t
from pydantic import BaseModel, Field
[docs]
class CellTypeSummaryStatisticsResults(BaseModel):
"""
Represents the data object returned by the CAS API for nearest neighbor annotations.
"""
[docs]
class DatasetStatistics(BaseModel):
dataset_id: str = Field(
description="The ID of the dataset containing cells", examples=["a7a92fb49-50741b00a-244955d47"]
)
count_per_dataset: int = Field(description="The number of cells found in the dataset", examples=[10])
min_distance: float = Field(
description="The minimum distance between the query cell and the dataset cells",
examples=[1589.847900390625],
)
max_distance: float = Field(
description="The maximum distance between the query cell and the dataset cells",
examples=[1840.047119140625],
)
median_distance: float = Field(
description="The median distance between the query cell and the dataset cells", examples=[1791.372802734375]
)
mean_distance: float = Field(
description="The mean distance between the query cell and the dataset cells", examples=[1791.372802734375]
)
[docs]
class SummaryStatistics(BaseModel):
cell_type: str = Field(description="The cell type of the cluster of cells", examples=["erythrocyte"])
cell_count: int = Field(description="The number of cells in the cluster", examples=[94])
min_distance: float = Field(
description="The minimum distance between the query cell and the cluster cells",
examples=[1589.847900390625],
)
p25_distance: float = Field(
description="The 25th percentile distance between the query cell and the cluster cells",
examples=[1664.875244140625],
)
median_distance: float = Field(
description="The median distance between the query cell and the cluster cells", examples=[1791.372802734375]
)
p75_distance: float = Field(
description="The 75th percentile distance between the query cell and the cluster cells",
examples=[1801.3585205078125],
)
max_distance: float = Field(
description="The maximum distance between the query cell and the cluster cells",
examples=[1840.047119140625],
)
dataset_ids_with_counts: t.Optional[t.List["CellTypeSummaryStatisticsResults.DatasetStatistics"]] = None
[docs]
class NeighborhoodAnnotation(BaseModel):
"""
Represents the data object returned by the CAS API for a single nearest neighbor annotation.
"""
query_cell_id: str = Field(description="The ID of the querying cell", examples=["ATTACTTATTTAGTT-12311"])
matches: t.List["CellTypeSummaryStatisticsResults.SummaryStatistics"]
data: t.List["CellTypeSummaryStatisticsResults.NeighborhoodAnnotation"] = Field(description="The annotations found")
CellTypeSummaryStatisticsResults.model_rebuild()
[docs]
class CellTypeOntologyAwareResults(BaseModel):
"""
Represents the data object returned by the CAS API for a ontology-aware annotations.
"""
[docs]
class Match(BaseModel):
score: float = Field(description="The score of the match", examples=[0.789])
cell_type_ontology_term_id: str = Field(
description="The ontology term ID of the cell type for the match", examples=["CL:0000121"]
)
cell_type: str = Field(description="The cell type of the match", examples=["erythrocyte"])
[docs]
class OntologyAwareAnnotation(BaseModel):
"""
Represents the data object returned by the CAS API for a single ontology-aware annotation.
"""
query_cell_id: str = Field(description="The ID of the querying cell", examples=["ATTACTTATTTAGTT-12311"])
matches: t.List["CellTypeOntologyAwareResults.Match"] = Field(
description="The matches found for the querying cell"
)
total_weight: float = Field(description="The total weight of the matches", examples=[11.23232])
total_neighbors: int = Field(description="The total number of neighbors matched", examples=[1023])
total_neighbors_unrecognized: int = Field(
description="The total number of neighbors that were not recognized", examples=[5]
)
data: t.List["CellTypeOntologyAwareResults.OntologyAwareAnnotation"] = Field(description="The annotations found")
CellTypeOntologyAwareResults.model_rebuild()
[docs]
class MatrixQueryResults(BaseModel):
"""
Represents the data object returned by the CAS API when performing a cell matrix query
(e.g. a query of the cell database using a matrix).
"""
[docs]
class Match(BaseModel):
cas_cell_index: float = Field(description="CAS-specific ID of a single cell", examples=[123])
distance: float = Field(
description="The distance between this querying cell and the found cell", examples=[0.123]
)
[docs]
class MatrixQueryResult(BaseModel):
"""
Represents the data object returned by the CAS API for a single cell query.
"""
query_cell_id: str = Field(description="The ID of the querying cell", examples=["ATTACTTATTTAGTT-12311"])
neighbors: t.List["MatrixQueryResults.Match"]
data: t.List["MatrixQueryResults.MatrixQueryResult"] = Field(description="The results of the query")
MatrixQueryResults.model_rebuild()
[docs]
class CellQueryResults(BaseModel):
"""
Represents the data object returned by the CAS API for a cell query.
"""
data: t.List["CellQueryResults.CellariumCellMetadata"] = Field(description="The metadata of the found cells")
CellQueryResults.model_rebuild()