def process_trait(trait: Trait, filters: dict, zooma_host: str, oxo_target_list: list, oxo_distance: int) -> Trait: """ Process a single trait. Find any mappings in Zooma. If there are no high confidence Zooma mappings that are in EFO then query OxO with any high confidence mappings not in EFO. :param trait: The trait to be processed. :param filters: A dictionary of filters to use for querying Zooma. :param zooma_host: A string with the hostname to use for querying Zooma :param oxo_target_list: A list of strings, each being an OxO ID for an ontology. Used to specify which ontologies should be queried using OxO. :param oxo_distance: int specifying the maximum number of steps to use to query OxO. i.e. OxO's "distance" parameter. :return: The original trait after querying Zooma and possibly OxO, with any results found. """ trait.zooma_result_list = get_zooma_results(trait.name, filters, zooma_host) trait.process_zooma_results() if (trait.is_finished or len(trait.zooma_result_list) == 0 or any([ entry.is_current for mapping in trait.zooma_result_list for entry in mapping.mapping_list ])): return trait uris_for_oxo_set = get_uris_for_oxo(trait.zooma_result_list) if len(uris_for_oxo_set) == 0: return trait oxo_input_id_list = uris_to_oxo_format(uris_for_oxo_set) trait.oxo_result_list = get_oxo_results(oxo_input_id_list, oxo_target_list, oxo_distance) trait.process_oxo_mappings() return trait
def process_trait(trait: Trait, filters: dict, zooma_host: str, oxo_target_list: list, oxo_distance: int) -> Trait: """ Process a single trait. Find any mappings in Zooma. If there are no high confidence Zooma mappings that are in EFO then query OxO with any high confidence mappings not in EFO. :param trait: The trait to be processed. :param filters: A dictionary of filters to use for querying Zooma. :param zooma_host: A string with the hostname to use for querying Zooma :param oxo_target_list: A list of strings, each being an OxO ID for an ontology. Used to specify which ontologies should be queried using OxO. :param oxo_distance: int specifying the maximum number of steps to use to query OxO. i.e. OxO's "distance" parameter. :return: The original trait after querying Zooma and possibly OxO, with any results found. """ trait.zooma_result_list = get_zooma_results(trait.name, filters, zooma_host) trait.process_zooma_results() if (trait.is_finished or len(trait.zooma_result_list) == 0 or any([entry.is_current for mapping in trait.zooma_result_list for entry in mapping.mapping_list])): return trait uris_for_oxo_set = get_uris_for_oxo(trait.zooma_result_list) if len(uris_for_oxo_set) == 0: return trait oxo_input_id_list = uris_to_oxo_format(uris_for_oxo_set) trait.oxo_result_list = get_oxo_results(oxo_input_id_list, oxo_target_list, oxo_distance) trait.process_oxo_mappings() return trait