Skip to content

Frozen dictionaries: match only the source rows a caller marks - #26

Merged
YPARK merged 2 commits into
mainfrom
frozen-source-rows
Oct 3, 2026
Merged

YPARK merged 2 commits into
mainfrom
frozen-source-rows

Conversation

@YPARK

@YPARK YPARK commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Adds load_frozen_feature_host_matching(args, matchable): the callback is handed the dictionary's row names as read and returns one flag per row, by position. Unmarked rows are never matched or renamed (source_name_map applies to marked rows only) but stay in src_names / src_e_feat.

feature_types::feature_rows(types, names) builds those flags from a types table: true for gene and region rows (is_data_feature_type), None when the types table does not list the table's rows in order (written for another table).

Why: senna reads mixed-type tables (an fne table's genes beside ontology terms, words and cell types) for their data-feature rows alone. Filtering after the match let a cell type named like a gene, earlier in the table, win the first-occurrence lookup; marking by name would mark both rows. The filter has to come before the match, by position.

load_frozen_feature_host is unchanged (every row marked), so this is additive: a patch release, 0.7.5. Also: unmarked rows sharing a name with a matchable one are logged; the first-occurrence rule is documented; a stray run of spaces in an old warning is fixed.

Tests: an earlier unmarked same-name row is passed over and keeps its name; the marks are asked of the raw names; refusals checked by message; feature_rows marks by position and refuses a misaligned table.

YPARK added 2 commits October 3, 2026 09:57
load_frozen_feature_host_matching takes a callback that is handed the
dictionary's row names as read and returns which rows may match. An
unmarked row is never matched but stays in src_names / src_e_feat. This
is how a mixed-type table (an fne table's genes beside ontology terms,
words and cell types) is read for its gene rows alone: filtering after
the match let a cell type named like a gene, earlier in the table, win
the first-occurrence lookup. load_frozen_feature_host is the same with
every row marked.
…re data features

feature_types::feature_rows marks a table's gene and region rows by
position from its types table (None for a table it does not list), by
the new is_data_feature_type. The matcher is an FnOnce, documented as
positional; only marked rows are renamed by source_name_map, so a cell
type named like a gene is neither matched nor renamed. Unmarked rows
that share a name with a matchable one are logged. The plain loader's
empty-dictionary error is back; callback errors name the dictionary;
the first-occurrence rule is documented.
@YPARK
YPARK merged commit 34ab636 into main Oct 3, 2026
5 checks passed
@YPARK
YPARK deleted the frozen-source-rows branch October 3, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant