itasc.contact_analysis.catalog¶
Catalog of contact-analysis positions for Contact Analysis.
Builds, loads, and saves a catalog of positions (each a contact-analysis .h5
plus optional cell/nucleus label images) discovered by file name / relative path
via discover_catalog_entries().
Each row anchors on a position_path — the absolute path to the position
folder — and stores every file (the contact-analysis .h5, cell labels,
nucleus labels) as a path relative to that folder (e.g.
contact_analysis.h5, beside the committed labels). Persisting the position folder lets
downstream tools (notably the NLS classifier) resolve their own per-position
relative paths against it. Older catalogs that lack position_path still load:
their file paths are resolved relative to the CSV file’s directory.
Module attributes
The contacts |
Functions
|
Zip level names to folder-name segments; blank/ |
|
Find catalog entries under root by file name / relative path. |
|
The shared nesting depth of discovered positions, or |
|
Load CSV catalog records and expose normalized compatibility keys. |
|
Append incoming records while skipping duplicate resolved H5 paths. |
|
The folder-name segments from root (exclusive) to position_path (inclusive). |
|
Write catalog records to CSV. |
- itasc.contact_analysis.catalog.CONTACT_ANALYSIS_RELPATH = 'contact_analysis.h5'¶
The contacts
.h5is a derived Contact Analysis output, not a discovery input. It lives in the position base folder, beside the committedcell_labels.tif/nucleus_labels.tif— one homogeneous layout for every downstream-stable per-position artifact.
- itasc.contact_analysis.catalog.relative_levels(root, position_path)[source]¶
The folder-name segments from root (exclusive) to position_path (inclusive).
These are the nesting levels a discovered position sits under; the UI names each level once and every position inherits its column values from its own segments (see
columns_from_levels()).
- itasc.contact_analysis.catalog.columns_from_levels(level_names, segments)[source]¶
Zip level names to folder-name segments; blank/
Nonenames drop out.Extra segments without a paired name (or extra names without a segment) are ignored — only the overlap with a non-blank name becomes a column.
- itasc.contact_analysis.catalog.discovered_level_depth(root, position_paths)[source]¶
The shared nesting depth of discovered positions, or
Noneif it varies.Folder-derived columns anchor at the root (level 1 = first folder under root), so the level names line up across positions only when every position sits at the same depth. A
Nonereturn tells the caller to warn rather than mislabel.
- itasc.contact_analysis.catalog.load_catalog(csv_path)[source]¶
Load CSV catalog records and expose normalized compatibility keys.
Only
position_pathis required. Uniqueness of the position identity (the combination of classification columns) is not checked here — a catalog may hold more positions than any one run aggregates; the aggregator validates uniqueness over the in-scope subset and refuses with an explanation there (seeitasc.contact_analysis.shape_tables.aggregate()).
- itasc.contact_analysis.catalog.save_catalog(csv_path, records)[source]¶
Write catalog records to CSV.
Each row stores the absolute
position_pathand the position’s files as paths relative to that folder. Records without a known position folder (legacy / hand-made) fall back to paths relative to the CSV file.
- itasc.contact_analysis.catalog.merge_catalog_records(existing, incoming)[source]¶
Append incoming records while skipping duplicate resolved H5 paths.
- itasc.contact_analysis.catalog.discover_catalog_entries(root, *, cell_name=None, nucleus_name=None)[source]¶
Find catalog entries under root by file name / relative path.
A position is any folder that contains at least one recognized input — cell labels and/or nucleus labels, each optional (cell_name / nucleus_name are a bare file name or a path relative to the position folder). A folder is registered once and carries whichever inputs it has; the others are
None. The contact-analysis.h5is a derived Contact Analysis output, not a discovery input: every position’s contact path is the fixed default location (CONTACT_ANALYSIS_RELPATH) and need not exist yet (it is built later by the contacts quantifier). The returned dicts carry the discovered paths but no metadata (date / condition / notes) — that is assigned before adding to the catalog.