<classpathentry kind="lib" path="WEB-INF/lib/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/spring-aop-3.2.3.RELEASE.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/spring-beans-3.2.3.RELEASE.jar"/>
- <classpathentry kind="lib" path="WEB-INF/lib/spring-context-3.2.3.RELEASE.jar"/>
- <classpathentry kind="lib" path="WEB-INF/lib/spring-context-support-3.2.3.RELEASE.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/spring-core-3.2.3.RELEASE.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/spring-data-commons-1.5.2.RELEASE.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/spring-data-jpa-1.3.4.RELEASE.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/spring-tx-3.2.3.RELEASE.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/spring-web-3.2.3.RELEASE.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/spring-webmvc-3.2.3.RELEASE.jar" sourcepath="/home/asherstnev/.m2/repository/org/springframework/spring-webmvc/3.2.3.RELEASE/spring-webmvc-3.2.3.RELEASE-sources.jar"/>
+ <classpathentry kind="lib" path="WEB-INF/lib/spring-context-3.2.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="WEB-INF/lib/spring-context-support-3.2.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="WEB-INF/lib/spring-security-acl-3.1.4.RELEASE.jar"/>
+ <classpathentry kind="lib" path="WEB-INF/lib/spring-security-config-3.1.4.RELEASE.jar"/>
+ <classpathentry kind="lib" path="WEB-INF/lib/spring-security-core-3.1.4.RELEASE.jar"/>
+ <classpathentry kind="lib" path="WEB-INF/lib/spring-security-taglibs-3.1.4.RELEASE.jar"/>
+ <classpathentry kind="lib" path="WEB-INF/lib/spring-security-web-3.1.4.RELEASE.jar"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_45"/>
<classpathentry kind="output" path="WEB-INF/classes"/>
--- /dev/null
+<beans:beans xmlns="http://www.springframework.org/schema/security"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/security
+ http://www.springframework.org/schema/security/spring-security-3.1.xsd">
+
+ <http auto-config="true">
+ <intercept-url pattern="/home/*" access="ROLE_USER" />
+ <form-login login-page="/login" default-target-url="/welcome"
+ authentication-failure-url="/loginfailed" />
+ <logout logout-success-url="/logout" />
+ </http>
+
+ <authentication-manager>
+ <authentication-provider>
+ <user-service>
+ <user name="sherstnev" password="sasha12345" authorities="ROLE_USER" />
+ </user-service>
+ </authentication-provider>
+ </authentication-manager>
+
+</beans:beans>
model.put("date1", date1);
model.put("date2", date2);
-
+
return "queryJobStatistics";
}
model.put("date2", date2);
TotalJobsStatisticBean res = cr.countJobs(date1, date2);
model.put("result", res);
+ model.put("ndays", res.getDateTotal().size());
final long endTime = System.currentTimeMillis();
model.put("timeExecution", (endTime - startTime));
model.put("option", option);
return "/reportJobStatistics";
}
-
+
@RequestMapping(value = "/stat/oneday", method = RequestMethod.GET)
public String findJobsInOneDay(@RequestParam("date") String date, Map<String, Object> model) throws ParseException {
final long startTime = System.currentTimeMillis();
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+
//import org.springframework.web.bind.annotation.RequestParam;
/**
return "support/Notimplemented";
}
-
@RequestMapping(value = "/help/doc", method = RequestMethod.GET)
public String formDocPage(Map<String, Object> model) {
return "support/Notimplemented";
}
-
@RequestMapping(value = "/help/javadoc", method = RequestMethod.GET)
public String formJavadoc(Map<String, Object> model) {
package compbio.controllers;
import java.util.Calendar;
+import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
-import compbio.statistic.CassandraRequester;
+import compbio.statistic.CassandraRequester;
/**
* @author Alexander Sherstnev
model.put("date1", date1);
model.put("date2", date2);
model.put("option", option);
- // model.put("result", sp.extractExecutionTime(date1, date2));
+// List<DataBase> res = sp.extractExecutionTime(date1, date2);
+// model.put("result", res);
+// model.put("ndays", res.size() - 1);
final long endTime = System.currentTimeMillis();
model.put("timeExecution", (endTime - startTime));
return "/reportTimeExecution";
import java.util.List;
import java.util.Map;
+import java.util.regex.Pattern;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import compbio.cassandra.ProteinBean;
+import compbio.data.sequence.SequenceUtil;
import compbio.cassandra.TotalByCounterBean;
import compbio.statistic.CassandraRequester;
/**
+ * Spring controller for sequence search. This version works in the servlet
+ * style.
+ *
* @author Alexander Sherstnev
* @author Natasha Sherstneva
+ *
+ * @since 0.5
+ * @version 1.0 December 2013
*/
@Controller
public class SequenceController {
+ /**
+ * pattern for NON-protein alphabet symbols
+ */
+ private final Pattern NONPROTEIN = Pattern.compile("[^ARNDCQEGHILKMFPSTWYV]+", Pattern.CASE_INSENSITIVE);
+
@RequestMapping(value = "/sequence/query1", method = RequestMethod.GET)
public String formSequenceQuery(Map<String, Object> model) {
model.put("value", "AAAAA");
model.put("value", 5);
return "queryProteinSequenceCounter";
}
-
+
@RequestMapping(value = "/sequence/querysequence", method = RequestMethod.GET)
public String findSequence(@RequestParam("sequence") String sequence, @RequestParam("protein") String flag, Map<String, Object> model) {
final long startTime = System.currentTimeMillis();
+ // input checks
String trimmedsequence = sequence.replaceAll("\\s", "");
+ if (trimmedsequence.equalsIgnoreCase("")) {
+ model.put("error", "The sequence cann't be empty");
+ model.put("value", sequence);
+ return "queryProteinSequence";
+ }
+ if (NONPROTEIN.matcher(trimmedsequence).find()) {
+ model.put("error", "The sequence contains symbols not from the standard protein alphabet");
+ model.put("value", sequence);
+ return "queryProteinSequence";
+ }
+
model.put("njobs", 0);
model.put("prot", trimmedsequence);
model.put("flag", flag);
model.put("results", r);
if (null != r) {
if (flag.equals("whole"))
- model.put("njobs",r.get(0).getJobid().size());
+ model.put("njobs", r.get(0).getJobid().size());
else
model.put("njobs", r.size());
}
if (null == date2) {
date1 = "2100/1/1";
}
- if (!isThisDateValid(date1,formatYYMMDD) || !isThisDateValid(date2,formatYYMMDD)) {
+ if (!isThisDateValid(date1, formatYYMMDD) || !isThisDateValid(date2, formatYYMMDD)) {
System.out.println("CassandraRequester.extractExecutionTime: wrong format for date1 " + date1 + "or date2 " + date2);
return null;
}
db.setTimeTotalExec(totalTime);
query.add(db);
return query;
+<<<<<<< HEAD
}*/
/*
- * query: total number of jobs for the period from date1 till date2
+ * query: total number of jobs for the period from date1 till date2
*/
public TotalJobsStatisticBean countJobs(String date1, String date2) {
if (null == date1) {
Calendar end = Calendar.getInstance();
end.setTime(new Date(dateEnd));
TotalJobsStatisticBean query = new TotalJobsStatisticBean();
- Total wholeTotal = new Total(0,0,0,0,0);
+ Total wholeTotal = new Total(0, 0, 0, 0, 0);
for (Date date = start.getTime(); !start.after(end); start.add(Calendar.DATE, 1), date = start.getTime()) {
Total res = db.ReadDateTable(date.getTime());
if (res == null)
/*
* query: jobs and sequence at date
*/
- public DateBean readJobByDay (String date) {
+ public DateBean readJobByDay(String date) {
if (!isThisDateValid(date, formatDDMMYY)) {
System.out.println("CassandraRequester.readJobByDay: Wrong date format for " + date);
return null;
SetDateRange();
long day = DateParsing(date, formatDDMMYY);
if (day < earlestDate || day > currentDate)
- return null;
+ return null;
return db.ReadProteinData(day, date);
}
-
- /*
+ /*
* query: protein sequence
- **/
+ */
public List<ProteinBean> readProteins(String protIn, String flag) {
List<ProteinBean> result;
- if (flag.equals("whole"))
+ if (flag.equals("whole"))
result = db.ReadWholeSequence(protIn);
- else
- result = db.ReadPartOfSequence(protIn);
+ else
+ result = db.ReadPartOfSequence(protIn);
if (result == null)
return null;
-
+
if (flag.equals("part")) {
for (ProteinBean entry : result) {
entry.setSubProt(CreateSubprot(entry.getSequence(), protIn));
}
- }
+ }
return result;
}
-
- /*
+ /*
* query protein sequences with number of jobs
*/
- public List<TotalByCounterBean> readProteinByCounter(int minimalcounter) {
+ public List<TotalByCounterBean> readProteinByCounter(int minimalcounter) {
List<TotalByCounterBean> query = new ArrayList<TotalByCounterBean>();
Map<String, Integer> map = db.ReadProteinSequenceByCounter();
if (map == null)
}
return query;
}
-
- /*
+
+ /*
* query ip with number of jobs
*/
public List<TotalByCounterBean> readIpByCounter(Integer minimalcounter) {
}
return query;
}
+
/*
* query jobs log info
*/
return null;
return db.ReadJobLog(jobid);
}
-
-
+
/*
* query jobs by ipStructureJobLog
*/
if (ip == null)
return null;
Map<String, String[]> res = db.ReadIpWithJobs(ip);
- if (res == null)
+ if (res == null)
return null;
UserBean query = new UserBean(ip);
query.setMainInfo(res);
return query;
}
-
+
/*
* create list of parts of protein sequence;
*/
- private static List<String> CreateSubprot (String protein, String subprot) {
+ private static List<String> CreateSubprot(String protein, String subprot) {
List<String> sub = new ArrayList<String>();
String subStr = protein;
while (subStr.length() > 0 && subStr.contains(subprot)) {
sub.add(subStr);
return sub;
}
+
/*
* convert String date into long date (miliseconds since the epoch start)
*/
return 0;
}
long dateWorkSt = 0;
-
+
try {
dateWorkSt = formatter.parse(datInput).getTime();
} catch (ParseException e) {
*/
private static void SetDateRange() {
Calendar cal = Calendar.getInstance();
- currentDate = DateParsing(cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH), formatYYMMDD);
+ currentDate = DateParsing(cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH),
+ formatYYMMDD);
if (0 == earlestDate) {
CassandraRequester cr = new CassandraRequester();
earlestDate = cr.earliestDate();
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<body>
<div class="container">
<jsp:include page="fragments/mainmenu.jsp" />
+ <spring:url value="/sequence/querysequence" var="query"/>
<div class="panel panel-default">
<div class="panel-heading">
<div style="font-weight:bold;">Enter protein sequence</div>
</div>
<div class="panel-body">
- <spring:url value="/sequence/querysequence" var="formurl"/>
- <form method="get" action="${fn:escapeXml(formurl)}">
- <p><textarea class="form-control" rows="3" name="sequence">${value}</textarea></p>
- <p><input type="radio" name="protein" value="whole">search for the whole sequence<br/>
- <input type="radio" name="protein" value="part" Checked>search for partial sequence matching</p>
- <input type="submit" name="Search" value="Search"/>
+ <form method="get" action="${query}">
+ <c:choose>
+ <c:when test="${error == null}">
+ <div class="form-group">
+ <p><textarea class="form-control" rows="3" name="sequence">${value}</textarea></p>
+ <p><input type="radio" name="protein" value="whole">search for the whole sequence<br/>
+ <input type="radio" name="protein" value="part" Checked>search for partial sequence matching</p>
+ <input type="submit" name="Search" value="Search"/>
+ </div>
+ </c:when>
+ <c:otherwise>
+ <div class="form-group has-error">
+ <p><textarea class="form-control" rows="3" name="sequence">${value}</textarea></p>
+ <p class="help-block">${error}</p>
+ <p><input type="radio" name="protein" value="whole">search for the whole sequence<br/>
+ <input type="radio" name="protein" value="part" Checked>search for partial sequence matching</p>
+ <input type="submit" name="Search" value="Search"/>
+ </div>
+ </c:otherwise>
+ </c:choose>
</form>
</div>
</div>
<div class="panel-heading">
<c:choose>
<c:when test="${option == 'AllDates,off'}">
- <p style="font-weight:bold;">Jobs statistics for the whole period</p>
+ <p style="font-weight:bold;">Jobs statistics for the whole period (${ndays} days)</p>
</c:when>
<c:otherwise>
<p style="font-weight:bold;">
- Jobs statistics for the time period: <c:out value="${date1}" /> to <c:out value="${date2}"/>
+ Jobs statistics for the time period: <c:out value="${date1}" /> to <c:out value="${date2}"/> (${ndays} days)
</p>
</c:otherwise>
</c:choose>
<div class="panel-heading">
<c:choose>
<c:when test="${option == 'AllDates,off'}">
- <p style="font-weight:bold;">Time execution for the whole period</p>
+ <p style="font-weight:bold;">Time execution for the whole period (${ndays} days)</p>
</c:when>
<c:otherwise>
- <p style="font-weight:bold;">Time execution for the interval: ${date1} - ${date2}</p>
+ <p style="font-weight:bold;">Time execution for the interval: ${date1} - ${date2} (${ndays} days)</p>
</c:otherwise>
</c:choose>
</div>
<c:when test="${loop.last}">
<tr style="font-weight: bolder;">
<td style="text-align: right">Total numbers:</td>
- <td style="text-align: right">0</td>
+ <c:set var="alldaytotal" value="0"/>
+ <c:forEach items="${res.timeTotalExec}" var="total">
+ <c:set var="alldaytotal" value="${alldaytotal + total}"/>
+ </c:forEach>
+ <td style="text-align: right">${alldaytotal}</td>
<c:forEach items="${res.timeTotalExec}" var="total">
<td style="text-align: right">${total}</td>
</c:forEach>
<c:when test="${not loop.last}">
<tr>
<td style="text-align: center">${res.date}</td>
- <td style="text-align: right">0</td>
+ <c:set var="daytotal" value="0"/>
+ <c:forEach items="${res.timeRez}" var="time">
+ <c:set var="daytotal" value="${daytotal + time}"/>
+ </c:forEach>
+ <td style="text-align: right">${daytotal}</td>
<c:forEach items="${res.timeRez}" var="time">
<td style="text-align: right">${time}</td>
</c:forEach>