Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codes that check the return value of getGoSubOntology in the initialization routine of aspectMap. #239

Merged
merged 1 commit into from
Feb 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -380,20 +380,32 @@ protected Map<String, String> createDefaultAspectMap(OWLGraphWrapper graph) {

OWLClass mf = graph.getOWLClassByIdentifier("GO:0003674"); // molecular_function
if (mf != null) {
map.put(getGoSubOntology(mf, graph), "F");
String mfKey = getGoSubOntology(mf, graph);
if (mfKey == null)
throw new RuntimeException("Could not retrieve sub-ontology for GO:0003674 (molecular_function). The value of the OBO-namespace tag does not exist.");

map.put(mfKey, "F");
}

OWLClass bp = graph.getOWLClassByIdentifier("GO:0008150"); // biological_process
if (bp != null) {
map.put(getGoSubOntology(bp, graph), "P");
String bpKey = getGoSubOntology(bp, graph);
if (bpKey == null)
throw new RuntimeException("Could not retrieve sub-ontology for GO:0008150 (biological_process). The value of the OBO-namespace tag does not exist.");

map.put(bpKey, "P");
}

OWLClass cc = graph.getOWLClassByIdentifier("GO:0005575"); // cellular_component
if (cc != null) {
map.put(getGoSubOntology(cc, graph), "C");
String ccKey = getGoSubOntology(cc, graph);
if (ccKey == null)
throw new RuntimeException("Could not retrieve sub-ontology for GO:0005575 (celluar_component). The value of the OBO-namespace tag does not exist.");

map.put(ccKey, "C");
}

if (map.isEmpty()) {
if (map.isEmpty() || map.containsKey(null)) {
// only fail if there are mappings
// the test case uses a custom ontology, which has no cc branch
throw new RuntimeException("Could not create any valid aspect mappings. Is the correct ontology (GO) loaded?");
Expand Down