Open hthomas-czi opened 6 months ago
For a recent project (docs), I added some logic for specifying filters so you can do things like:
ensdb.genes(
filter=gf.filters.GeneBioTypeFilter("lncRNA")
& gf.filters.GeneRangesFilter("1:10000-20000")
)
We've defined &, |, ~
(and
, or
, not
) to do more complex combinations.
How much do you want to support custom data collections? E.g. if I have my own local census, which may have extra fields. Is that meant to be supported here? If that's supported it would be nice to be flexible about what columns are named, which could be difficult if columns to filter on are specified by keyword arguments.
Should the API use types? Particularly to use in method arguments?
Advantages include:
This design would arguably be more "Pythonic", in particular:
Current
Proposed
Note:
obs_value_filter
arguments would be optional, so users would only need to include their obs values of interest.Questions
var_value_filter
other thanfeature_id
? If not could it be simplified and more explicitly named asfeature_ids
and accept an array of strings rather than a string?