Add filter_meta_array and change filter_arrays_by_meta to support more complex items_to_filter parameters by using filter_meta_array - #725
Conversation
… into jg/add_functionality_to_filter_arrays_by_meta
| only_group = [{"group": "adj"}, {"group": "raw"}] | ||
| group_gen_anc_a = [{"group": "adj", "gen_anc": "a"}] | ||
| group_gen_anc_a_b = [*group_gen_anc_a, {"group": "adj", "gen_anc": "b"}] | ||
| group_gen_anc = [*group_gen_anc_a_b, {"group": "adj", "gen_anc": "c"}] |
There was a problem hiding this comment.
should this one be named "group_gen_anc_a_b_c" ?
There was a problem hiding this comment.
after reading through, maybe just add a comment here to clarify since it breaks the pattern
| group_sex = [{"group": "adj", "sex": "XX"}, {"group": "adj", "sex": "XY"}] | ||
| group_subset = [ | ||
| {"group": "adj", "subset": "s1"}, | ||
| {"group": "raw", "subset": "s1"}, |
There was a problem hiding this comment.
just following the patterns of the others, should this actually be {"group": "adj", "subset": "s2"}?
There was a problem hiding this comment.
or add comment to clarify
| {"group": "adj", "gen_anc": "b", "sex": "XY"}, | ||
| ] | ||
| group_gen_anc_a_b_sex = group_gen_anc_a_sex + group_gen_anc_b_sex | ||
| group_gen_anc_sex = [ |
| *group_gen_anc_a_subset, | ||
| {"group": "adj", "gen_anc": "b", "subset": "s1"}, | ||
| ] | ||
| group_gen_anc_subset = [ |
There was a problem hiding this comment.
group_gen_anc_a_b_c_subset?
| group_gen_anc_a_b_sex_subset = ( | ||
| group_gen_anc_a_sex_subset + group_gen_anc_b_sex_subset | ||
| ) | ||
| group_gen_anc_sex_subset = [ |
There was a problem hiding this comment.
group_gen_anc_a_b_c_sex_subset
| combine_operator: str, | ||
| exact_match: bool, | ||
| expected: str, | ||
| metadata_combinations: Any, |
There was a problem hiding this comment.
what does metadata_combinations refer to?
| expected_meta: List[Dict[str, str]], | ||
| expected_expr1: List[int], | ||
| expected_expr2: List[int], | ||
| ) -> None: |
| (s_ga_list, False, *all_and, False, "no_sex_and_no_gen_anc"), | ||
| (s_ga_ex, True, *all_and, False, "no_sex_and_no_gen_anc"), | ||
| (["sex", "subset"], True, "or", "and", "and", False, "sex_or_subset"), | ||
| (ss_d_list, False, *all_and, False, "no_subset_and_no_downsampling"), |
There was a problem hiding this comment.
should only exclude if both subset and downsampling are present?
| exact_match: bool, | ||
| expected_meta: str, | ||
| metadata_combinations: Any, | ||
| ) -> None: |
| filtering criteria for keys/key-value pairs to exclude. | ||
| :param combine_operator: Whether to use "and" or "or" to combine the keep and | ||
| exclude filtering criteria. | ||
| :param exact_match: Whether to apply the filtering only to items with exactly the |
There was a problem hiding this comment.
clarify that this only relates to the "keep" items
I still need to add tests for the added function and modified function