read_hoc_file

singlecell_input_mapper.udvary2022.reader.read_hoc_file(fname: str = '', label_map: dict[str, str] | None = None) list[_Edge]

Read a .hoc morphology file and return a list of Edge objects.

Instead of hard-coding section-type names, the function extracts the raw label from every create <label> statement via regex and resolves it through label_map.

The map key is compared against the prefix of the raw label (everything before the first _), case- insensitively. If no key matches, the raw label itself is used as the semantic label so that unknown section types are preserved.

Mapping a prefix to None causes those sections to be skipped entirely.

Parameters:
fname : str

Path to the .hoc

label_map : dict[str, str]

Mapping between labels in the .hoc and actual label used in ISF.

Returns:

A list of _Edge objects representing the cell morphology (axon sections excluded by default).

Raises:

IOError – If fname is not a .hoc file, or if the parsed data are internally inconsistent.