You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(lapis): api to compute the count for every lineage including sub lineages - #1931
Adds sublineage-inclusive aggregation on /sample/aggregated: append * to a lineage field in fields (e.g. fields=country,pangoLineage*) to get a count for every lineage including all of its sublineages. Counts do not partition — a sequence is counted into each of its ancestor lineages.
Example: GET /sample/aggregated?fields=pangoLineage* → rows like { "pangoLineage*": "B.1.1*", "count": 1234 } (values carry the trailing *).
<field>* syntax — only on the aggregated endpoint, only for fields with a lineage index; matched case-insensitively. Each matched sequence rolls up into its full ancestor chain, resolving aliases and alias-of-alias (e.g. BQ.1.1 → BE.1 → BA.5.3.1 → B.1.1.529 → B) and stopping the climb at recombinant edges.
Reject plain + star on the same field — fields=pangoLineage,pangoLineage* returns 400. Combinations with other fields (country,pangoLineage*) are allowed.
Requires a RhyDB build with concat and transitiveClosure
PR Checklist
All necessary documentation has been adapted.
All necessary changes are explained in the llms.txt.
The implemented feature is covered by an appropriate test.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved aggregation issues misclassify leaf recombinant samples into the null bucket and cause ambiguous counts or rejected valid requests when temporary column names collide with metadata fields.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Filtering incoming edges drops recombinant leaf lineages from the closure, incorrectly placing samples assigned to them or their aliases in the null bucket rather than their own lineage bucket.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Preserve recombinant leaf lineages in closure buckets
When a recombinant lineage has no non-recombinant children, filtering its incoming edges removes it entirely from the closure. Samples assigned to it or its aliases then contribute to the null bucket instead of its own <lineage>* bucket. Union self-edges from the unfiltered lineage table before taking the closure, and update the rendering expectations and regression coverage for a recombinant leaf.
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
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.
resolves #1876
Summary
Adds sublineage-inclusive aggregation on
/sample/aggregated: append*to a lineage field infields(e.g.fields=country,pangoLineage*) to get a count for every lineage including all of its sublineages. Counts do not partition — a sequence is counted into each of its ancestor lineages.Example:
GET /sample/aggregated?fields=pangoLineage*→ rows like{ "pangoLineage*": "B.1.1*", "count": 1234 }(values carry the trailing*).<field>*syntax — only on the aggregated endpoint, only for fields with a lineage index; matched case-insensitively. Each matched sequence rolls up into its full ancestor chain, resolving aliases and alias-of-alias (e.g.BQ.1.1→BE.1→BA.5.3.1→B.1.1.529→B) and stopping the climb at recombinant edges.fields=pangoLineage,pangoLineage*returns 400. Combinations with other fields (country,pangoLineage*) are allowed.Requires a RhyDB build with
concatandtransitiveClosurePR Checklist
llms.txt.