use of org.monarchinitiative.loinc2hpo.util.HPO_Class_Found in project loinc2hpo by monarch-initiative.
the class SparqlQueryTest method testQueryWithOneKey.
@Test
public void testQueryWithOneKey() {
String key = "Testosterone";
String looseQueryString = SparqlQuery.buildLooseQueryWithSingleKey(key);
String standardQueryString = SparqlQuery.buildStandardQueryWithSingleKey(key);
// System.out.println("loose query:\n" + looseQueryString);
// System.out.println("\n\nstandard query:\n" + standardQueryString);
Query looseQuery = QueryFactory.create(looseQueryString);
Query standardQuery = QueryFactory.create(standardQueryString);
assertNotNull(model);
List<HPO_Class_Found> results_loose = SparqlQuery.query(looseQuery, model, null);
List<HPO_Class_Found> results_standard = SparqlQuery.query(standardQuery, model, null);
/**
* System.out.println(results_loose.size() + " HPO terms are found!");
* for(HPO_Class_Found hpo : results_loose) {
* System.out.println(hpo.getLabel() + "\t" + hpo.getId() + "\n" + hpo.getDefinition());
* }
*/
// interesting that this program identifies 16 classes;
assertEquals(14, results_loose.size());
// while the same query finds 14 in command line
// reason: command line uses hp.owl; this program builds a model from hp.owl(?)
// reason: more likely has something to do with what kind of model is generated from hp.owl
// System.out.println(results_standard.size()+ " HPO terms are found!");
assertEquals(9, results_standard.size());
}
use of org.monarchinitiative.loinc2hpo.util.HPO_Class_Found in project loinc2hpo by monarch-initiative.
the class AnnotateTabController method handleCandidateHPODoubleClick.
@FXML
private void handleCandidateHPODoubleClick(MouseEvent e) {
if (e.getClickCount() == 2 && hpoListView.getSelectionModel().getSelectedItem() != null && hpoListView.getSelectionModel().getSelectedItem() instanceof HPO_Class_Found) {
HPO_Class_Found hpo_class_found = (HPO_Class_Found) hpoListView.getSelectionModel().getSelectedItem();
List<HPO_Class_Found> parents = SparqlQuery.getParents(hpo_class_found.getId());
List<HPO_Class_Found> children = SparqlQuery.getChildren(hpo_class_found.getId());
// dummy root node
TreeItem<HPO_TreeView> rootItem = new TreeItem<>(new HPO_TreeView());
rootItem.setExpanded(true);
TreeItem<HPO_TreeView> current = new TreeItem<>(new HPO_TreeView(hpo_class_found));
// add parent terms to root; add current to each parent term
parents.stream().map(p -> new TreeItem<>(new HPO_TreeView(p))).forEach(p -> {
rootItem.getChildren().add(p);
p.getChildren().add(current);
p.setExpanded(true);
});
current.setExpanded(true);
// add child terms to current
children.stream().map(p -> new TreeItem<>(new HPO_TreeView(p))).forEach(current.getChildren()::add);
this.treeView.setRoot(rootItem);
}
e.consume();
}
use of org.monarchinitiative.loinc2hpo.util.HPO_Class_Found in project loinc2hpo by monarch-initiative.
the class SparqlQueryTest method testQueryWithMultiKeys.
@Test
public void testQueryWithMultiKeys() {
String[] keys = new String[] { "chronic", "kidney", "disease" };
String looseQueryString = SparqlQuery.buildLooseQueryWithMultiKeys(Arrays.asList(keys));
String standardQueryString = SparqlQuery.buildStandardQueryWithMultiKeys(Arrays.asList(keys));
Query looseQuery = QueryFactory.create(looseQueryString);
Query standardQuery = QueryFactory.create(standardQueryString);
List<HPO_Class_Found> itr_loose = SparqlQuery.query(looseQuery, model, null);
List<HPO_Class_Found> itr_standard = SparqlQuery.query(standardQuery, model, null);
// System.out.println(itr_loose.size() + " HPO terms are found!");
assertEquals(7, itr_loose.size());
// System.out.println(itr_standard.size() + " HPO terms are found!");
assertEquals(5, itr_standard.size());
}
Aggregations