def test_get_key_to_multiple_values_non_empty(self) -> None: key_value_pairs = [("A", 1), ("A", 2), ("A", 3), ("B", 1), ("B", 5), ("C", 1), ("D", 9)] result = get_key_to_multiple_values(key_value_pairs) result_expected = { "A": [1, 2, 3], "B": [1, 5], } self.assertEqual(result_expected, result)
def get_gene_name_to_multiple_infos(gene_infos: Collection[GeneInfo]) -> Dict[str, List[GeneInfo]]: return get_key_to_multiple_values([(info.gene, info) for info in gene_infos])
def test_get_key_to_multiple_values_empty(self) -> None: key_value_pairs: List[Tuple[str, int]] = [] result = get_key_to_multiple_values(key_value_pairs) result_expected: Dict[str, List[int]] = {} self.assertEqual(result_expected, result)
def get_rs_id_to_multiple_variants( variants: Collection[Variant]) -> Dict[str, List[Variant]]: return get_key_to_multiple_values([(info.rs_id, info) for info in variants])
def get_variant_combination_to_multiple_haplotypes( haplotypes: Collection[Haplotype] ) -> Dict[FrozenSet[Variant], List[Haplotype]]: return get_key_to_multiple_values([(haplotype.variants, haplotype) for haplotype in haplotypes])
def get_name_to_multiple_haplotypes( haplotypes: Collection[Haplotype]) -> Dict[str, List[Haplotype]]: return get_key_to_multiple_values([(haplotype.name, haplotype) for haplotype in haplotypes])
def get_drug_name_to_multiple_infos( drug_infos: Collection[DrugInfo]) -> Dict[str, List[DrugInfo]]: return get_key_to_multiple_values([(info.name, info) for info in drug_infos])