owltools.gaf.inference
Class BasicAnnotationPropagator

java.lang.Object
  extended by owltools.gaf.inference.AbstractAnnotationPredictor
      extended by owltools.gaf.inference.BasicAnnotationPropagator
All Implemented Interfaces:
AnnotationPredictor

public class BasicAnnotationPropagator
extends AbstractAnnotationPredictor
implements AnnotationPredictor

This performs basic annotation inferences involving propagation between the 3 sub-ontologies in GO

This approach pre-computes the possible non-redundant propagations classes for each class during the setup. The actual prediction step looks at the annotations for each bioentity and evidence code as a separate unit.
All annotations, which were assigned by the 'GOC', are considered to be predictions and are ignored for the new predictions. This has the effect that even if there are 'old' predictions in the GAF, they still we be re-inferred for the report.


Field Summary
protected static org.apache.log4j.Logger LOG
           
protected static boolean SKIP_IEA
           
 
Constructor Summary
BasicAnnotationPropagator(GafDocument gafDocument, OWLGraphWrapper graph)
          Create instance.
 
Method Summary
protected  Map<String,String> createDefaultAspectMap(OWLGraphWrapper graph)
          Create the mapping from the sub ontology to the aspect in the GAF.
protected  Prediction createPrediction(org.semanticweb.owlapi.model.OWLClass c, String aspect, String with, GeneAnnotation source)
           
protected  Map<String,Set<org.semanticweb.owlapi.model.OWLClass>> createPropagationRules(OWLGraphWrapper graph, org.semanticweb.owlapi.reasoner.OWLReasoner reasoner)
          Create the default propagation rule set tailored for the GeneOntology.
 void dispose()
           
protected static Set<org.semanticweb.owlapi.model.OWLClass> getDirectLinkedClasses(org.semanticweb.owlapi.model.OWLClass c, Set<org.semanticweb.owlapi.model.OWLObjectProperty> properties, OWLGraphWrapper g, Set<org.semanticweb.owlapi.model.OWLClass> superSet)
          Lookup relation super classes in graph g for a given sub class c and property p.
protected static Set<org.semanticweb.owlapi.model.OWLClass> getDirectLinkedClasses(org.semanticweb.owlapi.model.OWLClass c, String property, OWLGraphWrapper g)
          Lookup relation super classes in graph g for a given sub class c and property p.
protected  String getGoSubOntology(org.semanticweb.owlapi.model.OWLClass c, OWLGraphWrapper g)
          Get the specific sub ontology.
protected static Set<org.semanticweb.owlapi.model.OWLClass> getIsaPartofSuperClassClosure(Collection<org.semanticweb.owlapi.model.OWLClass> annotations, OWLGraphWrapper graph, org.semanticweb.owlapi.reasoner.OWLReasoner r)
           
protected static Set<org.semanticweb.owlapi.model.OWLClass> getNonRedundantLinkedClasses(org.semanticweb.owlapi.model.OWLClass c, Set<org.semanticweb.owlapi.model.OWLObjectProperty> properties, OWLGraphWrapper g, org.semanticweb.owlapi.reasoner.OWLReasoner reasoner, Set<org.semanticweb.owlapi.model.OWLClass> superSet, Map<Set<org.semanticweb.owlapi.model.OWLClass>,Set<org.semanticweb.owlapi.model.OWLClass>> cache)
          Retrieve the non redundant set of linked classes using the given relation.
protected  String getSubOntology(org.semanticweb.owlapi.model.OWLClass c)
           
 List<Prediction> predictForBioEntity(Bioentity entity, Collection<GeneAnnotation> annotations)
           
protected static Set<org.semanticweb.owlapi.model.OWLClass> reduceToNonRedundant(Set<org.semanticweb.owlapi.model.OWLClass> classes, org.semanticweb.owlapi.reasoner.OWLReasoner reasoner)
          Given a set of classes, create a new non-redundant set with respect to the inferred super class hierarchy.
 
Methods inherited from class owltools.gaf.inference.AbstractAnnotationPredictor
getAllPredictions, getGafDocument, getGraph, predict, setAndFilterRedundantPredictions, setAndFilterRedundantPredictions, setGafDocument, setGraph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface owltools.gaf.inference.AnnotationPredictor
getAllPredictions, predict
 

Field Detail

LOG

protected static org.apache.log4j.Logger LOG

SKIP_IEA

protected static boolean SKIP_IEA
Constructor Detail

BasicAnnotationPropagator

public BasicAnnotationPropagator(GafDocument gafDocument,
                                 OWLGraphWrapper graph)
Create instance.

Parameters:
gafDocument -
graph -
Method Detail

createPropagationRules

