Search in sources :

Example 11 with SearchResultDisplayObject

use of ubic.gemma.core.search.SearchResultDisplayObject in project Gemma by PavlidisLab.

the class ExpressionExperimentSearchServiceImpl method searchExperimentsAndExperimentGroupBlankQuery.

/**
 * if query is blank, return list of public sets, user-owned sets (if logged in) and user's recent session-bound
 * sets called by ubic.gemma.web.controller .expression.experiment.ExpressionExperimentController.
 * searchExperimentsAndExperimentGroup(String, Long) does not include session bound sets
 */
private List<SearchResultDisplayObject> searchExperimentsAndExperimentGroupBlankQuery(Long taxonId) {
    boolean taxonLimited = taxonId != null;
    List<SearchResultDisplayObject> displayResults = new LinkedList<>();
    // These are widely considered to be the most important results and
    // therefore need to be at the top
    List<SearchResultDisplayObject> masterResults = new LinkedList<>();
    Collection<ExpressionExperimentSetValueObject> evos = expressionExperimentSetService.loadAllExperimentSetValueObjects(true);
    for (ExpressionExperimentSetValueObject evo : evos) {
        if (taxonLimited && !evo.getTaxonId().equals(taxonId)) {
            continue;
        }
        SearchResultDisplayObject srdvo = new SearchResultDisplayObject(evo);
        if (evo.getName().startsWith(ExpressionExperimentSearchServiceImpl.MASTER_SET_PREFIX)) {
            masterResults.add(srdvo);
        } else {
            displayResults.add(srdvo);
        }
    }
    Collections.sort(displayResults);
    // should we also sort by which species is most important(humans obviously) or is that not politically
    // correct???
    displayResults.addAll(0, masterResults);
    return displayResults;
}
Also used : ExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject) SearchResultDisplayObject(ubic.gemma.core.search.SearchResultDisplayObject)

Example 12 with SearchResultDisplayObject

use of ubic.gemma.core.search.SearchResultDisplayObject in project Gemma by PavlidisLab.

the class ExpressionExperimentSearchServiceImpl method getExpressionExperimentResults.

private List<SearchResultDisplayObject> getExpressionExperimentResults(Map<Class<?>, List<SearchResult>> results) {
    // get all expressionExperiment results and convert result object into a value object
    List<SearchResult> srEEs = results.get(ExpressionExperiment.class);
    if (srEEs == null) {
        srEEs = new ArrayList<>();
    }
    List<Long> eeIds = new ArrayList<>();
    for (SearchResult sr : srEEs) {
        eeIds.add(sr.getId());
    }
    Collection<ExpressionExperimentValueObject> eevos = expressionExperimentService.loadValueObjects(eeIds, true);
    List<SearchResultDisplayObject> experiments = new ArrayList<>();
    for (ExpressionExperimentValueObject eevo : eevos) {
        experiments.add(new SearchResultDisplayObject(eevo));
    }
    return experiments;
}
Also used : ExpressionExperimentValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentValueObject) SearchResult(ubic.gemma.core.search.SearchResult) SearchResultDisplayObject(ubic.gemma.core.search.SearchResultDisplayObject)

Example 13 with SearchResultDisplayObject

use of ubic.gemma.core.search.SearchResultDisplayObject in project Gemma by PavlidisLab.

the class ExpressionExperimentController method searchExperimentsAndExperimentGroups.

/**
 * AJAX (used by experimentAndExperimentGroupCombo.js)
 *
 * @param taxonId if the search should not be limited by taxon, pass in null
 * @param query   query
 * @return Collection of SearchResultDisplayObjects
 */
public List<SearchResultDisplayObject> searchExperimentsAndExperimentGroups(String query, Long taxonId) {
    boolean taxonLimited = (taxonId != null);
    List<SearchResultDisplayObject> displayResults = new ArrayList<>();
    // add session bound sets
    // get any session-bound groups
    Collection<SessionBoundExpressionExperimentSetValueObject> sessionResult = (taxonLimited) ? sessionListManager.getModifiedExperimentSets(taxonId) : sessionListManager.getModifiedExperimentSets();
    List<SearchResultDisplayObject> sessionSets = new ArrayList<>();
    // create SearchResultDisplayObjects
    if (sessionResult != null && sessionResult.size() > 0) {
        for (SessionBoundExpressionExperimentSetValueObject eevo : sessionResult) {
            SearchResultDisplayObject srdo = new SearchResultDisplayObject(eevo);
            srdo.setUserOwned(true);
            sessionSets.add(srdo);
        }
    }
    // keep sets in proper order (session-bound groups first)
    Collections.sort(sessionSets);
    displayResults.addAll(sessionSets);
    displayResults.addAll(expressionExperimentSearchService.searchExperimentsAndExperimentGroups(query, taxonId));
    for (SearchResultDisplayObject r : displayResults) {
        r.setOriginalQuery(query);
    }
    return displayResults;
}
Also used : SearchResultDisplayObject(ubic.gemma.core.search.SearchResultDisplayObject)

Aggregations

SearchResultDisplayObject (ubic.gemma.core.search.SearchResultDisplayObject)13 Taxon (ubic.gemma.model.genome.Taxon)5 ExpressionExperimentSetValueObject (ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject)3 StopWatch (org.apache.commons.lang3.time.StopWatch)2 SearchResult (ubic.gemma.core.search.SearchResult)2 ExpressionExperimentSet (ubic.gemma.model.analysis.expression.ExpressionExperimentSet)2 ExpressionExperimentValueObject (ubic.gemma.model.expression.experiment.ExpressionExperimentValueObject)2 AccessDeniedException (org.springframework.security.access.AccessDeniedException)1 SessionBoundGeneSetValueObject (ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject)1 SearchSettings (ubic.gemma.model.common.search.SearchSettings)1 FreeTextExpressionExperimentResultsValueObject (ubic.gemma.model.expression.experiment.FreeTextExpressionExperimentResultsValueObject)1 Gene (ubic.gemma.model.genome.Gene)1