Search in sources :

Example 1 with ArrayDesign

use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.

the class ArrayDesignControllerImpl method showExpressionExperiments.

@Override
@RequestMapping("/showExpressionExperiments.html")
public ModelAndView showExpressionExperiments(HttpServletRequest request) {
    Long id = Long.parseLong(request.getParameter("id"));
    ArrayDesign arrayDesign = arrayDesignService.load(id);
    if (arrayDesign == null) {
        return new ModelAndView(new RedirectView("/arrays/showAllArrayDesigns.html", true)).addObject("message", "Platform with id=" + id + " not found");
    }
    // seems inefficient? but need security filtering.
    Collection<ExpressionExperiment> ees = arrayDesignService.getExpressionExperiments(arrayDesign);
    String ids = StringUtils.join(EntityUtils.getIds(ees).toArray(), ",");
    return new ModelAndView(new RedirectView("/expressionExperiment/showAllExpressionExperiments.html?id=" + ids, true));
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ModelAndView(org.springframework.web.servlet.ModelAndView) RedirectView(org.springframework.web.servlet.view.RedirectView) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with ArrayDesign

use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.

the class ArrayDesignControllerImpl method filter.

@Override
@RequestMapping("/filterArrayDesigns.html")
public ModelAndView filter(HttpServletRequest request, HttpServletResponse response) {
    StopWatch overallWatch = new StopWatch();
    overallWatch.start();
    String filter = request.getParameter("filter");
    // Validate the filtering search criteria.
    if (StringUtils.isBlank(filter)) {
        return new ModelAndView(new RedirectView("/arrays/showAllArrayDesigns.html", true)).addObject("message", "No search criteria provided");
    }
    Collection<SearchResult> searchResults = searchService.search(SearchSettingsImpl.arrayDesignSearch(filter)).get(ArrayDesign.class);
    if ((searchResults == null) || (searchResults.size() == 0)) {
        return new ModelAndView(new RedirectView("/arrays/showAllArrayDesigns.html", true)).addObject("message", "No search criteria provided");
    }
    StringBuilder list = new StringBuilder();
    if (searchResults.size() == 1) {
        ArrayDesign arrayDesign = arrayDesignService.load(searchResults.iterator().next().getId());
        return new ModelAndView(new RedirectView("/arrays/showArrayDesign.html?id=" + arrayDesign.getId(), true)).addObject("message", "Matched one : " + arrayDesign.getName() + "(" + arrayDesign.getShortName() + ")");
    }
    for (SearchResult ad : searchResults) {
        list.append(ad.getId()).append(",");
    }
    overallWatch.stop();
    Long overallElapsed = overallWatch.getTime();
    log.info("Generating the AD list:  (" + list + ") took: " + overallElapsed / 1000 + "s ");
    return new ModelAndView(new RedirectView("/arrays/showAllArrayDesigns.html?id=" + list, true)).addObject("message", searchResults.size() + " Platforms matched your search.");
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ModelAndView(org.springframework.web.servlet.ModelAndView) RedirectView(org.springframework.web.servlet.view.RedirectView) SearchResult(ubic.gemma.core.search.SearchResult) StopWatch(org.apache.commons.lang3.time.StopWatch) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with ArrayDesign

use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.

the class ArrayDesignControllerImpl method showArrayDesign.

@Override
@RequestMapping({ "/showArrayDesign.html", "/" })
public ModelAndView showArrayDesign(HttpServletRequest request, HttpServletResponse response) {
    String name = request.getParameter("name");
    String idStr = request.getParameter("id");
    if ((name == null) && (idStr == null)) {
        throw new IllegalArgumentException("Must provide a platform identifier or name");
    }
    ArrayDesign arrayDesign;
    if (idStr != null) {
        arrayDesign = arrayDesignService.load(Long.parseLong(idStr));
        request.setAttribute("id", idStr);
    } else {
        arrayDesign = arrayDesignService.findByShortName(name);
        request.setAttribute("name", name);
        if (arrayDesign == null) {
            Collection<ArrayDesign> byName = arrayDesignService.findByName(name);
            if (byName.isEmpty()) {
                throw new IllegalArgumentException("Must provide a valid platform identifier or name");
            }
            arrayDesign = byName.iterator().next();
        }
    }
    if (arrayDesign == null) {
        throw new IllegalArgumentException("Must provide a valid platform identifier or name");
    }
    long id = arrayDesign.getId();
    ModelAndView mav = new ModelAndView("arrayDesign.detail");
    mav.addObject("arrayDesignId", id);
    mav.addObject("arrayDesignShortName", arrayDesign.getShortName());
    mav.addObject("arrayDesignName", arrayDesign.getName());
    return mav;
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with ArrayDesign

use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.

the class ArrayDesignControllerImpl method delete.

@Override
@RequestMapping("/deleteArrayDesign.html")
public ModelAndView delete(HttpServletRequest request, HttpServletResponse response) {
    String stringId = request.getParameter("id");
    if (stringId == null) {
        // should be a validation error.
        throw new EntityNotFoundException("Must provide an id");
    }
    Long id;
    try {
        id = Long.parseLong(stringId);
    } catch (NumberFormatException e) {
        throw new EntityNotFoundException("Identifier was invalid");
    }
    ArrayDesign arrayDesign = arrayDesignService.load(id);
    if (arrayDesign == null) {
        throw new EntityNotFoundException("Platform with id=" + id + " not found");
    }
    // check that no EE depend on the arraydesign we want to remove
    // Do this by checking if there are any bioassays that depend this AD
    Collection<BioAssay> assays = arrayDesignService.getAllAssociatedBioAssays(id);
    if (assays.size() != 0) {
        return new ModelAndView(new RedirectView("/arrays/showAllArrayDesigns.html", true)).addObject("message", "Array  " + arrayDesign.getName() + " can't be deleted. Dataset has a dependency on this Array.");
    }
    String taskId = taskRunningService.submitLocalTask(new TaskCommand(arrayDesign.getId()));
    return new ModelAndView().addObject("taskId", taskId);
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ModelAndView(org.springframework.web.servlet.ModelAndView) RedirectView(org.springframework.web.servlet.view.RedirectView) EntityNotFoundException(ubic.gemma.web.util.EntityNotFoundException) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) TaskCommand(ubic.gemma.core.job.TaskCommand) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with ArrayDesign

use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.

the class PlatformArg method getElements.

/**
 * Retrieves the Elements of the Platform that this argument represents.
 *
 * @param service service that will be used to retrieve the persistent AD object.
 * @return a collection of Composite Sequence VOs that the platform represented by this argument contains.
 */
public Collection<CompositeSequenceValueObject> getElements(ArrayDesignService service, CompositeSequenceService csService, int limit, int offset) {
    ArrayDesign ad = this.getPersistentObject(service);
    Collection<CompositeSequence> css = ad == null ? null : service.getCompositeSequences(ad, limit, offset);
    Collection<CompositeSequenceValueObject> csVos = new ArrayList<>(css != null ? css.size() : 0);
    if (css == null)
        return csVos;
    for (CompositeSequence cs : css) {
        CompositeSequenceValueObject csVo = csService.loadValueObject(cs);
        csVo.setGeneMappingSummaries(csService.getGeneMappingSummary(cs));
        csVos.add(csVo);
    }
    return csVos;
}
Also used : CompositeSequenceValueObject(ubic.gemma.model.expression.designElement.CompositeSequenceValueObject) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ArrayList(java.util.ArrayList) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence)

Aggregations

ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)186 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)43 Test (org.junit.Test)32 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)26 InputStream (java.io.InputStream)25 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)24 BioSequence (ubic.gemma.model.genome.biosequence.BioSequence)24 Taxon (ubic.gemma.model.genome.Taxon)23 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)19 HashSet (java.util.HashSet)16 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)16 Collection (java.util.Collection)14 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)13 StopWatch (org.apache.commons.lang3.time.StopWatch)12 Before (org.junit.Before)12 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)12 BioAssayDimension (ubic.gemma.model.expression.bioAssayData.BioAssayDimension)9 GZIPInputStream (java.util.zip.GZIPInputStream)8 SimpleExpressionExperimentMetaData (ubic.gemma.core.loader.expression.simple.model.SimpleExpressionExperimentMetaData)8 File (java.io.File)7