Search in sources :

Example 1 with PhysicalLocationValueObject

use of ubic.gemma.model.genome.PhysicalLocationValueObject in project Gemma by PavlidisLab.

the class GeneSymbolArg method getGeneLocation.

@Override
public Collection<PhysicalLocationValueObject> getGeneLocation(GeneService geneService) {
    Collection<Gene> genes = geneService.findByOfficialSymbol(this.value);
    Collection<PhysicalLocationValueObject> gVos = new ArrayList<>(genes.size());
    for (Gene gene : genes) {
        gVos.addAll(geneService.getPhysicalLocationsValueObjects(gene));
    }
    return gVos;
}
Also used : Gene(ubic.gemma.model.genome.Gene) PhysicalLocationValueObject(ubic.gemma.model.genome.PhysicalLocationValueObject) ArrayList(java.util.ArrayList)

Example 2 with PhysicalLocationValueObject

use of ubic.gemma.model.genome.PhysicalLocationValueObject in project Gemma by PavlidisLab.

the class GeneServiceImpl method getPhysicalLocationsValueObjects.

@Override
@Transactional(readOnly = true)
public Collection<PhysicalLocationValueObject> getPhysicalLocationsValueObjects(Gene gene) {
    if (gene == null) {
        return Collections.emptyList();
    }
    gene = this.thaw(gene);
    Collection<GeneProduct> gpCollection = gene.getProducts();
    Collection<PhysicalLocationValueObject> locations = new LinkedList<>();
    if (gpCollection == null)
        return null;
    for (GeneProduct gp : gpCollection) {
        PhysicalLocation physicalLocation = gp.getPhysicalLocation();
        if (physicalLocation == null) {
            AbstractService.log.warn(gene.getOfficialSymbol() + " product " + gp.getName() + " (id:" + gp.getId() + ") has no location.");
            continue;
        }
        // Only add if the physical location of the product is different from any we already know.
        PhysicalLocationValueObject vo = new PhysicalLocationValueObject(physicalLocation);
        if (!locations.contains(vo)) {
            locations.add(vo);
        }
    }
    return locations;
}
Also used : PhysicalLocationValueObject(ubic.gemma.model.genome.PhysicalLocationValueObject) PhysicalLocation(ubic.gemma.model.genome.PhysicalLocation) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

PhysicalLocationValueObject (ubic.gemma.model.genome.PhysicalLocationValueObject)2 ArrayList (java.util.ArrayList)1 Transactional (org.springframework.transaction.annotation.Transactional)1 Gene (ubic.gemma.model.genome.Gene)1 PhysicalLocation (ubic.gemma.model.genome.PhysicalLocation)1