--- /dev/null
+package compbio.cassandra;
+
+import java.util.Map;
+
+public class AnnotatedProteinSequenceBean {
+ private String sequence;
+ private String jobid;
+ private Map<String,String> predictions;
+ private int size;
+
+ public AnnotatedProteinSequenceBean (String seq, String id, Map<String,String> pred) {
+ this.sequence = seq;
+ this.jobid = id;
+ this.predictions = pred;
+ this.size = pred.size();
+ }
+
+ public String getSequence () {
+ return sequence;
+ }
+
+ public String getJobid () {
+ return jobid;
+ }
+
+ public int getmapsize () {
+ return size;
+ }
+
+ public Map<String,String> getPredictions () {
+ return predictions;
+ }
+
+ public void setPredictions (Map<String,String> predictions) {
+ this.predictions = predictions;
+ this.size = predictions.size();
+ }
+
+}
/*
* getting whole protein sequence from the db ProteinRow
*/
- public List<StructureProteinPrediction> ReadWholeSequence(String queryProtein) {
+ public List<AnnotatedProteinSequenceBean> ReadWholeSequence(String queryProtein) {
final long startTime = System.currentTimeMillis();
String com = "SELECT JobID, Predictions FROM ProteinRow WHERE Protein = '" + queryProtein + "';";
System.out.println("Command: " + com);
List<Row> rows = results.all();
System.out.println("Query time is " + (queryTime - startTime) + " msec");
System.out.println(" rows analysed, " + rows.size());
- List<StructureProteinPrediction> res = new ArrayList<StructureProteinPrediction>();
+ List<AnnotatedProteinSequenceBean> res = new ArrayList<AnnotatedProteinSequenceBean>();
int c = 0;
for (Row r : rows) {
- StructureProteinPrediction structure = new StructureProteinPrediction(queryProtein, r.getString("JobID"), r.getMap(
+ AnnotatedProteinSequenceBean structure = new AnnotatedProteinSequenceBean(queryProtein, r.getString("JobID"), r.getMap(
"Predictions", String.class, String.class));
res.add(structure);
++c;
/*
* getting part of protein sequence from the db ProteinRow
*/
- public List<StructureProteinPrediction> ReadPartOfSequence(String queryProtein) {
+ public List<AnnotatedProteinSequenceBean> ReadPartOfSequence(String queryProtein) {
final long startTime = System.currentTimeMillis();
String com = "SELECT * FROM ProteinRow;";
System.out.println("Command: " + com);
List<Row> rows = results.all();
System.out.println("Query time is " + (queryTime - startTime) + " msec");
System.out.println(" rows analysed, " + rows.size());
- List<StructureProteinPrediction> res = new ArrayList<StructureProteinPrediction>();
+ List<AnnotatedProteinSequenceBean> res = new ArrayList<AnnotatedProteinSequenceBean>();
int c = 0;
for (Row r : rows) {
String prot = r.getString("Protein");
if (prot.matches("(.*)" + queryProtein + "(.*)")) {
- StructureProteinPrediction structure = new StructureProteinPrediction(prot, r.getString("JobID"), r.getMap("Predictions",
+ AnnotatedProteinSequenceBean structure = new AnnotatedProteinSequenceBean(prot, r.getString("JobID"), r.getMap("Predictions",
String.class, String.class));
res.add(structure);
++c;
public class DataBase {
private String date;
- private int total; // total jobs
- private int totalOK; // total jobs with execution status OK
- private int totalStopped; // total jobs with execution status STOPPED
- private int totalError; // total jobs with execution status Jpred ERROR
- private int totalTimeOut; // total jobs with execution status TIMEOUT
+ private int total; // total number of jobs
+ private int totalOK; // number of jobs with execution status OK
+ private int totalStopped; // number of jobs with execution status STOPPED
+ private int totalError; // number of jobs with execution status Jpred ERROR
+ private int totalTimeOut; // number of jobs with execution status TIMEOUT
private int totalJobs;
- private int totalId; // total jobs for current protein sequence
+ private int totalId; // total jobs for current protein sequence
private String id;
private String prot; // protein sequence
private String jpred;
private List<Integer> timeRez;
private List<Integer> timeTotalExec;
private StructureJobLog logInfo;
-
+ private AnnotatedProteinSequenceBean predictions;
public DataBase() {
}
public StructureJobLog getLogInfo() {
return logInfo;
}
+
+ public void setPredictions(AnnotatedProteinSequenceBean predictions){
+ this.predictions = predictions;
+ }
+
+ public AnnotatedProteinSequenceBean getPredictions() {
+ return predictions;
+ }
}
+++ /dev/null
-package compbio.cassandra;
-
-import java.util.Map;
-
-public class StructureProteinPrediction {
- private String sequence;
- private String jobid;
- private Map<String,String> prediction;
-
- public StructureProteinPrediction (String seq, String id, Map<String,String> pred) {
- this.sequence = seq;
- this.jobid = id;
- this.prediction = pred;
- }
-
- public String getSequence () {
- return sequence;
- }
-
- public String getJobid () {
- return jobid;
- }
-
- public Map<String,String> getPrediction () {
- return prediction;
- }
-
-}
package compbio.listeners;
import java.io.IOException;
+import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import compbio.cassandra.DataBase;
import compbio.statistic.CassandraRequester;
import compbio.statistic.StatisticsProt;
int counter = Integer.parseInt(request.getParameter("counterJob"));
CassandraRequester cr = new CassandraRequester();
if (search.equals("Search counter")) {
- request.setAttribute("result", cr.readProteinByCounter(counter));
+ List<DataBase> r = cr.readProteinByCounter(counter);
+ request.setAttribute("results", r);
+ System.out.println ("Search counter: " + r.size() + " proteins found");
} else {
- request.setAttribute("result", cr.readProteins(prot, flag));
+ List<DataBase> r = cr.readProteins(prot, flag);
+ request.setAttribute("results", r);
+ System.out.println ("Search sequence: " + r.size() + " proteins found");
}
final long endTime = System.currentTimeMillis();
request.setAttribute("timeExecution", (endTime - startTime));
import java.util.List;
import java.util.Map;
+import compbio.cassandra.AnnotatedProteinSequenceBean;
import compbio.cassandra.CassandraNativeConnector;
import compbio.cassandra.CassandraReader;
import compbio.cassandra.DataBase;
import compbio.cassandra.Pair;
import compbio.cassandra.StructureJobLog;
-import compbio.cassandra.StructureProteinPrediction;
public class CassandraRequester {
private CassandraReader db = new CassandraReader();
System.out.println("StatisticsProt.readLength: total number of dates = " + query.size());
return query;
}
+
/*
* query: protein sequence
* */
public List<DataBase> readProteins(String protIn, String flag) {
query = new ArrayList<DataBase>();
- List<StructureProteinPrediction> res;
+ List<AnnotatedProteinSequenceBean> res;
if (flag.equals("whole"))
res = db.ReadWholeSequence(protIn);
else
res = db.ReadPartOfSequence(protIn);
if (res == null)
return null;
- for (StructureProteinPrediction entry : res) {
- Map<String,String> pred = entry.getPrediction();
- Iterator it = pred.entrySet().iterator();
- while (it.hasNext()) {
- DataBase db = new DataBase();
- db.setProt(entry.getSequence());
- Map.Entry pairs = (Map.Entry)it.next();
- db.setId(entry.getJobid());
- db.setJpred(pairs.getValue().toString());
- if (flag.equals("part"))
- db.setSubProt(CreateSubprot (entry.getSequence(), protIn));
- query.add(db);
+ for (AnnotatedProteinSequenceBean entry : res) {
+ DataBase db = new DataBase();
+ db.setProt(entry.getSequence());
+ db.setPredictions(entry);
+ db.setId(entry.getJobid());
+ if (flag.equals("part")) {
+ db.setSubProt(CreateSubprot (entry.getSequence(), protIn));
}
+ query.add(db);
}
return query;
}
-
+
/*
* query protein sequences with number of jobs
*/
<%@page import="java.util.ArrayList"%>
-<%@ page trimDirectiveWhitespaces="true"%>
<%@ 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"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="dt"%>
+
<c:choose>
<c:when test="${search == 'Search counter'}">
- <h3>Dundee ProteoCache query result for jobs more than ${counter} </h3>
+ <h3>Dundee ProteoCache query results for jobs more than ${counter} </h3>
</c:when>
<c:otherwise>
- <h3>Dundee ProteoCache query result</h3>
+ <h3>Dundee ProteoCache query results</h3>
</c:otherwise>
</c:choose>
<h3>Time execution: ${timeExecution} ms</h3>
<c:choose>
- <c:when test="${result == null}">
- <h3>No jobs for sequence ${prot} </h3>
- </c:when>
- <c:otherwise>
-
-
+<c:when test="${results == null}">
+ <h3>No jobs for sequence ${prot} </h3>
+</c:when>
+<c:otherwise>
+
<table border="1" style="border-collapse: collapse; white-space: nowrap">
<c:choose>
+
<c:when test="${search == 'Search counter'}">
<thead>
<tr>
</tr>
</thead>
<tbody>
- <c:forEach items="${result}" var="res">
+ <c:forEach items="${results}" var="res">
<tr>
<td>${res.totalId}</td>
- <td
- style="text-align: left; border-buttom: dotted; font-family: monospace"><a
- title="Click to view predictions"
- href="ServletSequenceProtein?prot=${res.prot}&protein=whole&Search=Search+sequence&counterJob=${counter}">${res.prot}</a>
+ <td style="text-align: left; border-buttom: dotted; font-family: monospace">
+ <a title="Click to view all jobs" href="ServletSequenceProtein?prot=${res.prot}&protein=whole&Search=Search+sequence&counterJob=${counter}">${res.prot}</a>
</td>
</tr>
</c:forEach>
</c:when>
+
<c:otherwise>
<thead>
<tr>
- <th style="text-align: centre">ID</th>
- <th style="text-align: centre">Predictions</th>
+ <th style="text-align: centre">Job ID</th>
+ <th style="text-align: centre">annotation</th>
+ <th style="text-align: centre">Sequence</th>
</tr>
</thead>
<tbody>
- <c:forEach items="${result}" var="res" varStatus="status">
+ <c:forEach items="${results}" var="res" varStatus="status">
+ <c:set var="ann" value="${res.predictions}"/>
<tr>
- <td rowspan="2"><a href="ServletLogInfo?IdJob=${res.id}">${res.id}</a></td>
+ <th rowspan="${ann.mapsize + 2}"><a title="Click to view the job log" href="ServletLogInfo?IdJob=${res.id}">${res.id}</a></th>
+ </tr>
+ <tr>
+ <td style="text-align: center; font-weight: bold; font-family: monospace" >Protein Sequence</td>
+ <!-- <td style="text-align: left; border-buttom: dotted; font-family: monospace"><c:out value="${res.prot}" /></td> -->
<c:if test="${flag == 'whole'}">
- <td
- style="text-align: left; border-buttom: dotted; font-family: monospace"><c:out
- value="${res.prot}" /></td>
+ <td style="text-align: left; border-buttom: dotted; font-family: monospace"><c:out value="${res.prot}" /></td>
</c:if>
<c:if test="${flag == 'part'}">
<td
</td>
</c:if>
</tr>
- <tr>
- <td
- style="text-align: left; border-top: hidden; font-family: monospace"><c:out
- value="${res.jpred}" /></td>
- </tr>
+ <c:forEach items="${ann.predictions}" var="seq" varStatus="status">
+ <tr>
+ <td style="text-align: center; font-weight: bold; font-family: monospace"><c:out value="${seq.key}"/></td>
+ <td style="text-align: left; border-buttom: dotted; font-family: monospace"><c:out value="${seq.value}"/></td>
+ </tr>
+ </c:forEach>
</c:forEach>
</c:otherwise>
</c:choose>
</tbody>
</table>
</c:otherwise>
+
</c:choose>
\ No newline at end of file