pub enum FeatureNameKind {
Exact,
Gene {
delim: char,
},
Locus {
merge_overlapping: bool,
},
Mixed,
}Expand description
Per-name canonicalization rule for cross-backend row alignment.
Concrete strategy only — no “request” variants. Callers that want
auto-detection pass None (or whatever wrapping enum they choose)
and call FeatureNameKind::auto_detect once row names are in hand.
Variants§
Exact
Strict string match — no canonicalization. Default.
Gene
Gene-symbol rule: register every delim-split component as an
alias of the full name. ENSG00000105329_TGFB1 and TGFB1
resolve to the same row.
Locus
Genomic-locus rule. Normalizes formats (chr1:1000-2000,
1:1000-2000, chr1_1000_2000 → 1_1000_2000). If
merge_overlapping, intervals that overlap on the same
chromosome additionally collapse into one cluster
(chr1:1-20 ∪ chr1:15-30 → 1_1_30). Useful for ATAC peak
sets called independently across datasets.
Mixed
Heterogeneous axis: dispatch per row name. Names that parse as
loci go through FeatureNameKind::Locus with overlap merging;
names with _ use FeatureNameKind::Gene; the rest pass
through. Picked automatically when [auto_detect] finds both
signatures in the same axis (e.g. paired RNA + ATAC union).
Implementations§
Source§impl FeatureNameKind
impl FeatureNameKind
Sourcepub fn canonicalize(&self, name: &str) -> Box<str>
pub fn canonicalize(&self, name: &str) -> Box<str>
Canonicalize a single name under this kind’s per-name rule.
[Locus { merge_overlapping: true }] and [Mixed] only describe
the per-name part here (format normalization for loci, last-token
split for gene-style); the global cluster step lives in
build_locus_overlap_canonical_map and is installed by
[build_canonicalizer].
Sourcepub fn needs_global_pass(&self) -> bool
pub fn needs_global_pass(&self) -> bool
True iff installing the canonicalizer requires peeking every row name across all backends first (to build the locus-overlap cluster map). Loaders branch on this.
Sourcepub fn auto_detect(names: &[Box<str>]) -> Self
pub fn auto_detect(names: &[Box<str>]) -> Self
Sniff names and pick the right kind. Tallies:
n_locus = count where parse_locus matches; n_gene_like =
count of remaining names that contain _ (loci with _
separators are not double-counted as gene-like). Decision:
both ≥ 10% → [Mixed]; else loci ≥ 50% →
Locus { merge_overlapping: true }; else gene-like ≥ 50% →
Gene { delim: '_' }; else [Exact].
Sourcepub fn reconcile(kinds: &[FeatureNameKind]) -> FeatureNameKind
pub fn reconcile(kinds: &[FeatureNameKind]) -> FeatureNameKind
The one kind to install for a set of files that were each sniffed
with auto_detect on their own.
Sniffing the POOLED names does not work: the signature usually lives
on one side only. A raw ENSG_SYM cohort pooled with a reference
already on the bare-symbol axis (a carried pb_reference, a
symbol-keyed panel) leaves the gene-like share under half, the pair
sniffs as Exact, and every gene becomes two rows. Canonicalizing
under Gene is a no-op for names lacking the delimiter, so adopting
the informative side is safe for both.
Gene-style and locus-style files together dispatch per name
(Mixed), which is what auto_detect would pick on one axis holding
both; Mixed anywhere stays Mixed; all-Exact stays Exact.
Sourcepub fn into_canonicalizer(self) -> Option<RowNameCanonicalizer>
pub fn into_canonicalizer(self) -> Option<RowNameCanonicalizer>
Build a RowNameCanonicalizer suitable for
[SparseIoVec::with_row_canonicalizer]. Returns None for
FeatureNameKind::Exact so callers don’t install a no-op
closure. Does not handle the LocusOverlap global step — for
that, use build_locus_overlap_canonicalizer.
Trait Implementations§
Source§impl Clone for FeatureNameKind
impl Clone for FeatureNameKind
Source§impl Debug for FeatureNameKind
impl Debug for FeatureNameKind
Source§impl Default for FeatureNameKind
impl Default for FeatureNameKind
impl Eq for FeatureNameKind
Source§impl PartialEq for FeatureNameKind
impl PartialEq for FeatureNameKind
impl StructuralPartialEq for FeatureNameKind
Auto Trait Implementations§
impl Freeze for FeatureNameKind
impl RefUnwindSafe for FeatureNameKind
impl Send for FeatureNameKind
impl Sync for FeatureNameKind
impl Unpin for FeatureNameKind
impl UnsafeUnpin for FeatureNameKind
impl UnwindSafe for FeatureNameKind
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.