Search in sources :

Example 1 with BibliographicPhenotypesValueObject

use of ubic.gemma.model.genome.gene.phenotype.valueObject.BibliographicPhenotypesValueObject in project Gemma by PavlidisLab.

the class BibliographicReferenceControllerImpl method browse.

@Override
public JsonReaderResponse<BibliographicReferenceValueObject> browse(ListBatchCommand batch) {
    Integer count = this.bibliographicReferenceService.countAll();
    List<BibliographicReference> records = this.getBatch(batch);
    Map<BibliographicReference, Collection<ExpressionExperiment>> relatedExperiments = this.bibliographicReferenceService.getRelatedExperiments(records);
    List<BibliographicReferenceValueObject> valueObjects = new ArrayList<>();
    for (BibliographicReference ref : records) {
        ref = this.bibliographicReferenceService.thaw(ref);
        BibliographicReferenceValueObject vo = new BibliographicReferenceValueObject(ref);
        if (relatedExperiments.containsKey(ref)) {
            vo.setExperiments(expressionExperimentService.loadValueObjects(relatedExperiments.get(ref)));
        }
        valueObjects.add(vo);
        // adding phenotype information to the Bibliographic Reference
        Collection<PhenotypeAssociation> phenotypeAssociations = this.phenotypeAssociationService.findPhenotypesForBibliographicReference(vo.getPubAccession());
        Collection<BibliographicPhenotypesValueObject> bibliographicPhenotypesValueObjects = BibliographicPhenotypesValueObject.phenotypeAssociations2BibliographicPhenotypesValueObjects(phenotypeAssociations);
        vo.setBibliographicPhenotypes(bibliographicPhenotypesValueObjects);
    }
    return new JsonReaderResponse<>(valueObjects, count);
}
Also used : PhenotypeAssociation(ubic.gemma.model.association.phenotype.PhenotypeAssociation) BibliographicReferenceValueObject(ubic.gemma.model.common.description.BibliographicReferenceValueObject) JsonReaderResponse(ubic.gemma.web.remote.JsonReaderResponse) BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) BibliographicPhenotypesValueObject(ubic.gemma.model.genome.gene.phenotype.valueObject.BibliographicPhenotypesValueObject)

Aggregations

PhenotypeAssociation (ubic.gemma.model.association.phenotype.PhenotypeAssociation)1 BibliographicReference (ubic.gemma.model.common.description.BibliographicReference)1 BibliographicReferenceValueObject (ubic.gemma.model.common.description.BibliographicReferenceValueObject)1 BibliographicPhenotypesValueObject (ubic.gemma.model.genome.gene.phenotype.valueObject.BibliographicPhenotypesValueObject)1 JsonReaderResponse (ubic.gemma.web.remote.JsonReaderResponse)1