def test_get_mappings_for_curation(self): test_result_list = [] test_zooma_result = zooma.ZoomaResult( ['http://purl.obolibrary.org/obo/HP_0001892'], 'abnormal bleeding', 'HIGH', 'eva-clinvar') mapping = test_zooma_result.mapping_list[0] mapping.confidence = zooma.ZoomaConfidence.HIGH mapping.in_efo = False mapping.is_current = False mapping.ontology_label = "" mapping.source = 'eva-clinvar' mapping.uri = 'http://purl.obolibrary.org/obo/HP_0000483' test_result_list.append(test_zooma_result) test_zooma_result = zooma.ZoomaResult( ['http://www.orpha.net/ORDO/Orphanet_976'], 'Adenine phosphoribosyltransferase deficiency', 'HIGH', 'eva-clinvar') mapping = test_zooma_result.mapping_list[0] mapping.confidence = zooma.ZoomaConfidence.HIGH mapping.in_efo = True mapping.is_current = True mapping.ontology_label = "Adenine phosphoribosyltransferase deficiency" mapping.source = 'eva-clinvar' mapping.uri = 'http://www.orpha.net/ORDO/Orphanet_976' test_result_list.append(test_zooma_result) expected_curation_mapping_list = [mapping] self.assertEqual(expected_curation_mapping_list, output.get_mappings_for_curation(test_result_list))
def test_get_current_efo_mapping(self): """If mapping is in EFO and is current, is *should* be selected for curation.""" test_zooma_result = zooma.ZoomaResult(['http://purl.obolibrary.org/obo/MONDO_0008091'], 'Abnormal neutrophil chemotactic response', 'MEDIUM', 'eva-clinvar') mapping = test_zooma_result.mapping_list[0] mapping.confidence = zooma.ZoomaConfidence.HIGH mapping.in_efo = True mapping.is_current = True mapping.ontology_label = "Abnormal neutrophil chemotactic response" mapping.source = 'eva-clinvar' mapping.uri = 'http://purl.obolibrary.org/obo/MONDO_0008091' self.assertEqual([mapping], output.get_mappings_for_curation([test_zooma_result]))
def test_get_obsolete_efo_mapping(self): """If mapping is in EFO, but is not current, it *should not* be selected for curation.""" test_zooma_result = zooma.ZoomaResult(['http://www.orpha.net/ORDO/Orphanet_976'], 'Adenine phosphoribosyltransferase deficiency', 'HIGH', 'eva-clinvar') mapping = test_zooma_result.mapping_list[0] mapping.confidence = zooma.ZoomaConfidence.HIGH mapping.in_efo = True mapping.is_current = False mapping.ontology_label = "Adenine phosphoribosyltransferase deficiency" mapping.source = 'eva-clinvar' mapping.uri = 'http://www.orpha.net/ORDO/Orphanet_976' self.assertEqual([], output.get_mappings_for_curation([test_zooma_result]))
def test_get_non_efo_mapping(self): """If mapping is not in EFO, its `is_current` flag should *not* be checked, and the mapping *should* be selected for curation.""" test_zooma_result = zooma.ZoomaResult(['http://purl.obolibrary.org/obo/HP_0001892'], 'abnormal bleeding', 'HIGH', 'eva-clinvar') mapping = test_zooma_result.mapping_list[0] mapping.confidence = zooma.ZoomaConfidence.HIGH mapping.in_efo = False mapping.is_current = False mapping.ontology_label = "" mapping.source = 'eva-clinvar' mapping.uri = 'http://purl.obolibrary.org/obo/HP_0000483' self.assertEqual([mapping], output.get_mappings_for_curation([test_zooma_result]))
def test_get_zooma_results_for_trait(self): zooma_response_list = [{'confidence': 'HIGH', 'semanticTags': ['http://purl.obolibrary.org/obo/HP_0001892'], 'provenance': {'source': {'uri': 'http://www.ebi.ac.uk/spot/zooma', 'type': 'DATABASE', 'name': 'zooma'}, 'generatedDate': 1502287637052, 'accuracy': None, 'generator': 'ZOOMA', 'annotator': 'ZOOMA', 'evidence': 'ZOOMA_INFERRED_FROM_CURATED', 'annotationDate': 1502287637052}, '_links': {'olslinks': [{'href': 'https://www.ebi.ac.uk/ols/api/terms?iri=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FHP_0001892', 'semanticTag': 'http://purl.obolibrary.org/obo/HP_0001892'}]}, 'annotatedBiologicalEntities': [], 'annotatedProperty': {'uri': 'http://rdf.ebi.ac.uk/resource/zooma/8EAA9C1095AD18A90D557D7086084B64', 'propertyValue': 'abnormal bleeding', 'propertyType': 'disease'}, 'uri': None, 'derivedFrom': {'semanticTags': ['http://purl.obolibrary.org/obo/HP_0001892'], 'provenance': {'source': {'uri': 'http://www.ebi.ac.uk/eva', 'type': 'DATABASE', 'name': 'eva-clinvar'}, 'generatedDate': 1502442040000, 'accuracy': 'NOT_SPECIFIED', 'generator': 'http://www.ebi.ac.uk/eva', 'annotator': 'eva', 'evidence': 'MANUAL_CURATED', 'annotationDate': -61612629390000}, '_links': {'olslinks': [{'href': 'http://purl.obolibrary.org/obo/HP_0001892', 'semanticTag': 'http://purl.obolibrary.org/obo/HP_0001892'}]}, 'annotatedBiologicalEntities': [], 'annotatedProperty': {'uri': 'http://rdf.ebi.ac.uk/resource/zooma/8EAA9C1095AD18A90D557D7086084B64', 'propertyValue': 'abnormal bleeding', 'propertyType': 'disease'}, 'uri': 'http://rdf.ebi.ac.uk/resource/zooma/eva-clinvar/2D66457AE8F4E9A31CDD27E66F5B4607', 'replaces': [], 'replacedBy': []}, 'replaces': [], 'replacedBy': []}] expected_zooma_result = zooma.ZoomaResult(['http://purl.obolibrary.org/obo/HP_0001892'], 'abnormal bleeding', 'HIGH', 'eva-clinvar') entry = expected_zooma_result.mapping_list[0] entry.confidence = zooma.ZoomaConfidence.HIGH entry.in_efo = False entry.is_current = False entry.ontology_label = "" entry.source = 'eva-clinvar' entry.uri = 'http://purl.obolibrary.org/obo/HP_0000483' expected_mappings = [expected_zooma_result] self.assertEqual(zooma.get_zooma_results_for_trait(zooma_response_list), expected_mappings)
def test_process_zooma_result(self): test_trait = trait.Trait('aprt deficiency, japanese type', 1) test_zooma_result = zooma.ZoomaResult(['http://www.orpha.net/ORDO/Orphanet_976'], 'Adenine phosphoribosyltransferase deficiency', 'HIGH', 'eva-clinvar') entry = test_zooma_result.mapping_list[0] entry.confidence = zooma.ZoomaConfidence.HIGH entry.in_efo = True entry.is_current = True entry.ontology_label = "Adenine phosphoribosyltransferase deficiency" entry.source = 'eva-clinvar' entry.uri = 'http://www.orpha.net/ORDO/Orphanet_976' test_trait.zooma_result_list.append(test_zooma_result) test_trait.process_zooma_results() self.assertEqual(1, len(test_trait.finished_mapping_set))