Problem
A downstream consumer that needs to filter variants out of a fetched window has no public
type to build the result with. In aster we have now accumulated three stand-in
dataclasses that duck-type gvl internals, all in one module:
_FlatScalar — stands in for the per-field scalar wrapper, so we can rebuild
fw.fields[k] after indexing.
_FlatWindow — stands in for gvl's private _FlatWindow, carrying data and
seq_offsets.
- a
ProvenanceChunk that we now return from a filter function that attaches no
provenance, purely because it has the right shape.
None of these are supported API. They work today because the attribute names happen to
match; a rename inside gvl breaks them silently, and nothing in our test suite would
attribute the failure to gvl.
Why we need it
Panel/exome-restricted views over a WGS dataset must drop variants outside the capture
footprint (see #417 — there is no way to clip the regions themselves, so the filtering has
to happen on the fetched window). The natural operation is "give me this window with a
boolean mask applied over its variants", preserving the ragged per-variant layout.
Request
Either of:
- A public per-variant filter on the flat variant-window type —
fw.filter(keep: NDArray[np.bool_]) / fw[keep] — returning the same type with
ref_window, alt, and every entry of fields subset consistently and re-packed.
- A public chunk type with the window's shape (
data + seq_offsets, ragged
per-variant accessors, a fields mapping) that consumers can construct, so the
filtering can live downstream without duck-typing private classes.
(1) is the better fit — the re-packing of the ragged offsets is exactly the part a consumer
should not be reimplementing, and it is where an off-by-one silently corrupts sequence
content rather than raising.
Status
Not blocking: aster has a working local implementation. Filing so the private-API
dependency is recorded rather than discovered at the next rename.
Problem
A downstream consumer that needs to filter variants out of a fetched window has no public
type to build the result with. In aster we have now accumulated three stand-in
dataclasses that duck-type gvl internals, all in one module:
_FlatScalar— stands in for the per-field scalar wrapper, so we can rebuildfw.fields[k]after indexing._FlatWindow— stands in for gvl's private_FlatWindow, carryingdataandseq_offsets.ProvenanceChunkthat we now return from a filter function that attaches noprovenance, purely because it has the right shape.
None of these are supported API. They work today because the attribute names happen to
match; a rename inside gvl breaks them silently, and nothing in our test suite would
attribute the failure to gvl.
Why we need it
Panel/exome-restricted views over a WGS dataset must drop variants outside the capture
footprint (see #417 — there is no way to clip the regions themselves, so the filtering has
to happen on the fetched window). The natural operation is "give me this window with a
boolean mask applied over its variants", preserving the ragged per-variant layout.
Request
Either of:
fw.filter(keep: NDArray[np.bool_])/fw[keep]— returning the same type withref_window,alt, and every entry offieldssubset consistently and re-packed.data+seq_offsets, raggedper-variant accessors, a
fieldsmapping) that consumers can construct, so thefiltering can live downstream without duck-typing private classes.
(1) is the better fit — the re-packing of the ragged offsets is exactly the part a consumer
should not be reimplementing, and it is where an off-by-one silently corrupts sequence
content rather than raising.
Status
Not blocking: aster has a working local implementation. Filing so the private-API
dependency is recorded rather than discovered at the next rename.