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;
}
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;
}
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;
}
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;
}
Aggregations