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));
}
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.");
}
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;
}
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);
}
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;
}
Aggregations