コード例 #1
0
ファイル: main.py プロジェクト: tomdcsmith/eva-cttv-pipeline
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
コード例 #2
0
ファイル: main.py プロジェクト: cyenyxe/eva-cttv-pipeline
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
コード例 #3
0
 def test_get_result_without_ols_label(self):
     """If OLS does not provide a label for a trait, ZOOMA original label must be used instead."""
     requested_trait_name = 'Mucopolysaccharidosis type VI'
     expected_trait_label = 'Mucopolysaccharidosis type 6'
     zooma_result = zooma.get_zooma_results(requested_trait_name, self.filters, self.zooma_host)
     self.assertEqual(len(zooma_result), 1)
     mappings = zooma_result[0].mapping_list
     self.assertEqual(len(mappings), 3)
     self.assertIn(expected_trait_label, [m.ontology_label for m in mappings])