Skip to content

Commit

Permalink
[#62] we still need the the inject indicator for guice. We can the ma…
Browse files Browse the repository at this point in the history
…tcher package through java reflection and let the injector construct the objects.
  • Loading branch information
jnguyenx committed Mar 9, 2017
1 parent 5bba20a commit 56a4aa2
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,4 @@ public ProfileQuery createProfileQueryFromClasses(Set<String> classIds,
*/
BMKnowledgeBase getKnowledgeBase();



}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -101,6 +103,7 @@ public class BayesianNetworkProfileMatcher extends AbstractProfileMatcher implem
private Calculator[] calculatorCache;
private Double[][] targetClassProbabilityCache;

@Inject
private BayesianNetworkProfileMatcher(BMKnowledgeBase kb) {
super(kb);
int N = kb.getIndividualIdsInSignature().size();
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -22,6 +24,7 @@ public class GridNegatedProfileMatcher extends AbstractSemanticSimilarityProfile
/**
* @param kb
*/
@Inject
public GridNegatedProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -32,6 +34,7 @@ public class GridProfileMatcher extends AbstractSemanticSimilarityProfileMatcher
/**
* @param kb
*/
@Inject
public GridProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,6 +28,7 @@ public class JaccardSimilarityProfileMatcher extends AbstractProfileMatcher impl
/**
* @param kb
*/
@Inject
public JaccardSimilarityProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,6 +30,7 @@ public class MaximumInformationContentSimilarityProfileMatcher extends AbstractS
/**
* @param kb
*/
@Inject
private MaximumInformationContentSimilarityProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,6 +31,7 @@ public class NaiveBayesFixedWeightThreeStateProfileMatcher extends AbstractProfi
private Logger LOG = Logger.getLogger(NaiveBayesFixedWeightThreeStateProfileMatcher.class);


@Inject
private NaiveBayesFixedWeightThreeStateProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.monarchinitiative.owlsim.compute.matcher.impl;

import javax.inject.Inject;

import org.monarchinitiative.owlsim.kb.BMKnowledgeBase;

/**
Expand All @@ -8,6 +10,7 @@
*/
public class NaiveBayesFixedWeightTwoStateNoBlanketProfileMatcher extends NaiveBayesFixedWeightTwoStateProfileMatcher {

@Inject
private NaiveBayesFixedWeightTwoStateNoBlanketProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -34,6 +36,7 @@ public class NaiveBayesVariableWeightProfileMatcher extends AbstractProfileMatch
/**
* @param kb
*/
@Inject
public NaiveBayesVariableWeightProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -32,6 +34,7 @@ public class PhenodigmICProfileMatcher extends AbstractSemanticSimilarityProfile
/**
* @param kb
*/
@Inject
public PhenodigmICProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -35,6 +37,7 @@ public class ThreeStateBayesianNetworkProfileMatcher extends AbstractProfileMatc
private ThreeStateConditionalProbabilityIndex cpi = null;
private Map<BitMapPair,NodeProbabilities[]> targetToQueryCache;

@Inject
private ThreeStateBayesianNetworkProfileMatcher(BMKnowledgeBase kb) {
super(kb);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.