Search in sources :

Example 1 with StudyDocument

use of uk.ac.ebi.spot.goci.model.StudyDocument in project goci by EBISPOT.

the class TraitEnrichmentService method doEnrichment.

@Override
public void doEnrichment(DiseaseTraitDocument document) {
    long id = Long.valueOf(document.getId().split(":")[1]);
    studyService.findByDiseaseTraitId(id).forEach(study -> {
        document.embed(new StudyDocument(study));
        Set<EfoTrait> efoTraits = new HashSet<>();
        traitService.findMappedTraitByStudyId(study.getId()).forEach(efoTraits::add);
        efoTraits.forEach(trait -> {
            document.embed(new EfoDocument(trait));
            associationService.findPublishedAssociationsByEfoTraitId(trait.getId()).forEach(association -> document.embed(new AssociationDocument(association)));
        });
    });
}
Also used : EfoDocument(uk.ac.ebi.spot.goci.model.EfoDocument) StudyDocument(uk.ac.ebi.spot.goci.model.StudyDocument) EfoTrait(uk.ac.ebi.spot.goci.model.EfoTrait) HashSet(java.util.HashSet) AssociationDocument(uk.ac.ebi.spot.goci.model.AssociationDocument)

Example 2 with StudyDocument

use of uk.ac.ebi.spot.goci.model.StudyDocument in project goci by EBISPOT.

the class AssociationEnrichmentService method doEnrichment.

@Override
public void doEnrichment(AssociationDocument document) {
    long id = Long.valueOf(document.getId().split(":")[1]);
    studyService.findByAssociationId(id).forEach(study -> {
        document.addStudyId(String.valueOf(study.getId()));
        document.embed(new StudyDocument(study));
    });
    traitService.findReportedTraitByAssociationId(id).forEach(trait -> document.embed(new DiseaseTraitDocument(trait)));
    traitService.findMappedTraitByAssociationId(id).forEach(trait -> document.embed(new EfoDocument(trait)));
}
Also used : DiseaseTraitDocument(uk.ac.ebi.spot.goci.model.DiseaseTraitDocument) EfoDocument(uk.ac.ebi.spot.goci.model.EfoDocument) StudyDocument(uk.ac.ebi.spot.goci.model.StudyDocument)

Aggregations

EfoDocument (uk.ac.ebi.spot.goci.model.EfoDocument)2 StudyDocument (uk.ac.ebi.spot.goci.model.StudyDocument)2 HashSet (java.util.HashSet)1 AssociationDocument (uk.ac.ebi.spot.goci.model.AssociationDocument)1 DiseaseTraitDocument (uk.ac.ebi.spot.goci.model.DiseaseTraitDocument)1 EfoTrait (uk.ac.ebi.spot.goci.model.EfoTrait)1