
org.monarchinitiative.phenol.analysis.util.Util Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of phenol-analysis Show documentation
Show all versions of phenol-analysis Show documentation
phenol-analysis implements some algorithms for working with ontology data
The newest version!
package org.monarchinitiative.phenol.analysis.util;
import org.monarchinitiative.phenol.analysis.ItemAnnotations;
import org.monarchinitiative.phenol.ontology.data.MinimalOntology;
import org.monarchinitiative.phenol.ontology.data.TermId;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
public class Util {
public static Set getDomainItemsAnnotatedByOntologyTerm(TermId termId,
MinimalOntology ontology,
Map> gene2associationMap) {
Set domainItemSet = new HashSet<>();
// the following includes termId in the descendent set
Set descendentSet = ontology.graph().getDescendantsStream(termId, true).collect(Collectors.toSet());
for (Map.Entry> entry : gene2associationMap.entrySet()) {
TermId gene = entry.getKey();
for (TermId ontologyTermId : entry.getValue().getAnnotatingTermIds()) {
if (descendentSet.contains(ontologyTermId) || ontologyTermId.equals(termId)) {
domainItemSet.add(gene);
}
}
}
return domainItemSet;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy