done time execution for queries, query by counter of job, total in column in query...
authorSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Tue, 29 Oct 2013 14:59:46 +0000 (14:59 +0000)
committerSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Tue, 29 Oct 2013 14:59:46 +0000 (14:59 +0000)
12 files changed:
.classpath
.settings/org.eclipse.wst.common.component
.settings/org.eclipse.wst.common.project.facet.core.xml
datadb/compbio/cassandra/DataBase.java
server/compbio/listeners/LengthServlet.java
server/compbio/listeners/ProtServlet.java
server/compbio/listeners/QueryServlet.java
server/compbio/statistic/StatisticsProt.java
website/ReportLength.jsp
website/ReportNew.jsp
website/ReportProt.jsp
website/Sequence.jsp

index 291ed8d..fddf6c3 100644 (file)
@@ -8,16 +8,6 @@
        <classpathentry kind="lib" path="WEB-INF/lib/compbio-util-1.4.jar"/>
        <classpathentry kind="lib" path="WEB-INF/lib/derby-10.8.2.2.jar"/>
        <classpathentry kind="lib" path="WEB-INF/lib/compbio-ga-1.1.jar"/>
-       <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0 (v.41)">
-               <attributes>
-                       <attribute name="owner.project.facets" value="jst.web"/>
-               </attributes>
-       </classpathentry>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_45">
-               <attributes>
-                       <attribute name="owner.project.facets" value="java"/>
-               </attributes>
-       </classpathentry>
        <classpathentry kind="lib" path="testsrc/lib/testng-5.10-jdk15.jar"/>
        <classpathentry kind="lib" path="WEB-INF/lib/jstl-1.1.2.jar"/>
        <classpathentry kind="lib" path="WEB-INF/lib/standard-1.1.2.jar"/>
        <classpathentry kind="lib" path="WEB-INF/lib/cassandra-thrift-1.2.4.jar"/>
        <classpathentry kind="lib" path="WEB-INF/lib/hector-0.7.0-20-sources.jar"/>
        <classpathentry kind="lib" path="WEB-INF/lib/hector-core-1.0-5.jar" sourcepath="/home/asherstnev/.m2/repository/me/prettyprint/hector-core/1.0-5/hector-core-1.0-5-sources.jar"/>
+       <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
+               <attributes>
+                       <attribute name="owner.project.facets" value="jst.web"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_25">
+               <attributes>
+                       <attribute name="owner.project.facets" value="java"/>
+               </attributes>
+       </classpathentry>
        <classpathentry kind="output" path="WEB-INF/classes"/>
 </classpath>
index bc59027..108b089 100644 (file)
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-modules id="moduleCoreId" project-version="1.5.0">
+<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
     <wb-module deploy-name="jaba">
         <wb-resource deploy-path="/" source-path="/website" tag="defaultRootSource"/>
         <wb-resource deploy-path="/conf" source-path="/conf"/>
@@ -7,10 +6,7 @@
         <wb-resource deploy-path="/META-INF" source-path="/META-INF"/>
         <wb-resource deploy-path="/WEB-INF/classes" source-path="/datadb"/>
         <wb-resource deploy-path="/WEB-INF/classes" source-path="/server"/>
-<!--        <dependent-module archiveName="jaba-client.jar" deploy-path="/WEB-INF/lib/" handle="module:/resource/jaba-client/jaba-client">
-            <dependency-type>uses</dependency-type>
-        </dependent-module> -->
         <property name="java-output-path" value="WEB-INF/classes"/>
-        <property name="context-root" value="jabaws"/>
+        <property name="context-root" value="proteocache"/>
     </wb-module>
 </project-modules>
index 885ab91..bad9d4b 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <faceted-project>
-  <runtime name="Apache Tomcat v7.0 (v.41)"/>
+  <runtime name="Apache Tomcat v7.0"/>
   <fixed facet="wst.jsdt.web"/>
   <fixed facet="java"/>
   <fixed facet="jst.web"/>