protected Map<String,Set<org.semanticweb.owlapi.model.OWLClass>> createPropagationRules(OWLGraphWrapper graph,
                                                                                        org.semanticweb.owlapi.reasoner.OWLReasoner reasoner)
Create the default propagation rule set tailored for the GeneOntology.

Parameters:
graph -
reasoner -
Returns:
set of valid propagation rules

getNonRedundantLinkedClasses

protected static Set<org.semanticweb.owlapi.model.OWLClass> getNonRedundantLinkedClasses(org.semanticweb.owlapi.model.OWLClass c,
                                                                                         Set<org.semanticweb.owlapi.model.OWLObjectProperty> properties,
                                                                                         OWLGraphWrapper g,
                                                                                         org.semanticweb.owlapi.reasoner.OWLReasoner reasoner,
                                                                                         Set<org.semanticweb.owlapi.model.OWLClass> superSet,
                                                                                         Map<Set<org.semanticweb.owlapi.model.OWLClass>,Set<org.semanticweb.owlapi.model.OWLClass>> cache)
Retrieve the non redundant set of linked classes using the given relation. The reasoner is used to infer the super and subsets for the subClass hierarchy. Only return classes, which are in the given super set (a.k.a. ontology branch).

This can be an expensive operation, especially the reduceToNonRedundant(Set, OWLReasoner). Therefore the results of that method are cached in a map.
For example, using the cache for GO, there was a reduction of the startup time from 95 seconds to 10 seconds.

Parameters:
c -
properties -
g -
reasoner -
superSet -
cache -
Returns:
set of linked classes, never null

getDirectLinkedClasses

protected static Set<org.semanticweb.owlapi.model.OWLClass> getDirectLinkedClasses(org.semanticweb.owlapi.model.OWLClass c,
                                                                                   String property,
                                                                                   OWLGraphWrapper g)
Lookup relation super classes in graph g for a given sub class c and property p.

Parameters:
c -
property -
g -
Returns:
set of super classes or null

getDirectLinkedClasses

protected static Set<org.semanticweb.owlapi.model.OWLClass> getDirectLinkedClasses(org.semanticweb.owlapi.model.OWLClass c,
                                                                                   Set<org.semanticweb.owlapi.model.OWLObjectProperty> properties,
                                                                                   OWLGraphWrapper g,
                                                                                   Set<org.semanticweb.owlapi.model.OWLClass> superSet)
Lookup relation super classes in graph g for a given sub class c and property p. If superSet not null, only retain super classes which are in the given super set.

Parameters:
c -
properties -
g -
superSet -
Returns:
set of super classes or null

reduceToNonRedundant

protected static Set<org.semanticweb.owlapi.model.OWLClass> reduceToNonRedundant(Set<org.semanticweb.owlapi.model.OWLClass> classes,
                                                                                 org.semanticweb.owlapi.reasoner.OWLReasoner reasoner)
Given a set of classes, create a new non-redundant set with respect to the inferred super class hierarchy. Remove all classes which are (inferred) super classes of another class in the given set.

WARNING: This can be an expensive operation.

Parameters:
classes -
reasoner -
Returns:
non redundant set, never null

createDefaultAspectMap

protected Map<String,String> createDefaultAspectMap(OWLGraphWrapper graph)
Create the mapping from the sub ontology to the aspect in the GAF.

Parameters:
graph -
Returns:
aspect mapping

getGoSubOntology

protected String getGoSubOntology(org.semanticweb.owlapi.model.OWLClass c,
                                  OWLGraphWrapper g)
Get the specific sub ontology.

Parameters:
c -
g -
Returns:
sub ontology or null

predictForBioEntity

public List<Prediction> predictForBioEntity(Bioentity entity,
                                            Collection<GeneAnnotation> annotations)
Specified by:
predictForBioEntity in interface AnnotationPredictor

getIsaPartofSuperClassClosure

protected static Set<org.semanticweb.owlapi.model.OWLClass> getIsaPartofSuperClassClosure(Collection<org.semanticweb.owlapi.model.OWLClass> annotations,
                                                                                          OWLGraphWrapper graph,
                                                                                          org.semanticweb.owlapi.reasoner.OWLReasoner r)

getSubOntology

protected String getSubOntology(org.semanticweb.owlapi.model.OWLClass c)

createPrediction

protected Prediction createPrediction(org.semanticweb.owlapi.model.OWLClass c,
                                      String aspect,
                                      String with,
                                      GeneAnnotation source)

dispose

public void dispose()
Specified by:
dispose in interface AnnotationPredictor
Overrides:
dispose in class AbstractAnnotationPredictor


Copyright © 2010-2014. All Rights Reserved.