Permalink
Browse files

[#62] we still need the the inject indicator for guice. We can the ma…

…tcher package through java reflection and let the injector construct the objects.
  • Loading branch information...
1 parent 5bba20a commit 56a4aa2389918418d53af8fea879b42d5615b33f @jnguyenx jnguyenx committed Mar 9, 2017
Showing with 60 additions and 2 deletions.
  1. +0 −2 owlsim-core/src/main/java/org/monarchinitiative/owlsim/compute/matcher/ProfileMatcher.java
  2. +2 −0 ...a/org/monarchinitiative/owlsim/compute/matcher/impl/AbstractSemanticSimilarityProfileMatcher.java
  3. +3 −0 ...rc/main/java/org/monarchinitiative/owlsim/compute/matcher/impl/BayesianNetworkProfileMatcher.java
  4. +3 −0 ...re/src/main/java/org/monarchinitiative/owlsim/compute/matcher/impl/GridNegatedProfileMatcher.java
  5. +3 −0 owlsim-core/src/main/java/org/monarchinitiative/owlsim/compute/matcher/impl/GridProfileMatcher.java
  6. +3 −0 .../main/java/org/monarchinitiative/owlsim/compute/matcher/impl/JaccardSimilarityProfileMatcher.java
  7. +3 −0 ...archinitiative/owlsim/compute/matcher/impl/MaximumInformationContentSimilarityProfileMatcher.java
  8. +3 −0 .../monarchinitiative/owlsim/compute/matcher/impl/NaiveBayesFixedWeightThreeStateProfileMatcher.java
  9. +3 −0 ...hinitiative/owlsim/compute/matcher/impl/NaiveBayesFixedWeightTwoStateNoBlanketProfileMatcher.java
  10. +3 −0 ...rg/monarchinitiative/owlsim/compute/matcher/impl/NaiveBayesFixedWeightTwoStateProfileMatcher.java
  11. +3 −0 ...ava/org/monarchinitiative/owlsim/compute/matcher/impl/NaiveBayesVariableWeightProfileMatcher.java
  12. +3 −0 ...re/src/main/java/org/monarchinitiative/owlsim/compute/matcher/impl/PhenodigmICProfileMatcher.java
  13. +3 −0 ...va/org/monarchinitiative/owlsim/compute/matcher/impl/ThreeStateBayesianNetworkProfileMatcher.java
  14. +25 −0 owlsim-services/src/main/java/org/monarchinitiative/owlsim/services/modules/KnowledgeBaseModule.java
@@ -111,6 +111,4 @@ public ProfileQuery createProfileQueryFromClasses(Set<String> classIds,
*/
BMKnowledgeBase getKnowledgeBase();
-
-
}
@@ -1,5 +1,7 @@
package org.monarchinitiative.owlsim.compute.matcher.impl;
+import javax.inject.Inject;
+
import org.monarchinitiative.owlsim.compute.mica.MostInformativeCommonAncestorCalculator;
import org.monarchinitiative.owlsim.compute.mica.impl.MostInformativeCommonAncestorCalculatorImpl;
import org.monarchinitiative.owlsim.kb.BMKnowledgeBase;
@@ -5,6 +5,8 @@
import java.util.Map;
import java.util.Set;
+import javax.inject.Inject;
+
import org.apache.log4j.Logger;
import org.monarchinitiative.owlsim.compute.cpt.ConditionalProbabilityIndex;
import org.monarchinitiative.owlsim.compute.cpt.IncoherentStateException;
@@ -101,6 +103,7 @@
private Calculator[] calculatorCache;
private Double[][] targetClassProbabilityCache;
+ @Inject
private BayesianNetworkProfileMatcher(BMKnowledgeBase kb) {
super(kb);
int N = kb.getIndividualIdsInSignature().size();
@@ -1,5 +1,7 @@
package org.monarchinitiative.owlsim.compute.matcher.impl;
+import javax.inject.Inject;
+
import org.apache.log4j.Logger;
import org.monarchinitiative.owlsim.compute.matcher.NegationAwareProfileMatcher;
import org.monarchinitiative.owlsim.kb.BMKnowledgeBase;
@@ -22,6 +24,7 @@
/**
* @param kb
*/
+ @Inject
public GridNegatedProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
@@ -3,6 +3,8 @@
import java.util.List;
import java.util.Set;
+import javax.inject.Inject;
+
import org.apache.log4j.Logger;
import org.monarchinitiative.owlsim.compute.matcher.ProfileMatcher;
import org.monarchinitiative.owlsim.compute.mica.MostInformativeCommonAncestorCalculator.ClassInformationContentPair;
@@ -32,6 +34,7 @@
/**
* @param kb
*/
+ @Inject
public GridProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
@@ -2,6 +2,8 @@
import java.util.List;
+import javax.inject.Inject;
+
import org.apache.log4j.Logger;
import org.monarchinitiative.owlsim.compute.matcher.ProfileMatcher;
import org.monarchinitiative.owlsim.kb.BMKnowledgeBase;
@@ -26,6 +28,7 @@
/**
* @param kb
*/
+ @Inject
public JaccardSimilarityProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
@@ -2,6 +2,8 @@
import java.util.List;
+import javax.inject.Inject;
+
import org.apache.log4j.Logger;
import org.monarchinitiative.owlsim.compute.matcher.ProfileMatcher;
import org.monarchinitiative.owlsim.compute.mica.MostInformativeCommonAncestorCalculator.ClassInformationContentPair;
@@ -28,6 +30,7 @@
/**
* @param kb
*/
+ @Inject
private MaximumInformationContentSimilarityProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
@@ -4,6 +4,8 @@
import java.util.List;
import java.util.Set;
+import javax.inject.Inject;
+
import org.apache.log4j.Logger;
import org.monarchinitiative.owlsim.compute.matcher.NegationAwareProfileMatcher;
import org.monarchinitiative.owlsim.kb.BMKnowledgeBase;
@@ -29,6 +31,7 @@
private Logger LOG = Logger.getLogger(NaiveBayesFixedWeightThreeStateProfileMatcher.class);
+ @Inject
private NaiveBayesFixedWeightThreeStateProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
@@ -1,5 +1,7 @@
package org.monarchinitiative.owlsim.compute.matcher.impl;
+import javax.inject.Inject;
+
import org.monarchinitiative.owlsim.kb.BMKnowledgeBase;
/**
@@ -8,6 +10,7 @@
*/
public class NaiveBayesFixedWeightTwoStateNoBlanketProfileMatcher extends NaiveBayesFixedWeightTwoStateProfileMatcher {
+ @Inject
private NaiveBayesFixedWeightTwoStateNoBlanketProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
@@ -7,6 +7,8 @@
import java.util.Map;
import java.util.Set;
+import javax.inject.Inject;
+
import org.apache.log4j.Logger;
import org.monarchinitiative.owlsim.compute.matcher.ProfileMatcher;
import org.monarchinitiative.owlsim.kb.BMKnowledgeBase;
@@ -76,6 +78,7 @@ public WeightedTypesBM(EWAHCompressedBitmap typesBM, Double weight) {
// for maps a pair of (Individual, InterpretationIndex) to a set of inferred (self, direct, indirect) types
private Map<Integer,Map<Integer,WeightedTypesBM>> individualToInterpretationToTypesBM = new HashMap<>();
+ @Inject
protected NaiveBayesFixedWeightTwoStateProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
@@ -3,6 +3,8 @@
import java.util.List;
import java.util.Set;
+import javax.inject.Inject;
+
import org.apache.log4j.Logger;
import org.monarchinitiative.owlsim.compute.matcher.ProfileMatcher;
import org.monarchinitiative.owlsim.kb.BMKnowledgeBase;
@@ -34,6 +36,7 @@
/**
* @param kb
*/
+ @Inject
public NaiveBayesVariableWeightProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
@@ -3,6 +3,8 @@
import java.util.List;
import java.util.Set;
+import javax.inject.Inject;
+
import org.apache.log4j.Logger;
import org.monarchinitiative.owlsim.compute.matcher.ProfileMatcher;
import org.monarchinitiative.owlsim.compute.mica.MostInformativeCommonAncestorCalculator.ClassInformationContentPair;
@@ -32,6 +34,7 @@
/**
* @param kb
*/
+ @Inject
public PhenodigmICProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
@@ -6,6 +6,8 @@
import java.util.Map;
import java.util.Set;
+import javax.inject.Inject;
+
import org.apache.log4j.Logger;
import org.monarchinitiative.owlsim.compute.cpt.IncoherentStateException;
import org.monarchinitiative.owlsim.compute.cpt.impl.NodeProbabilities;
@@ -35,6 +37,7 @@
private ThreeStateConditionalProbabilityIndex cpi = null;
private Map<BitMapPair,NodeProbabilities[]> targetToQueryCache;
+ @Inject
private ThreeStateBayesianNetworkProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
@@ -14,6 +14,11 @@
import javax.inject.Singleton;
import org.apache.commons.validator.routines.UrlValidator;
+import org.monarchinitiative.owlsim.compute.classmatch.ClassMatcher;
+import org.monarchinitiative.owlsim.compute.enrich.impl.HypergeometricEnrichmentEngine;
+import org.monarchinitiative.owlsim.compute.matcher.impl.BayesianNetworkProfileMatcher;
+import org.monarchinitiative.owlsim.compute.mica.MostInformativeCommonAncestorCalculator;
+import org.monarchinitiative.owlsim.compute.mica.impl.MostInformativeCommonAncestorCalculatorImpl;
import org.monarchinitiative.owlsim.kb.BMKnowledgeBase;
import org.monarchinitiative.owlsim.kb.impl.BMKnowledgeBaseOWLAPIImpl;
import org.monarchinitiative.owlsim.services.modules.bindings.IndicatesDataTsvs;
@@ -123,5 +128,25 @@ OWLOntology getDataTsvs(OWLOntologyManager manager)
throws OWLOntologyCreationException, FileNotFoundException, IOException {
return mergeOntologies(manager, dataTsvs);
}
+
+ @Provides
+ MostInformativeCommonAncestorCalculator getMostInformativeCommonAncestorCalculator(BMKnowledgeBase knowledgeBase) {
+ return new MostInformativeCommonAncestorCalculatorImpl(knowledgeBase);
+ }
+
+ @Provides
+ HypergeometricEnrichmentEngine getHypergeometricEnrichmentEngine(BMKnowledgeBase knowledgeBase) {
+ return new HypergeometricEnrichmentEngine(knowledgeBase);
+ }
+
+ @Provides
+ BayesianNetworkProfileMatcher getBayesianNetworkProfileMatcher(BMKnowledgeBase knowledgeBase) {
+ return BayesianNetworkProfileMatcher.create(knowledgeBase);
+ }
+
+ @Provides
+ ClassMatcher getClassMatcher(BMKnowledgeBase knowledgeBase) {
+ return new ClassMatcher(knowledgeBase);
+ }
}

0 comments on commit 56a4aa2

Please sign in to comment.