Search in sources :

Example 1 with DifferentialExpressionSearchTaskCommand

use of ubic.gemma.core.tasks.visualization.DifferentialExpressionSearchTaskCommand in project Gemma by PavlidisLab.

the class DifferentialExpressionSearchController method scheduleDiffExpSearchTask.

/**
 * AJAX - method used for main display metaheatmap.
 */
// used in js DiffExSearchAndVisualize
@SuppressWarnings("unused")
public String scheduleDiffExpSearchTask(Long taxonId, ExpressionExperimentSetValueObject eevo, GeneSetValueObject gsvo) {
    log.info("Starting gene x condition search...");
    // Load experiments
    Collection<ExpressionExperimentValueObject> experiments;
    List<String> datasetGroupNames = new ArrayList<>();
    if (eevo.getExpressionExperimentIds().isEmpty()) {
        if (eevo.getId() != null) {
            experiments = expressionExperimentSetService.getExperimentValueObjectsInSet(eevo.getId());
        } else if (eevo.getName() != null) {
            Collection<ExpressionExperimentSet> eesets = expressionExperimentSetService.findByName(eevo.getName());
            if (eesets.isEmpty() || eesets.size() > 1) {
                throw new IllegalArgumentException("Experiment set not found by name=" + eevo.getName());
            }
            experiments = expressionExperimentSetService.getExperimentValueObjectsInSet(eesets.iterator().next().getId());
        } else {
            throw new IllegalArgumentException("Experiment group should either have an id or a list of ee ids, or a unique name");
        }
    } else {
        experiments = loadExperimentsByIds(eevo.getExpressionExperimentIds());
    }
    datasetGroupNames.add(eevo.getName());
    // Load genes
    Collection<GeneValueObject> genes;
    if (gsvo.getGeneIds().isEmpty()) {
        genes = geneSetService.getGenesInGroup(gsvo);
    } else {
        genes = geneService.loadValueObjectsByIds(gsvo.getGeneIds());
    }
    log.info("Got genes");
    // FIXME why not just pass in the eeset and geneset (security filtering could happen there)
    final DifferentialExpressionSearchTaskCommand taskCommand = new DifferentialExpressionSearchTaskCommand(genes, experiments, gsvo.getName(), eevo.getName());
    String taskId = taskRunningService.submitLocalTask(taskCommand);
    log.info("Scheduled search with task=" + taskId);
    return taskId;
}
Also used : GeneValueObject(ubic.gemma.model.genome.gene.GeneValueObject) DifferentialExpressionSearchTaskCommand(ubic.gemma.core.tasks.visualization.DifferentialExpressionSearchTaskCommand)

Aggregations

DifferentialExpressionSearchTaskCommand (ubic.gemma.core.tasks.visualization.DifferentialExpressionSearchTaskCommand)1 GeneValueObject (ubic.gemma.model.genome.gene.GeneValueObject)1