Search in sources :

Example 1 with TaxonValueObject

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

the class TaxonServiceImpl method getTaxaWithArrays.

/**
 * @return List of taxa with array designs in gemma
 */
@Override
@Transactional(readOnly = true)
public Collection<TaxonValueObject> getTaxaWithArrays() {
    Set<TaxonValueObject> taxaWithArrays = new TreeSet<>(TaxonServiceImpl.TAXON_VO_COMPARATOR);
    for (Taxon taxon : arrayDesignService.getPerTaxonCount().keySet()) {
        taxaWithArrays.add(TaxonValueObject.fromEntity(taxon));
    }
    AbstractService.log.debug("GenePicker::getTaxaWithArrays returned " + taxaWithArrays.size() + " results");
    return taxaWithArrays;
}
Also used : TaxonValueObject(ubic.gemma.model.genome.TaxonValueObject) Taxon(ubic.gemma.model.genome.Taxon) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with TaxonValueObject

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

the class TaxonDaoImpl method loadValueObjectsPreFilter.

@Override
public Collection<TaxonValueObject> loadValueObjectsPreFilter(int offset, int limit, String orderBy, boolean asc, ArrayList<ObjectFilter[]> filter) {
    // Compose query
    Query query = this.getLoadValueObjectsQueryString(filter, orderBy, !asc);
    query.setCacheable(true);
    if (limit > 0)
        query.setMaxResults(limit);
    query.setFirstResult(offset);
    // noinspection unchecked
    List<Object[]> list = query.list();
    List<TaxonValueObject> vos = new ArrayList<>(list.size());
    for (Object[] row : list) {
        TaxonValueObject vo = new TaxonValueObject((Taxon) row[1]);
        if (row[2] != null) {
            vo.setExternalDatabase(new ExternalDatabaseValueObject((ExternalDatabase) row[2]));
        }
        if (row[3] != null) {
            vo.setParentTaxon(new TaxonValueObject((Taxon) row[3]));
            if (row[4] != null) {
                vo.getParentTaxon().setParentTaxon(new TaxonValueObject((Taxon) row[4]));
            }
        }
        vos.add(vo);
    }
    return vos;
}
Also used : TaxonValueObject(ubic.gemma.model.genome.TaxonValueObject) ExternalDatabase(ubic.gemma.model.common.description.ExternalDatabase) ExternalDatabaseValueObject(ubic.gemma.model.common.description.ExternalDatabaseValueObject) Taxon(ubic.gemma.model.genome.Taxon) ArrayList(java.util.ArrayList) TaxonValueObject(ubic.gemma.model.genome.TaxonValueObject) ExternalDatabaseValueObject(ubic.gemma.model.common.description.ExternalDatabaseValueObject)

Example 3 with TaxonValueObject

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

the class TaxonServiceImpl method getTaxaWithDatasets.

/**
 * @return collection of taxa that have expression experiments available.
 */
@Override
@Transactional(readOnly = true)
public Collection<TaxonValueObject> getTaxaWithDatasets() {
    Set<TaxonValueObject> taxaWithDatasets = new TreeSet<>(TaxonServiceImpl.TAXON_VO_COMPARATOR);
    Map<Taxon, Long> perTaxonCount = expressionExperimentService.getPerTaxonCount();
    for (Taxon taxon : this.loadAll()) {
        if (perTaxonCount.containsKey(taxon) && perTaxonCount.get(taxon) > 0) {
            taxaWithDatasets.add(TaxonValueObject.fromEntity(taxon));
        }
    }
    return taxaWithDatasets;
}
Also used : TaxonValueObject(ubic.gemma.model.genome.TaxonValueObject) Taxon(ubic.gemma.model.genome.Taxon) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with TaxonValueObject

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

the class LinkUtils method getGenomeBrowserLink.

/**
 * @param blatResult blat result
 * @return URL to the genome browser for the given blat result, or null if the URL cannot be formed correctly.
 */
public static String getGenomeBrowserLink(BlatResultValueObject blatResult) {
    if ((blatResult.getQuerySequence() == null) || (blatResult.getQuerySequence().getTaxon() == null))
        return null;
    TaxonValueObject taxon = blatResult.getQuerySequence().getTaxon();
    String organism = taxon.getCommonName();
    String database = "";
    if (organism.equalsIgnoreCase("Human")) {
        database = Settings.getString("gemma.goldenpath.db.human");
    } else if (organism.equalsIgnoreCase("Rat")) {
        database = Settings.getString("gemma.goldenpath.db.rat");
    } else if (organism.equalsIgnoreCase("Mouse")) {
        database = Settings.getString("gemma.goldenpath.db.mouse");
    } else {
        return null;
    }
    String link = "http://genome.ucsc.edu/cgi-bin/hgTracks?org=" + organism + "&pix=850" + "&db=" + database + "&hgt.customText=" + Settings.getBaseUrl() + "blatTrack.html?id=";
    link += blatResult.getId();
    return link;
}
Also used : TaxonValueObject(ubic.gemma.model.genome.TaxonValueObject)

Example 5 with TaxonValueObject

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

the class GeneSetController method addSessionGroup.

/**
 * * AJAX adds the gene group to the session, used by SessionGeneGroupStore and SessionDatasetGroupStore sets the
 * groups taxon value and reference.
 *
 * @param gsvo              gsvo
 * @param modificationBased whether the set was modified by the user
 * @return gene set vo
 */
public SessionBoundGeneSetValueObject addSessionGroup(SessionBoundGeneSetValueObject gsvo, Boolean modificationBased) {
    TaxonValueObject tax = geneSetService.getTaxonVOforGeneSetVO(gsvo);
    gsvo.setTaxonId(tax.getId());
    gsvo.setTaxonName(tax.getCommonName());
    return sessionListManager.addGeneSet(gsvo, modificationBased);
}
Also used : TaxonValueObject(ubic.gemma.model.genome.TaxonValueObject)

Aggregations

TaxonValueObject (ubic.gemma.model.genome.TaxonValueObject)5 Taxon (ubic.gemma.model.genome.Taxon)3 Transactional (org.springframework.transaction.annotation.Transactional)2 ArrayList (java.util.ArrayList)1 ExternalDatabase (ubic.gemma.model.common.description.ExternalDatabase)1 ExternalDatabaseValueObject (ubic.gemma.model.common.description.ExternalDatabaseValueObject)1