🤖 Written by Claude
Split out of #24 (2020 wishlist), which is now closed.
Ask
Cohort node minimum counts are per-variant: "this variant is het/hom in at least N samples". We also want per-gene: "at least N samples have some qualifying variant in this gene".
That's a different shape of query - it aggregates the node's variants up to gene level, then filters variants back down to the genes that pass.
Where the pieces already are
AbstractZygosityCountNode.get_zygosity_count_arg_q_dict() (analysis/models/nodes/zygosity_count_node.py) - the current per-variant min/max counts, on CohortNode and AllVariantsNode.
NodeGenesCountCollection.get_or_create_gene_counts_qs_for_node() (analysis/models/gene_counts.py) - already does node → per-gene counts, and ZygosityNode uses it for compound het (gene_counts_qs.filter(count__gte=2).values('gene_id')). That is the closest existing pattern, though it counts variants per gene rather than samples per gene.
Open questions
Related: #406, #297.
🤖 Written by Claude
Split out of #24 (2020 wishlist), which is now closed.
Ask
Cohort node minimum counts are per-variant: "this variant is het/hom in at least N samples". We also want per-gene: "at least N samples have some qualifying variant in this gene".
That's a different shape of query - it aggregates the node's variants up to gene level, then filters variants back down to the genes that pass.
Where the pieces already are
AbstractZygosityCountNode.get_zygosity_count_arg_q_dict()(analysis/models/nodes/zygosity_count_node.py) - the current per-variant min/max counts, onCohortNodeandAllVariantsNode.NodeGenesCountCollection.get_or_create_gene_counts_qs_for_node()(analysis/models/gene_counts.py) - already does node → per-gene counts, andZygosityNodeuses it for compound het (gene_counts_qs.filter(count__gte=2).values('gene_id')). That is the closest existing pattern, though it counts variants per gene rather than samples per gene.Open questions
NodeGenesCountCollectionbe extended?CohortNode's Counts accordion, or its own filter node (cf. Gene based analysis #406 Gene based analysis)?Related: #406, #297.