Search in sources :

Example 1 with WhatsNew

use of ubic.gemma.core.analysis.report.WhatsNew in project Gemma by PavlidisLab.

the class GemmaClassicHomePageController method updateCounts.

public void updateCounts() {
    Map<String, Long> stats = new HashMap<String, Long>();
    long bioAssayCount = bioAssayService.countAll();
    long arrayDesignCount = arrayDesignService.countAll();
    /*
         * Sort taxa by name.
         */
    TreeMap<Taxon, Long> eesPerTaxon = new TreeMap<Taxon, Long>(new Comparator<Taxon>() {

        @Override
        public int compare(Taxon o1, Taxon o2) {
            return o1.getScientificName().compareTo(o2.getScientificName());
        }
    });
    eesPerTaxon.putAll(expressionExperimentService.getPerTaxonCount());
    long expressionExperimentCount = 0;
    long otherTaxaEECount = 0;
    for (Iterator<Taxon> it = eesPerTaxon.keySet().iterator(); it.hasNext(); ) {
        Taxon t = it.next();
        Long c = eesPerTaxon.get(t);
        // TODO problem with this is we want to make a link to them.
        if (c < 10) {
            // temporary, hide 'uncommon' taxa from this table. See bug 2052
            otherTaxaEECount += c;
            it.remove();
        }
        expressionExperimentCount += c;
    }
    if (otherTaxaEECount > 0) {
    // eesPerTaxon.put( otherTaxa, otherTaxaEECount );
    }
    WhatsNew wn = whatsNewService.retrieveReport();
    stats.put("bioAssayCount", bioAssayCount);
    stats.put("arrayDesignCount", arrayDesignCount);
    mav.addObject("stats", stats);
    mav.addObject("taxonCount", eesPerTaxon);
    mav.addObject("expressionExperimentCount", expressionExperimentCount);
    if (wn != null && wn.getDate() != null) {
        mav.addObject("whatsNew", wn);
    }
}
Also used : Taxon(ubic.gemma.model.genome.Taxon) WhatsNew(ubic.gemma.core.analysis.report.WhatsNew)

Example 2 with WhatsNew

use of ubic.gemma.core.analysis.report.WhatsNew in project Gemma by PavlidisLab.

the class RssFeedControllerTest method setup.

@Before
public void setup() {
    WhatsNew wn = whatsNewService.retrieveReport();
    super.getTestPersistentExpressionExperiment();
    super.getTestPersistentExpressionExperiment();
    whatsNewService.generateWeeklyReport();
    wn = whatsNewService.retrieveReport();
    Collection<ExpressionExperiment> updatedExperiments = wn.getUpdatedExpressionExperiments();
    Collection<ExpressionExperiment> newExperiments = wn.getNewExpressionExperiments();
    for (ExpressionExperiment e : updatedExperiments) {
        experiments.put(e, "Updated");
    }
    for (ExpressionExperiment e : newExperiments) {
        experiments.put(e, "New");
    }
    updateCount = updatedExperiments.size();
    newCount = newExperiments.size();
}
Also used : WhatsNew(ubic.gemma.core.analysis.report.WhatsNew) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) Before(org.junit.Before)

Example 3 with WhatsNew

use of ubic.gemma.core.analysis.report.WhatsNew in project Gemma by PavlidisLab.

the class RssFeedController method getLatestExperiments.

/**
 * Show all experiments
 */
@RequestMapping(value = { "/rssfeed" }, method = RequestMethod.GET)
public ModelAndView getLatestExperiments(HttpServletRequest request, HttpServletResponse response) {
    WhatsNew wn = whatsNewService.retrieveReport();
    if (wn == null) {
        wn = whatsNewService.getReport();
    }
    int updatedExperimentsCount = 0;
    int newExperimentsCount = 0;
    Map<ExpressionExperiment, String> experiments = new HashMap<>();
    if (wn != null) {
        Collection<ExpressionExperiment> updatedExperiments = wn.getUpdatedExpressionExperiments();
        Collection<ExpressionExperiment> newExperiments = wn.getNewExpressionExperiments();
        for (ExpressionExperiment e : updatedExperiments) {
            experiments.put(e, "Updated");
        }
        for (ExpressionExperiment e : newExperiments) {
            experiments.put(e, "New");
        }
        updatedExperimentsCount = updatedExperiments.size();
        newExperimentsCount = newExperiments.size();
    }
    ModelAndView mav = new ModelAndView();
    mav.setView(customRssViewer);
    mav.addObject("feedContent", experiments);
    mav.addObject("updateCount", updatedExperimentsCount);
    mav.addObject("newCount", newExperimentsCount);
    log.debug("RSS experiments loaded.");
    return mav;
}
Also used : HashMap(java.util.HashMap) ModelAndView(org.springframework.web.servlet.ModelAndView) WhatsNew(ubic.gemma.core.analysis.report.WhatsNew) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with WhatsNew

use of ubic.gemma.core.analysis.report.WhatsNew in project Gemma by PavlidisLab.

the class WhatsNewController method weekly.

@RequestMapping("/weekly.html")
public ModelAndView weekly(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = new ModelAndView("wnWeek");
    Calendar c = Calendar.getInstance();
    Date date = c.getTime();
    date = DateUtils.addWeeks(date, -1);
    WhatsNew wn = whatsNewService.getReport(date);
    mav.addObject("whatsnew", wn);
    mav.addObject("timeSpan", "In the past week");
    return mav;
}
Also used : Calendar(java.util.Calendar) ModelAndView(org.springframework.web.servlet.ModelAndView) WhatsNew(ubic.gemma.core.analysis.report.WhatsNew) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with WhatsNew

use of ubic.gemma.core.analysis.report.WhatsNew in project Gemma by PavlidisLab.

the class WhatsNewController method daily.

@RequestMapping("/daily.html")
public ModelAndView daily(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = new ModelAndView("wnDay");
    Calendar c = Calendar.getInstance();
    Date date = c.getTime();
    date = DateUtils.addDays(date, -1);
    WhatsNew wn = whatsNewService.getReport(date);
    mav.addObject("whatsnew", wn);
    mav.addObject("timeSpan", "In the past day");
    return mav;
}
Also used : Calendar(java.util.Calendar) ModelAndView(org.springframework.web.servlet.ModelAndView) WhatsNew(ubic.gemma.core.analysis.report.WhatsNew) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

WhatsNew (ubic.gemma.core.analysis.report.WhatsNew)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ModelAndView (org.springframework.web.servlet.ModelAndView)3 Calendar (java.util.Calendar)2 Date (java.util.Date)2 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)2 Taxon (ubic.gemma.model.genome.Taxon)2 HashMap (java.util.HashMap)1 JSONObject (net.sf.json.JSONObject)1 Before (org.junit.Before)1 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)1