Search in sources :

Example 1 with DiseaseOntologyApiWrapper

use of com.hartwig.hmftools.apiclients.diseaseontology.api.DiseaseOntologyApiWrapper in project hmftools by hartwigmedical.

the class CivicAnalyzer method getRelevantDoids.

@NotNull
private static Set<String> getRelevantDoids(@NotNull final Set<String> tumorDoids) {
    LOGGER.info("  Fetching relevant tumor types...");
    final Set<String> relevantDoids = Sets.newHashSet();
    relevantDoids.addAll(tumorDoids);
    final DiseaseOntologyApiWrapper diseaseOntologyApi = new DiseaseOntologyApiWrapper();
    for (final String tumorDoid : tumorDoids) {
        try {
            final List<String> childrenAndParentDoids = diseaseOntologyApi.getAllChildrenDoids(tumorDoid).mergeWith(diseaseOntologyApi.getAllParentDoids(tumorDoid)).toList().blockingGet();
            relevantDoids.addAll(childrenAndParentDoids);
        } catch (final Throwable throwable) {
            LOGGER.error("  Failed to get children doids for tumor doid: " + tumorDoid + ". error message: " + throwable.getMessage());
        }
    }
    diseaseOntologyApi.releaseResources();
    return relevantDoids;
}
Also used : DiseaseOntologyApiWrapper(com.hartwig.hmftools.apiclients.diseaseontology.api.DiseaseOntologyApiWrapper) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DiseaseOntologyApiWrapper (com.hartwig.hmftools.apiclients.diseaseontology.api.DiseaseOntologyApiWrapper)1 NotNull (org.jetbrains.annotations.NotNull)1