Search in sources :

Example 1 with SessionBoundGeneSetValueObject

use of ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject in project Gemma by PavlidisLab.

the class GeneSetController method removeUserAndSessionGroups.

/**
 * AJAX Given valid gene groups will remove them from the session or the database appropriately.
 *
 * @param vos vos
 * @return gene set vos
 */
public Collection<GeneSetValueObject> removeUserAndSessionGroups(Collection<GeneSetValueObject> vos) {
    Collection<GeneSetValueObject> removedSets = new HashSet<>();
    Collection<DatabaseBackedGeneSetValueObject> databaseCollection = new HashSet<>();
    Collection<SessionBoundGeneSetValueObject> sessionCollection = new HashSet<>();
    for (GeneSetValueObject geneSetValueObject : vos) {
        if (geneSetValueObject instanceof SessionBoundGeneSetValueObject) {
            sessionCollection.add((SessionBoundGeneSetValueObject) geneSetValueObject);
        } else if (geneSetValueObject instanceof DatabaseBackedGeneSetValueObject) {
            databaseCollection.add((DatabaseBackedGeneSetValueObject) geneSetValueObject);
        }
    }
    sessionCollection = this.removeSessionGroups(sessionCollection);
    databaseCollection = this.remove(databaseCollection);
    removedSets.addAll(sessionCollection);
    removedSets.addAll(databaseCollection);
    return removedSets;
}
Also used : DatabaseBackedGeneSetValueObject(ubic.gemma.model.genome.gene.DatabaseBackedGeneSetValueObject) GeneSetValueObject(ubic.gemma.model.genome.gene.GeneSetValueObject) DatabaseBackedGeneSetValueObject(ubic.gemma.model.genome.gene.DatabaseBackedGeneSetValueObject) SessionBoundGeneSetValueObject(ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject) HashSet(java.util.HashSet) SessionBoundGeneSetValueObject(ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject)

Example 2 with SessionBoundGeneSetValueObject

use of ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject in project Gemma by PavlidisLab.

the class GeneSetController method updateUserAndSessionGroups.

/**
 * AJAX Updates the session group and user database groups.
 *
 * @param vos vos
 * @return gene set vos
 */
public Collection<GeneSetValueObject> updateUserAndSessionGroups(Collection<GeneSetValueObject> vos) {
    Collection<GeneSetValueObject> updatedSets = new HashSet<>();
    Collection<DatabaseBackedGeneSetValueObject> databaseCollection = new HashSet<>();
    Collection<SessionBoundGeneSetValueObject> sessionCollection = new HashSet<>();
    for (GeneSetValueObject geneSetValueObject : vos) {
        if (geneSetValueObject instanceof SessionBoundGeneSetValueObject) {
            sessionCollection.add((SessionBoundGeneSetValueObject) geneSetValueObject);
        } else if (geneSetValueObject instanceof DatabaseBackedGeneSetValueObject) {
            databaseCollection.add((DatabaseBackedGeneSetValueObject) geneSetValueObject);
        }
    }
    sessionCollection = this.updateSessionGroups(sessionCollection);
    databaseCollection = this.update(databaseCollection);
    updatedSets.addAll(sessionCollection);
    updatedSets.addAll(databaseCollection);
    return updatedSets;
}
Also used : DatabaseBackedGeneSetValueObject(ubic.gemma.model.genome.gene.DatabaseBackedGeneSetValueObject) GeneSetValueObject(ubic.gemma.model.genome.gene.GeneSetValueObject) DatabaseBackedGeneSetValueObject(ubic.gemma.model.genome.gene.DatabaseBackedGeneSetValueObject) SessionBoundGeneSetValueObject(ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject) HashSet(java.util.HashSet) SessionBoundGeneSetValueObject(ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject)

Example 3 with SessionBoundGeneSetValueObject

use of ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject in project Gemma by PavlidisLab.

the class GeneSetController method addUserAndSessionGroups.

/**
 * AJAX adds the gene group to the session
 *
 * @param geneSetVos value object constructed on the client.
 * @return id of the new gene group
 */
public Collection<GeneSetValueObject> addUserAndSessionGroups(Collection<GeneSetValueObject> geneSetVos) {
    Collection<GeneSetValueObject> result = new HashSet<>();
    Collection<SessionBoundGeneSetValueObject> sessionResult = new HashSet<>();
    for (GeneSetValueObject gsvo : geneSetVos) {
        if (gsvo instanceof SessionBoundGeneSetValueObject) {
            sessionResult.add((SessionBoundGeneSetValueObject) gsvo);
        } else {
            result.add(gsvo);
        }
    }
    result = this.create(result);
    result.addAll(this.addSessionGroups(sessionResult, true));
    return result;
}
Also used : GeneSetValueObject(ubic.gemma.model.genome.gene.GeneSetValueObject) DatabaseBackedGeneSetValueObject(ubic.gemma.model.genome.gene.DatabaseBackedGeneSetValueObject) SessionBoundGeneSetValueObject(ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject) HashSet(java.util.HashSet) SessionBoundGeneSetValueObject(ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject)

Example 4 with SessionBoundGeneSetValueObject

use of ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject in project Gemma by PavlidisLab.

the class GenePickerController method searchGenesAndGeneGroups.

/**
 * AJAX (used by GeneAndGeneGroupCombo.js)
 *
 * @param query   query
 * @param taxonId can be null
 * @return Collection of SearchResultDisplayObject
 */
public Collection<SearchResultDisplayObject> searchGenesAndGeneGroups(String query, Long taxonId) {
    // get any session-bound groups
    Collection<SessionBoundGeneSetValueObject> sessionResult = (taxonId != null) ? sessionListManager.getModifiedGeneSets(taxonId) : sessionListManager.getModifiedGeneSets();
    List<SearchResultDisplayObject> sessionSets = new ArrayList<>();
    // create SearchResultDisplayObjects
    if (sessionResult != null && sessionResult.size() > 0) {
        for (SessionBoundGeneSetValueObject gvo : sessionResult) {
            SearchResultDisplayObject srDo = new SearchResultDisplayObject(gvo);
            srDo.setUserOwned(true);
            sessionSets.add(srDo);
        }
    }
    Collections.sort(sessionSets);
    // maintain order: session sets first
    Collection<SearchResultDisplayObject> results = new ArrayList<>();
    results.addAll(sessionSets);
    results.addAll(geneSearchService.searchGenesAndGeneGroups(query, taxonId));
    for (SearchResultDisplayObject r : results) {
        r.setOriginalQuery(query);
    }
    return results;
}
Also used : SearchResultDisplayObject(ubic.gemma.core.search.SearchResultDisplayObject) SessionBoundGeneSetValueObject(ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject)

Aggregations

SessionBoundGeneSetValueObject (ubic.gemma.core.genome.gene.SessionBoundGeneSetValueObject)4 HashSet (java.util.HashSet)3 DatabaseBackedGeneSetValueObject (ubic.gemma.model.genome.gene.DatabaseBackedGeneSetValueObject)3 GeneSetValueObject (ubic.gemma.model.genome.gene.GeneSetValueObject)3 SearchResultDisplayObject (ubic.gemma.core.search.SearchResultDisplayObject)1