Plexora

DatasetSchema

Which column holds each cell-level role, as the project recorded it.

Generated from Plexora 0.0.55View source
from plexora.api import DatasetSchema
DatasetSchema(
    cell_id: str | None = None,
    x: str | None = None,
    y: str | None = None,
    celltype: str | None = None,
    image_id: str | None = None,
    extra: Mapping[str, str] = dict(),
)

A plugin should never hardcode a column name such as "X_centroid" -- that column may not exist, or may be named differently, in the next dataset. Read the role off the schema instead (schema.x, schema.y, schema.cell_id, schema.celltype, schema.image_id) and it resolves to whatever column the project actually recorded for that role, or None when the project has not recorded one.

Building one is cheap: it reads the project record only, never the feature table. Which columns are markers is a different question, answered from the data itself by TableHandle.markers, not by this schema.

Fields

cell_idstr | Nonedefault None

Column holding each cell's unique id, or None if not recorded.

xstr | Nonedefault None

Column holding each cell's x coordinate, or None if not recorded.

ystr | Nonedefault None

Column holding each cell's y coordinate, or None if not recorded.

celltypestr | Nonedefault None

Column holding each cell's type/phenotype label, or None if not recorded.

image_idstr | Nonedefault None

Column holding the source image id, for a table pooled across several images, or None if not recorded.

extraMapping[str, str]default dict()

Roles beyond the five above, keyed by role name. Look one up with get() rather than indexing this mapping directly.

Methods

from_project

@classmethod
from_project(project: Project) -> 'DatasetSchema | None'

Build the schema recorded on a project.

projectProjectrequired

The project record to read roles from.

DatasetSchema | None

None when the project has no feature table, since there are then no columns for a role to name.

get

get(role: str) -> str | None

Look up a role by name, including one that only exists in extra.

rolestrrequired

The role name, e.g. "x", or a project-specific role recorded after this dataclass was written.

str | None

The column name for that role, or None if the project never recorded one.

On this page