index bdb1a8c..016a30a 100644 (file)
@@ -13,6 +13,7 @@ public class DataBase {
        private String jpred;
        private List<String> subProt;
        private List<Integer> timeRez;
+       private List<Integer> timeTotalExec;
 
        public DataBase() {
        }
@@ -85,5 +86,13 @@ public class DataBase {
        public List<Integer> getTimeRez() {
                return timeRez;
        }
+       
+       public void setTimeTotalExec(List<Integer> timeTotalExec) {
+               this.timeTotalExec = timeTotalExec;
+       }
+
+       public List<Integer> getTimeTotalExec() {
+               return timeTotalExec;
+       }
 
 }
index 533e6e1..8bcc886 100644 (file)
@@ -24,6 +24,7 @@ public class LengthServlet extends HttpServlet {
         *      response)
         */
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+               final long startTime = System.currentTimeMillis();
                String date1 = request.getParameter("data1");
                String date2 = request.getParameter("data2");
                StatisticsProt sp = new StatisticsProt();
@@ -36,6 +37,8 @@ public class LengthServlet extends HttpServlet {
                request.setAttribute("data2", date2);
                request.setAttribute("result", sp.readLength(date1, date2));
                request.setAttribute("flag", request.getParameter("option"));
+               final long endTime = System.currentTimeMillis();
+               request.setAttribute("timeExecution", (endTime - startTime));
                RequestDispatcher rd = request.getRequestDispatcher("/ReportLength.jsp");
                rd.forward(request, response);
        }
index cb74ecc..d567106 100644 (file)
@@ -23,21 +23,26 @@ public class ProtServlet extends HttpServlet {
         *      response)
         */
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+               final long startTime = System.currentTimeMillis();
                String flag = request.getParameter("protein");
                String prot = request.getParameter("prot");
-               String checkbox = request.getParameter("option");
+               String search = request.getParameter("Search");
+               int counter = Integer.parseInt(request.getParameter("counterJob"));
                StatisticsProt sp = new StatisticsProt();
-               if (checkbox != null) {
-                       request.setAttribute("result", sp.readProtID());
+               if (search.equals("Search counter")) {
+                       request.setAttribute("result", sp.readProtID(counter));
                } else {
                        if (flag.equals("whole"))
                                request.setAttribute("result", sp.readProteins(prot));
                        else
                                request.setAttribute("result", sp.readPart(prot));
                }
+               final long endTime = System.currentTimeMillis();
+               request.setAttribute("timeExecution", (endTime - startTime));
                request.setAttribute("prot", prot);
                request.setAttribute("flag", flag);
-               request.setAttribute("checkbox", checkbox);
+               request.setAttribute("search", search);
+               request.setAttribute("counter", counter);
                RequestDispatcher rd = request.getRequestDispatcher("/ReportProt.jsp");
                rd.forward(request, response);
        }
index 196decb..a69a18f 100644 (file)
@@ -23,6 +23,7 @@ public class QueryServlet extends HttpServlet {
         *      response)
         */
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+               final long startTime = System.currentTimeMillis();
                String date1 = request.getParameter("data1");
                String date2 = request.getParameter("data2");
                StatisticsProt sp = new StatisticsProt();
@@ -35,6 +36,8 @@ public class QueryServlet extends HttpServlet {
                request.setAttribute("data2", date2);
                List<DataBase> res = sp.readDetails(date1, date2);
                request.setAttribute("result", res);
+               final long endTime = System.currentTimeMillis();
+               request.setAttribute("timeExecution", (endTime - startTime));
                System.out.println ("QueryServlet.doGet: total number of dates = " + res.size());
                request.setAttribute("flag", request.getParameter("option"));
                RequestDispatcher rd = request.getRequestDispatcher("/ReportNew.jsp");
index 0294747..df6fec5 100644 (file)
@@ -119,7 +119,7 @@ public class StatisticsProt {
                                while (itCol.hasNext()) {
                                        String id = itCol.next().getName();
                                        long lenResult = CountID(id);
-                                       if (lenResult <= 30)
+                                       if (lenResult <= 30) 
                                                timeResult.set(0, timeResult.get(0) + 1);
                                        else if (lenResult > 30 && lenResult <= 60)
                                                timeResult.set(1, timeResult.get(1) + 1);
@@ -129,6 +129,8 @@ public class StatisticsProt {
                                                timeResult.set(3, timeResult.get(3) + 1);
                                        }
                                }
+                               for (int i = 0; i < 4; i++)
+                                       totalTime.set(i, totalTime.get(i) + timeResult.get(i));
                                DataBase db = new DataBase();
                                db.setTimeRez(timeResult);
                                db.setDate(DateFormat(dateStart));
@@ -136,6 +138,9 @@ public class StatisticsProt {
                        }
                        dateStart += MILLISECONDS_PER_DAY;
                }
+               DataBase db = new DataBase();
+               db.setTimeTotalExec(totalTime);
+               query.add(db);
                System.out.println("StatisticsProt.readLength: total number of dates = " + query.size());
                return query;
        }
@@ -165,7 +170,7 @@ public class StatisticsProt {
        }
 
        // query by a protein sequence
-       public List<DataBase> readProtID() {
+       public List<DataBase> readProtID(int counter) {
                query = new ArrayList<DataBase>();
                int row_count = 100000000;
                RangeSlicesQuery<String, String, String> result = HFactory.createRangeSlicesQuery(cc.GetKeyspace(), StringSerializer.get(),
@@ -190,7 +195,7 @@ public class StatisticsProt {
                                                ++npred;
                                        }
                                }
-                               if (npred > 3) {
+                               if (npred >= counter) {
                                        DataBase db = new DataBase();
                                        db.setProt(last_key);
                                        db.setTotalId(npred);
index c7f9cff..f12c78c 100644 (file)
@@ -12,6 +12,7 @@
 <h3>Time execution for the interval: ${data1}  -  ${data2}</h3> 
 </c:otherwise>
 </c:choose>
+<h3>Time execution: ${timeExecution} ms</h3>
 <table border="1" style = "border-collapse: collapse; white-space: nowrap"> 
 <thead>
 <tr>
 </tr>
 </thead>
 <tbody>
-<c:forEach items="${result}" var="res">
-<tr>
-<td>${res.date}</td>
-<c:forEach items="${res.timeRez}" var="time">
-<td style="text-align: right">${time}</td>
-</c:forEach>
+<c:forEach items="${result}" var="res" varStatus="loop">
+       <c:choose>
+               <c:when test="${not loop.last}">
+                       <tr>
+                       <td>${res.date}</td>
+                       <c:forEach items="${res.timeRez}" var="time">
+                               <td style="text-align: right">${time}</td>
+                       </c:forEach>
+               </c:when>
+               <c:otherwise>
+                       <tr style="font-weight: bolder;">
+                       <td>Total:</td>
+                       <c:forEach items="${res.timeTotalExec}" var="total">
+                               <td style="text-align: right">${total}</td>
+                       </c:forEach>
+               </c:otherwise>
+       </c:choose>
 </c:forEach>
+</tr>
 </tbody>
 </table>
index 498fa8c..5abae4d 100644 (file)
@@ -12,6 +12,7 @@
 <c:out value = "${data1}"/> to <c:out value = "${data2}"/> </h3>
 </c:otherwise>
 </c:choose>
+<h3>Time execution: ${timeExecution} ms</h3>
 <table border="1" style = "border-collapse: collapse; white-space: nowrap"> 
 <thead>
 <tr>
index ae06cf6..3f6028a 100644 (file)
@@ -4,11 +4,18 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
 <%@ taglib uri="http://displaytag.sf.net" prefix="dt"%>
-
-<h3>Dundee ProteoCache query result</h3>
+<c:choose>
+       <c:when test="${search == 'Search counter'}">
+               <h3>Dundee ProteoCache query result for jobs more than ${counter} </h3>
+       </c:when>
+       <c:otherwise>
+               <h3>Dundee ProteoCache query result</h3>
+       </c:otherwise>
+</c:choose>
+<h3>Time execution: ${timeExecution} ms</h3>
 <table border="1" style="border-collapse: collapse; white-space: nowrap">
        <c:choose>
-               <c:when test="${checkbox == 'AllProtein'}">
+               <c:when test="${search == 'Search counter'}">
                        <thead>
                                <tr>
                                        <th style="text-align: centre">Number of jobs</th>
@@ -22,7 +29,7 @@
                                                <td
                                                        style="text-align: left; border-buttom: dotted; font-family: monospace"><a
                                                        title="Click to view predictions"
-                                                       href="ProtServlet?prot=${res.prot}&protein=whole&Search=Search">${res.prot}</a>
+                                                       href="ProtServlet?prot=${res.prot}&protein=whole&Search=Search+sequence&counterJob=${counter}">${res.prot}</a>
                                                </td>
                                        </tr>
                                </c:forEach>
index 1cbcfed..9e28601 100644 (file)
                <p><textarea rows="2" cols="100" name="prot">MPIDYSKWKDIEVSDDEDDTHPNIDTPSLFRWRHQARLERMAEKKMEQEKIDKEKGTTSKKMEELEKKLAAADVTDKSDIQKQIDEVKAQEEAWRKKEAELEEKERLEPWNVDTIGHEAFSTSRINKI</textarea></p>
                <input type="radio" name="protein" value="whole"  Checked>search by the whole sequence
                <input type="radio" name="protein" value="part">search by a part of sequence<br/>
-               <input type="submit" name="Search" value="Search"/><br/><br/>
-               <input type="checkbox" name="option" value="AllProtein">Sequence with more then 3 jobs<br>
+               <input type="submit" name="Search" value="Search sequence"/><br/><br/>
+               <h3>Enter minimum counter of job/protein</h3>
+               <input type="text" name="counterJob" value = 3><br/>
+               <input type="submit" name="Search" value="Search counter"/><br/><br/>
        </form>
 </body>
 </html>