Skip to content

Commit

Permalink
Fixes #37
Browse files Browse the repository at this point in the history
  • Loading branch information
goodb committed Jan 13, 2019
1 parent b91df2b commit 093ba0d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
26 changes: 21 additions & 5 deletions exchange/src/main/java/org/geneontology/gocam/exchange/GoCAM.java
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ public QRunner initializeQRunner(Collection<OWLOntology> tbox) throws OWLOntolog
// qrunner.jena = qrunner.makeJenaModel(qrunner.wm);
// }

//TODO this is super slow. Find a new pattern.
void applyAnnotatedTripleRemover(IRI subject, IRI predicate, IRI object) {
OWLOntologyWalker walker = new OWLOntologyWalker(Collections.singleton(go_cam_ont));
UpdateAnnotationsVisitor updater = new UpdateAnnotationsVisitor(walker, subject, predicate, object);
Expand All @@ -719,14 +720,30 @@ void applyAnnotatedTripleRemover(IRI subject, IRI predicate, IRI object) {
for(OWLAxiom a : updater.getAxioms()) {
ontman.removeAxiom(go_cam_ont, a);
}
for(OWLAnnotation a : updater.getAnnotations()) {
OWLAnnotationProperty p = a.getProperty();
if(p.equals(evidence_prop)) {
//then we are looking at the Evidence instance as the target of the property
OWLAnnotationValue v = a.getValue();
OWLNamedIndividual anno_entity = df.getOWLNamedIndividual(v.asIRI().get());
deleteOwlEntityAndAllReferencesToIt(anno_entity);
}
}
}
}

void deleteOwlEntityAndAllReferencesToIt(OWLEntity e) {
void deleteOwlEntityAndAllReferencesToIt(OWLEntity e) {
for (OWLAnnotationAssertionAxiom annAx : EntitySearcher.getAnnotationAssertionAxioms(e.getIRI(), this.go_cam_ont)) {
ontman.removeAxiom(go_cam_ont, annAx);
}
for (OWLAxiom aAx :EntitySearcher.getReferencingAxioms(e, this.go_cam_ont)) {
//delete evidence nodes associated with axioms discussing this entity
for(OWLAnnotation anno : aAx.getAnnotations()) {
if(anno.getProperty().equals(evidence_prop)) {
OWLNamedIndividual evidence = df.getOWLNamedIndividual(anno.getValue().asIRI().get());
deleteOwlEntityAndAllReferencesToIt(evidence);
}
}
//now remove the axiom
ontman.removeAxiom(go_cam_ont, aAx);
}
Expand Down Expand Up @@ -1053,10 +1070,9 @@ RuleResults applySparqlRules(BioPaxtoGO.ImportStrategy strategy, String reactome
for(OWLObjectPropertyAssertionAxiom a : go_cam_ont.getAxioms(AxiomType.OBJECT_PROPERTY_ASSERTION)) {
OWLObjectPropertyExpression p = a.getProperty();
if(p.equals(located_in)) {
//OWLNamedIndividual s = a.getSubject().asOWLNamedIndividual();
OWLNamedIndividual s = a.getSubject().asOWLNamedIndividual();
OWLNamedIndividual o = a.getObject().asOWLNamedIndividual();
//applyAnnotatedTripleRemover(s.getIRI(), located_in.getIRI(), o.getIRI());
//ontman.removeAxiom(go_cam_ont, a);
applyAnnotatedTripleRemover(s.getIRI(), located_in.getIRI(), o.getIRI());
deleteOwlEntityAndAllReferencesToIt(o);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ where {
#that is part of the complex (at class level)
?output obo:BFO_0000051 ?output_part .
?output_part rdf:type ?output_part_type . #uniprot protein etc.
?input rdf:type ?output_part_type
?input rdf:type ?output_part_type .

#this is unsatisfying.. but better than nothing
#without it, query is finding reactions where the input complex has the same elements as the output complex
?reaction rdfs:label ?reaction_label .
FILTER regex(?reaction_label, "bind")
}

# obo:RO_0002233 has input
Expand Down

0 comments on commit 093ba0d

Please sign in to comment.