Search in sources :

Example 1 with ExpressionExperiment

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;
}
Also used : Element(org.w3c.dom.Element) Characteristic(ubic.gemma.model.common.description.Characteristic) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) StopWatch(org.apache.commons.lang3.time.StopWatch)

Example 2 with ExpressionExperiment

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;
}
Also used : Taxon(ubic.gemma.model.genome.Taxon) Element(org.w3c.dom.Element) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) StopWatch(org.apache.commons.lang3.time.StopWatch) HashSet(java.util.HashSet)

Example 3 with ExpressionExperiment

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());
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test) BaseSpringWebTest(ubic.gemma.web.util.BaseSpringWebTest)

Example 4 with ExpressionExperiment

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());
}
Also used : ArrayList(java.util.ArrayList) ExpressionExperimentDetailsValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentDetailsValueObject) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) Test(org.junit.Test) BaseSpringWebTest(ubic.gemma.web.util.BaseSpringWebTest)

Example 5 with ExpressionExperiment

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

Aggregations

ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)214 Test (org.junit.Test)71 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)42 InputStream (java.io.InputStream)36 GeoSeries (ubic.gemma.core.loader.expression.geo.model.GeoSeries)29 AlreadyExistsInSystemException (ubic.gemma.core.loader.util.AlreadyExistsInSystemException)29 GZIPInputStream (java.util.zip.GZIPInputStream)28 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)26 HashSet (java.util.HashSet)25 BioAssaySet (ubic.gemma.model.expression.experiment.BioAssaySet)25 GeoDomainObjectGeneratorLocal (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal)23 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)22 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)20 Collection (java.util.Collection)18 StopWatch (org.apache.commons.lang3.time.StopWatch)18 ExperimentalFactor (ubic.gemma.model.expression.experiment.ExperimentalFactor)18 Taxon (ubic.gemma.model.genome.Taxon)14 Before (org.junit.Before)12 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)12 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)11