本文整理匯總了Java中com.github.phenomics.ontolib.formats.hpo.HpoTermRelation類的典型用法代碼示例。如果您正苦於以下問題:Java HpoTermRelation類的具體用法?Java HpoTermRelation怎麽用?Java HpoTermRelation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
HpoTermRelation類屬於com.github.phenomics.ontolib.formats.hpo包,在下文中一共展示了HpoTermRelation類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parse
import com.github.phenomics.ontolib.formats.hpo.HpoTermRelation; //導入依賴的package包/類
/**
* Parse OBO file into {@link HpoOntology} object.
*
* @return {@link HpoOntology} from parsing OBO file.
* @throws IOException In case of problems with file I/O.
*/
@SuppressWarnings("unchecked")
public HpoOntology parse() throws IOException {
final OboImmutableOntologyLoader<HpoTerm, HpoTermRelation> loader =
new OboImmutableOntologyLoader<>(oboFile, debug);
final HpoOboFactory factory = new HpoOboFactory();
final ImmutableOntology<HpoTerm, HpoTermRelation> o = loader.load(factory);
// Convert ImmutableOntology into HPOntology. The casts here are ugly and require the
// @SuppressWarnings above but this saves us one factory layer of indirection.
return new HpoOntology((ImmutableSortedMap<String, String>) o.getMetaInfo(),
(ImmutableDirectedGraph<TermId, ImmutableEdge<TermId>>) o.getGraph(), o.getRootTermId(),
o.getNonObsoleteTermIds(), o.getObsoleteTermIds(),
(ImmutableMap<TermId, HpoTerm>) o.getTermMap(),
(ImmutableMap<Integer, HpoTermRelation>) o.getRelationMap());
}
示例2: precomputePairwiseResnik
import com.github.phenomics.ontolib.formats.hpo.HpoTermRelation; //導入依賴的package包/類
private void precomputePairwiseResnik() {
LOGGER.info("Performing information content precomputation...");
final InformationContentComputation<HpoTerm, HpoTermRelation> icPrecomputation =
new InformationContentComputation<>(phenotypicAbnormalitySubOntology);
final Map<TermId, Double> termToIc =
icPrecomputation.computeInformationContent(termIdToObjectId);
LOGGER.info("Done with precomputing information content.");
LOGGER.info("Performing pairwise Resnik similarity precomputation...");
resnikSimilarity = new ResnikSimilarity<HpoTerm, HpoTermRelation>(
phenotypicAbnormalitySubOntology, termToIc, /* symmetric= */false);
LOGGER.info("Done with precomputing pairwise Resnik similarity.");
}
示例3: performSampling
import com.github.phenomics.ontolib.formats.hpo.HpoTermRelation; //導入依賴的package包/類
private void performSampling() {
LOGGER.info("Performing sampling...");
final ScoreSamplingOptions samplingOptions = new ScoreSamplingOptions(options.getNumThreads(),
options.getMinObjectId(), options.getMaxObjectId(), options.getMinNumTerms(),
options.getMaxNumTerms(), options.getSeed(), options.getNumIterations());
final SimilarityScoreSampling<HpoTerm, HpoTermRelation> sampling =
new SimilarityScoreSampling<>(phenotypicAbnormalitySubOntology, resnikSimilarity,
samplingOptions);
scoreDistribution = sampling.performSampling(objectIdToTermId);
LOGGER.info("Done with sampling.");
}
示例4: constructTermRelation
import com.github.phenomics.ontolib.formats.hpo.HpoTermRelation; //導入依賴的package包/類
@Override
public HpoTermRelation constructTermRelation(Stanza stanza, StanzaEntryIsA stanzaEntry) {
final TermId sourceId =
termIds.get(this.<StanzaEntryId>getCardinalityOneEntry(stanza, StanzaEntryType.ID).getId());
final TermId destId = termIds.get(stanzaEntry.getId());
return new HpoTermRelation(sourceId, destId, nextRelationId++, HpoRelationQualifier.IS_A);
}
示例5: performSimulation
import com.github.phenomics.ontolib.formats.hpo.HpoTermRelation; //導入依賴的package包/類
/**
* Perform the actual simulation of phenotype annotations.
*/
private void performSimulation() {
// Construct the query simulator to use.
final AnnotationSetModifier<HpoTerm, HpoTermRelation> queryModifier =
new AnnotationSetModifier<>(hpoOntology.getPhenotypicAbnormalitySubOntology(),
new AnnotationSetModifier.Options(options.getSeed(), options.getMinQuerySize(),
options.getMaxQuerySize(), options.getNoiseFraction(),
options.getMapUpProbability()));
// Get DiseaseId and perform simulation.
final DiseaseId diseaseId = getDiseaseId();
final AnnotatedDisease diseaseAnnotation = diseaseAnnotations.get(diseaseId);
List<TermId> simulatedTermIds = queryModifier.simulateAnnotationSet(diseaseAnnotation);
Collections.sort(simulatedTermIds);
// Print simulated list of term ids.
System.err.println("disease ID: " + diseaseId);
System.err.println("disease name: " + diseaseAnnotations.get(diseaseId).getName());
System.err.println("original terms: " + diseaseAnnotation.getAllAssociatedTermIds().stream()
.map(tId -> tId.getIdWithPrefix()).collect(Collectors.toList()));
System.err
.println("original terms names: " + diseaseAnnotation.getAllAssociatedTermIds().stream()
.map(tId -> hpoOntology.getTermMap().get(tId).getName()).collect(Collectors.toList()));
System.err.println("simulated terms: "
+ simulatedTermIds.stream().map(tId -> tId.getIdWithPrefix()).collect(Collectors.toList()));
System.err.println("simulated term names: " + simulatedTermIds.stream()
.map(tId -> hpoOntology.getTermMap().get(tId).getName()).collect(Collectors.toList()));
}