Frozen dictionaries: match only the source rows a caller marks - #26
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_mapapplies to marked rows only) but stay insrc_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),Nonewhen the types table does not list the table's rows in order (written for another table).Why: senna reads mixed-type tables (an
fnetable'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_hostis 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_rowsmarks by position and refuses a misaligned table.