use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.
the class ExperimentAnnotationEndpoint method invokeInternal.
/**
* Reads the given <code>requestElement</code>, and sends a the response back.
*
* @param requestElement the contents of the SOAP message as DOM elements
* @param document a DOM document to be used for constructing <code>Node</code>s
* @return the response element
*/
@Override
protected Element invokeInternal(Element requestElement, Document document) {
StopWatch watch = new StopWatch();
watch.start();
setLocalName(LOCAL_NAME);
Collection<String> eeResult = getArrayValues(requestElement, "ee_ids");
log.info("XML Input read: " + eeResult.size() + " expression experiment(s)");
// start building the wrapper
// build xml manually for mapped result rather than use buildWrapper inherited from AbstractGemmeEndpoint
Element responseWrapper = document.createElementNS(NAMESPACE_URI, LOCAL_NAME);
Element responseElement = document.createElementNS(NAMESPACE_URI, LOCAL_NAME + RESPONSE);
responseWrapper.appendChild(responseElement);
Long eeId = null;
for (String eeString : eeResult) {
eeId = Long.parseLong(eeString);
ExpressionExperiment ee = expressionExperimentService.load(eeId);
if (ee == null) {
String msg = "No expression experiment with id, " + eeId + ", can be found.";
return buildBadResponse(document, msg);
}
ee = expressionExperimentService.thawLite(ee);
Collection<Characteristic> characterCol = ee.getCharacteristics();
for (Characteristic character : characterCol) {
String elementString1 = eeId.toString();
String elementString2 = character.getValue();
String elementString4 = character.getEvidenceCode().getValue();
String elementString3 = character.getCategory();
Element e1 = document.createElement("ee_id");
e1.appendChild(document.createTextNode(elementString1));
responseElement.appendChild(e1);
Element e2 = document.createElement("Category");
e2.appendChild(document.createTextNode(elementString3));
responseElement.appendChild(e2);
Element e3 = document.createElement("Terms");
e3.appendChild(document.createTextNode(elementString2));
responseElement.appendChild(e3);
Element e4 = document.createElement("EvidenceCode");
e4.appendChild(document.createTextNode(elementString4));
responseElement.appendChild(e4);
}
}
watch.stop();
Long time = watch.getTime();
// log.info( "Finished generating result. Sending response to client." );
log.info("XML response for Experiment Annotation result built in " + time + "ms.");
return responseWrapper;
}
use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.
the class ExperimentIDbyTaxonEndpoint method invokeInternal.
/**
* Reads the given <code>requestElement</code>, and sends the response back.
*
* @param requestElement the contents of the SOAP message as DOM elements
* @param document a DOM document to be used for constructing <code>Node</code>s
* @return the response element
*/
@Override
protected Element invokeInternal(Element requestElement, Document document) {
StopWatch watch = new StopWatch();
watch.start();
setLocalName(EXPERIMENT_LOCAL_NAME);
Collection<String> taxonResults = getSingleNodeValue(requestElement, "taxon_id");
String taxonId = "";
for (String id : taxonResults) {
taxonId = id;
}
log.debug("XML input read: taxon id, " + taxonId);
// Get EE matched with Taxon
Taxon tax = taxonService.load(Long.parseLong(taxonId));
if (tax == null) {
String msg = "No taxon with id, " + taxonId + " can be found.";
return buildBadResponse(document, msg);
}
Collection<ExpressionExperiment> eeCollection = expressionExperimentService.findByTaxon(tax);
// build results in the form of a collection
Collection<String> eeIds = new HashSet<String>();
for (ExpressionExperiment ee : eeCollection) {
eeIds.add(ee.getId().toString());
}
Element wrapper = buildWrapper(document, eeIds, "ee_ids");
watch.stop();
Long time = watch.getTime();
log.debug("XML response for Expression Experiment Id results built in " + time + "ms.");
return wrapper;
}
use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.
the class RssFeedControllerTest method testGetLatestExperiments.
@Test
public void testGetLatestExperiments() {
ModelAndView mav = rssFeedController.getLatestExperiments(null, null);
assertNotNull(mav);
Map<String, Object> model = mav.getModel();
assertNotNull(model);
@SuppressWarnings("unchecked") Map<ExpressionExperiment, String> retreivedExperiments = (Map<ExpressionExperiment, String>) model.get("feedContent");
Integer retreivedUpdateCount = (Integer) model.get("updateCount");
Integer retreivedNewCount = (Integer) model.get("newCount");
assertNotNull(retreivedExperiments);
assertNotNull(retreivedUpdateCount);
assertNotNull(retreivedNewCount);
assertTrue(RegressionTesting.containsSame(experiments.keySet(), retreivedExperiments.keySet()));
assertEquals(updateCount, retreivedUpdateCount.intValue());
assertEquals(newCount, retreivedNewCount.intValue());
}
use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.
the class ExpressionExperimentControllerTest method testLoadStatusSummariesLimit.
@Test
public void testLoadStatusSummariesLimit() {
ArrayList<Long> ids = new ArrayList<>();
int limit;
// Default ordering is by date last updated
ExpressionExperiment lastUpdated = null;
for (int i = 0; i < 2; i++) {
ExpressionExperiment ee = this.getTestPersistentCompleteExpressionExperiment(false);
if (lastUpdated == null || lastUpdated.getCurationDetails().getLastUpdated().before(ee.getCurationDetails().getLastUpdated())) {
lastUpdated = ee;
}
ids.add(ee.getId());
}
limit = 1;
Collection<ExpressionExperimentDetailsValueObject> ret = eeController.loadStatusSummaries(-1L, ids, limit, null, true);
assertEquals(1, ret.size());
ExpressionExperimentDetailsValueObject out = ret.iterator().next();
assertEquals(lastUpdated.getId(), out.getId());
}
use of ubic.gemma.model.expression.experiment.ExpressionExperiment 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));
}
Aggregations