protected Calendar cal = Calendar.getInstance();
protected String theEaerlistDate = DateFormatter.DateLongToString(CassandraReader.earliestDate(), formaterYYMMDD);
protected String theCurrentDate = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH);
-
+
protected String getPrincipalName() {
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (principal instanceof UserDetails) {
}
return false;
}
-
+
protected String DateChecking(String trimmeddate1, String trimmeddate2, long longDate1, long longDate2) {
Calendar cal2 = Calendar.getInstance();
- if (trimmeddate1.equalsIgnoreCase("") || trimmeddate2.equalsIgnoreCase(""))
+ if (trimmeddate1.equalsIgnoreCase("") || trimmeddate2.equalsIgnoreCase(""))
return "The date cann't be empty";
- else if (!DateFormatter.isThisDateValid(trimmeddate1, formaterYYMMDD) || !DateFormatter.isThisDateValid(trimmeddate2, formaterYYMMDD))
+ else if (!DateFormatter.isThisDateValid(trimmeddate1, formaterYYMMDD)
+ || !DateFormatter.isThisDateValid(trimmeddate2, formaterYYMMDD))
return "The date format in invalid. Try format yyyy/mm/dd";
- else if (longDate2 < CassandraReader.earliestDate())
+ else if (longDate2 < CassandraReader.earliestDate())
return "The date2 is after the earlestDate " + theEaerlistDate;
else if (longDate1 > cal2.getTimeInMillis())
return "The date1 is before the current date " + theCurrentDate;
- else if (longDate1 > longDate2)
+ else if (longDate1 > longDate2)
return "Wrong date's diaposon. The date1 is more than date2.";
- else
+ else
return null;
}
}
import compbio.cassandra.CassandraReader;
import compbio.cassandra.DateBean;
import compbio.cassandra.DateFormatter;
+import compbio.cassandra.Total;
import compbio.cassandra.TotalJobsStatisticBean;
import compbio.statistic.CassandraRequester;
* the final date for the report (if option is set, date2 =
* today)
* @param option
- * defined whether the whole time range of jobs is reported
- * (null means date1 and date2 are used)
+ * defined whether the whole time range of jobs is reported (null
+ * means date1 and date2 are used)
* @return link to the report JSP page
*/
@RequestMapping(value = "/stat/jobsdaily/results", method = RequestMethod.GET)
model.put("date2", date2);
TotalJobsStatisticBean res = cr.countJobs(date1, date2);
model.put("result", res);
+ Map<String, Total> results = res.getDateTotal();
+ String csvline = "\'Date\',\'Total\',\'OK\',\'Stopped\',\'Error\',\'Timeout\'%0A";
+ for (Map.Entry<String, Total> entry : results.entrySet()) {
+ csvline += "\'" + entry.getKey() + "\',\'" + entry.getValue().getTotal() + "\',\'" + entry.getValue().getTotalOK() + "\',\'"
+ + entry.getValue().getTotalStopped() + "\',\'" + entry.getValue().getTotalError() + "\',\'"
+ + entry.getValue().getTotalTimeOut() + "\'%0A";
+ }
+ model.put("csvfile", csvline);
model.put("ndays", res.getDateTotal().size());
final long endTime = System.currentTimeMillis();
model.put("timeExecution", (endTime - startTime));
List<TotalByCounterBean> r = cr.readIpByCounter(realcounter);
model.put("results", r);
model.put("njobs", 0);
+ String csvline = "";
if (null != r) {
model.put("njobs", r.size());
+ csvline = "\'Job%20 count\', \'IP\'%0A";
}
+ // form line for CSV file
+ for (TotalByCounterBean b : r) {
+ csvline += "\'" + b.getTotaljobs() + "\',\'" + b.getName() + "\'%0A";
+ }
+ model.put("csvfile", csvline);
final long endTime = System.currentTimeMillis();
model.put("timeExecution", (endTime - startTime));
model.put("counter", realcounter);
import org.springframework.web.bind.annotation.RequestParam;
import compbio.statistic.CassandraRequester;
-import compbio.cassandra.CassandraNativeConnector;
import compbio.cassandra.DataBase;
import compbio.engine.archive.ArchivedJob;
model.put("option", option);
List<DataBase> res = sp.extractExecutionTime(date1, date2);
model.put("result", res);
+ String csvline = "";
+ if (0 < res.size()) {
+ csvline = "\'Date\',\'Total\',\'0-30 sec\',\'30-60 sec\',\'1-2 min\',\'2-10 min\',\'more 10 min\'%0A";
+ for (DataBase entry : res) {
+ List<Integer> counts = entry.getTimeRez();
+ int total = 0;
+ for (int i = 0; i < counts.size(); ++i) {
+ total += counts.get(i);
+ }
+ csvline += "\'" + entry.getDate() + "\',\'" + total;
+ for (int i = 0; i < counts.size(); ++i) {
+ csvline += "\',\'" + counts.get(i);
+ }
+ csvline += "\'%0A";
+ }
+ }
+ model.put("csvfile", csvline);
model.put("ndays", res.size() - 1);
final long endTime = System.currentTimeMillis();
model.put("timeExecution", (endTime - startTime));
*
* @param indate
* date in milliseconds from 1 Jan 1970
- * @return date
- * in the form of yyyy/mm/dd
+ * @return date in the form of yyyy/mm/dd
*/
private String DateFormatYYMMDD(long indate) {
SimpleDateFormat datformat = new SimpleDateFormat("yyyy/MM/dd");
@RequestMapping(value = "/index", method = RequestMethod.GET)
public String printPublicHome(ModelMap model) {
model.addAttribute("username", getPrincipalName());
- if (isUserRole()) return "home";
+ if (isUserRole())
+ return "home";
return "public";
}
}
@RequestMapping(value = "/home", method = RequestMethod.GET)
- public String printHome(ModelMap model ) {
+ public String printHome(ModelMap model) {
model.addAttribute("username", getPrincipalName());
return "home";
}
Map<String, String> r = cr.readProteinsPrediction(typeFeature, realpercent);
model.put("results", r);
model.put("njobs", 0);
+ String csvline = "";
if (null != r) {
model.put("njobs", r.size());
+ csvline = "\'Prediction%20number\',\'Protein%20Sequence\', \'Secondary%20Structure%20Prediction\'%0A";
}
+
+ // form line for CSV file
+ int counter = 1;
+ for (Map.Entry<String, String> entry : r.entrySet()) {
+ csvline += "\'" + counter + "\',\'" + entry.getKey() + "\',\'" + entry.getValue() + "\'%0A";
+ ++counter;
+ }
+ model.put("csvfile", csvline);
+
final long endTime = System.currentTimeMillis();
model.put("timeExecution", (endTime - startTime));
model.put("feature", typeFeature);
package compbio.controllers;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
+import compbio.cassandra.DataBase;
import compbio.cassandra.ProteinBean;
+import compbio.cassandra.Total;
import compbio.cassandra.TotalByCounterBean;
import compbio.statistic.CassandraRequester;
model.put("njobs", 0);
model.put("prot", trimmedsequence);
model.put("searchtype", searchtype);
-
+ String csvline = "";
if (0 < trimmedsequence.length()) {
CassandraRequester cr = new CassandraRequester();
List<ProteinBean> r = cr.readProteins(trimmedsequence, searchtype);
model.put("njobs", r.get(0).getJobid().size());
else
model.put("njobs", r.size());
+ csvline = "\'Job\',\'Annotation\',\'Sequence\'%0A";
+ }
+ // form CSV file string
+ for (ProteinBean entry : r) {
+ List<String> jobs = entry.getJobid();
+ String protein = entry.getSequence();
+ LinkedHashMap<String, String> predictions = entry.getPredictions();
+ for (String job : jobs) {
+ csvline += "\'" + job + "\',\'Sequence\',\'" + protein + "\',\'%0A";
+ for (Map.Entry<String, String> pr : predictions.entrySet()) {
+ csvline += "\'\',\'" + pr.getKey() + "\',\'" + pr.getValue() + "\'%0A";
+ }
+ }
}
}
+ model.put("csvfile", csvline);
+
final long endTime = System.currentTimeMillis();
model.put("timeExecution", (endTime - startTime));
return "reportProteinSequences";
CassandraRequester cr = new CassandraRequester();
List<TotalByCounterBean> r = cr.readProteinByCounter(realcounter);
- model.put("results", r);
model.put("njobs", 0);
+ String csvline = "";
if (null != r) {
model.put("njobs", r.size());
+ csvline = "\'Job%20 count\', \'Protein%20Sequence\'%0A";
}
+ // form line for CSV file
+
+ for (TotalByCounterBean b : r) {
+ if (b.getName().equals("")) {
+ csvline += "\'" + b.getTotaljobs() + "\',\'Alignment%20job\'%0A";
+ // fix problem with records without protein sequence (alignment
+ // jobs)
+ b.setName("Alignment job");
+ } else {
+ csvline += "\'" + b.getTotaljobs() + "\',\'" + b.getName() + "\'%0A";
+ }
+ }
+ model.put("csvfile", csvline);
+
+ model.put("results", r);
final long endTime = System.currentTimeMillis();
model.put("timeExecution", (endTime - startTime));
model.put("counter", realcounter);
<jsp:include page="fragments/mainmenu.jsp" />
<spring:url value="/job/results" var="jobqueryservlet" />
+ <c:set var="csv" value="\'Job ID\', \'Date\', \'Sequence\'"/>
+ <c:forEach items="${results.mainInfo}" var="res" varStatus="status">
+ <c:set var="csv" value="${csv}%0A'${res.key}"/>
+ <c:forEach items="${res.value}" var="info" varStatus="status">
+ <c:if test="${status.first}">
+ <c:set var="csv" value="${csv}\',\'${info}"/>
+ </c:if>
+ <c:if test="${!status.first}">
+ <c:choose>
+ <c:when test="${info==''}">
+ <c:set var="csv" value="${csv}\',\'Alignment job"/>
+ </c:when>
+ <c:otherwise>
+ <c:set var="csv" value="${csv}\',\'${info}"/>
+ </c:otherwise>
+ </c:choose>
+ </c:if>
+ </c:forEach>
+ <c:set var="csv" value="${csv}\'"/>
+ </c:forEach>
+
+ <!-- reload and CSV buttons -->
+ <ul class="nav navbar-nav navbar-right">
+ <li>
+ <a href="${the_query}" class="btn btn-default active">Reload</a>
+ </li>
+ <li>
+ <a id="forCSVfile" download="data.csv" href="data:application/csv;charset=utf-8,${csv}" class="btn btn-default active">CSV</a>
+ </li>
+ </ul>
+
+
<div class="panel panel-default">
<div class="panel-heading">
<p style="font-weight:bold;">Jobs executed from ${ip}</p>
<c:otherwise>
<p>${njobs} jobs found:</p>
<div class="table-responsive">
+ <div class="grid-wrapper-div">
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
</c:forEach>
</tbody>
</table>
+ </div>
</div>
</c:otherwise>
</c:choose>
<div class="container">
<jsp:include page="fragments/mainmenu.jsp" />
<spring:url value="/admin/ip/results" var="ipquery" />
+ <spring:url value="/admin/ip/counts/results?JobCounter=${counter}" var="the_query"/>
+
+ <!-- reload and CSV buttons -->
+ <ul class="nav navbar-nav navbar-right">
+ <li>
+ <a href="${the_query}" class="btn btn-default active">Reload</a>
+ </li>
+ <c:choose><c:when test="${csvfile != ''}">
+ <li>
+ <a id="forCSVfile" download="data.csv" href="data:application/csv;charset=utf-8,${csvfile}" class="btn btn-default active">CSV</a>
+ </li>
+ </c:when></c:choose>
+ </ul>
<div class="panel panel-default">
<div class="panel-heading">
- <div style="font-weight:bold;">Jobs Statistics</div>
+ <p style="font-weight:bold;">IP Statistics</p>
</div>
<div class="panel-body">
<c:otherwise>
<p>${njobs} IP with at least ${counter} jobs ever launched</p>
<div class="table-responsive">
- <table class="table table-striped table-hover table-bordered">
+ <table class="table table-striped table-hover table-bordered" id="counts">
<thead>
<tr>
<th style="text-align: centre">Number of jobs</th>
<spring:url value="../${jobarchive}" var="jobarchivefile" />
<p>Job archive: <a title="Click to get the file" href="${jobarchivefile}">download</a></p>
</c:if>
+ <div class="grid-wrapper-div">
<table class="table table-striped table-hover table-bordered">
<tbody>
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th >Sequence</th>
+ </tr>
+ </thead>
<tr>
- <td>Sequence</td>
- <td style="text-align: left; border-buttom: dotted; font-family: monospace">
+ <td>Protein</td>
+ <td >
<a title="Click to view other jobs" href="${sequence_query}?sequence=${result.sequence}&searchtype=whole">${result.sequence}</a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
+ </div>
</div>
</div>
<spring:url value="/stat/jobsoneday/results" var="oneday_query" />
<spring:url value="/stat/jobsdaily/results?date1=${date1}&date2=${date2}&option=${option}" var="the_query" />
- <ul class="nav navbar-nav navbar-right">
- <li>
- <a href="${the_query}" class="btn btn-default active">Reload</a>
- </li>
- </ul>
+ <!-- reload and CSV buttons -->
+ <ul class="nav navbar-nav navbar-right">
+ <li>
+ <a href="${the_query}" class="btn btn-default active">Reload</a>
+ </li>
+ <c:choose><c:when test="${csvfile != ''}">
+ <li>
+ <a id="forCSVfile" download="data.csv" href="data:application/csv;charset=utf-8,${csvfile}" class="btn btn-default active">CSV</a>
+ </li>
+ </c:when></c:choose>
+ </ul>
<div class="panel panel-default">
<div class="panel-heading">
<jsp:include page="fragments/mainmenu.jsp" />
<spring:url value="/job/results" var="job_query" />
<spring:url value="/stat/onedaystat?date=${date}&status=${status}" var="the_query" />
+ <spring:url value="/sequence/sequence/results" var="sequence_query" />
<ul class="nav navbar-nav navbar-right">
<li>
<td>Job with alignment</td>
</c:when>
<c:otherwise>
- <td style="text-align: left; border-buttom: dotted; font-family: monospace">${res.value}</td>
+ <td style="text-align: left; border-buttom: dotted; font-family: monospace">
+ <!-- ${res.value}-->
+ <a title="Click to view all jobs" href="${sequence_query}?sequence=${res.value}&searchtype=whole">
+ <script>
+ document.write(shorten('${res.value}', 108));
+ </script>
+ </a>
+ </td>
</c:otherwise>
</c:choose>
<div class="container">
<jsp:include page="fragments/mainmenu.jsp" />
<spring:url value="/job/results" var="job_query" />
+ <spring:url value="/sequence/sequence/results?sequence=${prot}&searchtype=${searchtype}" var="the_query"/>
+ <c:set var="shortensequencelength" value="108"/>
+ <!-- reload and CSV buttons -->
+ <ul class="nav navbar-nav navbar-right">
+ <li>
+ <a href="${the_query}" class="btn btn-default active">Reload</a>
+ </li>
+ <c:choose><c:when test="${csvfile != '' and csvfile != null}">
+ <li>
+ <a id="forCSVfile" download="data.csv" href="data:application/csv;charset=utf-8,${csvfile}" class="btn btn-default active">CSV</a>
+ </li>
+ </c:when></c:choose>
+ </ul>
+
<div class="panel panel-default">
<div class="panel-heading">
<c:choose>
<c:when test="${searchtype == 'whole'}">
- <p style="font-weight:bold;">Jobs for the protein sequence: ${prot}</p>
+ <p style="font-weight:bold;">
+ Jobs for the protein sequence:
+ <script> document.write(shorten('${prot}', '${shortensequencelength}'));</script>
+ </p>
</c:when>
<c:otherwise>
- <p style="font-weight:bold;">Jobs for the protein sequences, which include the substring:
- ${prot}</p>
+ <p style="font-weight:bold;">
+ Jobs for the protein sequences, which include the substring:
+ <script> document.write(shorten('${prot}', '${shortensequencelength}'));</script>
+ </p>
</c:otherwise>
</c:choose>
</div>
<c:otherwise>
<p>${njobs} jobs found</p>
<div class="table-responsive">
+ <div class="grid-wrapper-div">
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
href="${job_query}?IdJob=${id}">${id}</a></th>
</tr>
<tr>
- <td style="text-align: center; font-weight: bold; font-family: monospace">Protein Sequence</td>
+ <td style="text-align: center; font-weight: bold; font-family: monospace">Sequence</td>
<c:if test="${searchtype == 'whole'}">
<td
style="text-align: left; border-buttom: dotted; font-family: monospace"><c:out
</c:forEach>
</tbody>
</table>
+ </div>
</div>
</c:otherwise>
</c:choose>
-<%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8"%>
+<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
-<%@page import="java.util.ArrayList"%>
<html>
<jsp:include page="fragments/header.jsp" />
+
<body>
<div class="container">
<jsp:include page="fragments/mainmenu.jsp" />
<spring:url value="/sequence/sequence/results" var="sequence_query" />
+ <spring:url value="/sequence/counts/results?counterJob=${counter}" var="the_query" />
+ <c:set var="shortensequencelength" value="108"/>
+
+ <!-- reload and CSV buttons -->
+ <ul class="nav navbar-nav navbar-right">
+ <li>
+ <a href="${the_query}" class="btn btn-default active">Reload</a>
+ </li>
+ <c:choose><c:when test="${njobs > 0}">
+ <li>
+ <a id="forCSVfile" download="data.csv" href="data:application/csv;charset=utf-8,${csvfile}" class="btn btn-default active">CSV</a>
+ </li>
+ </c:when></c:choose>
+ </ul>
<div class="panel panel-default">
<div class="panel-heading">
- <div style="font-weight:bold;">Jobs Statistics</div>
+ <p style="font-weight:bold;">Jobs Statistics</p>
</div>
- <div class="panel-body">
+ <div class="panel-body">
<c:choose>
<c:when test="${njobs == 0}">
<p>No proteins with at least ${counter} jobs found</p>
<c:otherwise>
<p>${njobs} proteins with at least ${counter} jobs found</p>
<div class="table-responsive">
- <table class="table table-striped table-hover table-bordered">
+ <table class="table table-striped table-hover table-bordered" id="counts">
<thead>
<tr>
<th style="text-align: centre">Number of jobs</th>
<c:forEach items="${results}" var="res">
<tr>
<td>${res.totaljobs}</td>
- <td style="text-align: left; border-buttom: dotted; font-family: monospace">
- <a title="Click to view all jobs" href="${sequence_query}?sequence=${res.name}&searchtype=whole">${res.name}</a>
+ <td style="text-overflow:ellipsis text-align: left; font-family: monospace" id="proteinline">
+ <a title="Click to view all jobs" href="${sequence_query}?sequence=${res.name}&searchtype=whole">
+ <script>
+ document.write(shorten('${res.name}', '${shortensequencelength}'));
+ </script>
+ <!-- ${res.name}-->
+ </a>
</td>
</tr>
</c:forEach>
<div class="container">
<jsp:include page="fragments/mainmenu.jsp" />
<spring:url value="/sequence/sequence/results" var="sequence_query" />
+ <spring:url value="/features/results" var="the_query"/>
+ <spring:url value="/features/results?TypeFeatures=${feature}&Percent=${percent}" var="the_query" />
+
+ <!-- reload and CSV buttons -->
+ <ul class="nav navbar-nav navbar-right">
+ <li>
+ <a href="${the_query}" class="btn btn-default active">Reload</a>
+ </li>
+ <c:choose><c:when test="${csvfile != ''}">
+ <li>
+ <a id="forCSVfile" download="data.csv" href="data:application/csv;charset=utf-8,${csvfile}" class="btn btn-default active">CSV</a>
+ </li>
+ </c:when></c:choose>
+ </ul>
<div class="panel panel-default">
<div class="panel-heading">
- <div style="font-weight:bold;">Protein Secondary Structure Feature Statistics</div>
+ <p style="font-weight:bold;">Protein Secondary Structure Feature Statistics</p>
</div>
- <div class="panel-body">
+ <div class="panel-body">
<c:choose>
<c:when test="${njobs == 0}">
<p>No proteins with feature ${feature} more then ${percent}% of the protein sequence found</p>
<tr>
<td rowspan = 2>${count}
<td style="text-align: left; border-buttom: dotted; font-family: monospace">
- <a title="Click to view all jobs" href="${sequence_query}?sequence=${res.key}&searchtype=whole">${res.key}</a></td>
+ <a title="Click to view all jobs" href="${sequence_query}?sequence=${res.key}&searchtype=whole">
+ <script>
+ document.write(shorten('${res.key}', 108));
+ </script>
+ </a></td>
</tr>
<tr>
- <td style="text-align: left; border-buttom: dotted; font-family: monospace">${res.value}</td>
+ <td style="text-align: left; border-buttom: dotted; font-family: monospace">
+ <script>
+ document.write(shorten('${res.value}', 108));
+ </script>
+ </td>
</tr>
</c:forEach>
</tbody>
<body>
<div class="container">
<jsp:include page="fragments/mainmenu.jsp" />
- <spring:url value="/stat/exectime/query?date1=${date1}&date2=${date2}&option=${option}" var="the_query" />
+ <spring:url value="/stat/exectime/results?date1=${date1}&date2=${date2}&option=${option}" var="the_query" />
- <!-- reload button -->
+ <!-- reload and CSV buttons -->
<ul class="nav navbar-nav navbar-right">
<li>
<a href="${the_query}" class="btn btn-default active">Reload</a>
</li>
+ <c:choose><c:when test="${csvfile != ''}">
+ <li>
+ <a id="forCSVfile" download="data.csv" href="data:application/csv;charset=utf-8,${csvfile}" class="btn btn-default active">CVS</a>
+ </li>
+ </c:when></c:choose>
</ul>
+ <!-- main data loop -->
<div class="panel panel-default">
<div class="panel-heading">
<c:choose>