metadata_parser.MetadataParser

Parses and manages channel and well metadata for an OMERO plate.

Usage

Source

metadata_parser.MetadataParser(
    conn,
    plate_id,
)

This class extracts metadata from an OMERO plate, either from an attached Excel file or from existing plate annotations. It validates, normalizes, and stores channel and well metadata, and provides methods to annotate the plate and its wells accordingly.

Attributes

conn: BlitzGateway

The OMERO connection object.

plate_id: int

The ID of the plate to parse.

excel_file: bool

Whether an Excel file was found and used for metadata.

channel_data: dict[str, str]

Channel metadata, mapping channel names to indices. Note: during the channel-role transition, the nucleus channel is still renamed to "DAPI" regardless of the user-provided name. New code should look up the nucleus channel via channel_data[channel_roles["nucleus"]] instead.

channel_roles: dict[str, str]

Mapping of role ("nucleus", "cell") to the channel name in channel_data. Populated by resolve_channel_roles().

well_data: dict[str, Any]

Well metadata, mapping annotation keys to lists of values.

pixel_size: float
Pixel size in micrometers, determined from the first image.

Methods

Name Description
__init__() Initializes the MetadataParser with an OMERO connection and plate ID.
manage_metadata() Parse, validate, and apply metadata for the OMERO plate.
well_conditions() Get the conditions for the specified well position (e.g. A1).

__init__()

Initializes the MetadataParser with an OMERO connection and plate ID.

Usage

Source

__init__(conn, plate_id)
Parameters
conn: BlitzGateway

The OMERO connection object.

plate_id: int
The ID of the plate to parse metadata from.

manage_metadata()

Parse, validate, and apply metadata for the OMERO plate.

Usage

Source

manage_metadata()

This method orchestrates the metadata management workflow: - Parses metadata from an attached Excel file or from plate annotations. - Validates the extracted metadata. - Retrieves pixel size information from the first image. - If an Excel file was used, applies channel and well annotations to the plate and deletes the Excel file. - Logs the outcome of the metadata management process.


well_conditions()

Get the conditions for the specified well position (e.g. A1).

Usage

Source

well_conditions(well_id)

See: WellWrapper.getWellPos().

Returns
dict[str, Any]
dict[str, Any]: Dictionary with annotations
Raises
ValueError
If the well position is not found in the metadata.