+++ /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<AnnotatedProteinSequenceBean> ReadWholeSequence(String queryProtein) {
+ public List<ProteinBean> ReadWholeSequence(String queryProtein) {
final long startTime = System.currentTimeMillis();
String com = "SELECT JobID, Predictions FROM ProteinRow WHERE Protein = '" + queryProtein + "';";
System.out.println("Command: " + com);
return null;
final long queryTime = System.currentTimeMillis();
List<Row> rows = results.all();
+ System.out.println("first size : " + rows.size());
System.out.println("Query time is " + (queryTime - startTime) + " msec");
System.out.println(" rows analysed, " + rows.size());
- List<AnnotatedProteinSequenceBean> res = new ArrayList<AnnotatedProteinSequenceBean>();
+ List<ProteinBean> res = new ArrayList<ProteinBean>();
+ ProteinBean structure = new ProteinBean(queryProtein, rows.get(0).getMap(
+ "Predictions", String.class, String.class));
+ System.out.println("second size : " + rows.size());
int c = 0;
for (Row r : rows) {
- AnnotatedProteinSequenceBean structure = new AnnotatedProteinSequenceBean(queryProtein, r.getString("JobID"), r.getMap(
- "Predictions", String.class, String.class));
- res.add(structure);
+ structure.setJobid(r.getString("JobID"));
++c;
}
+ res.add(structure);
final long endTime = System.currentTimeMillis();
System.out.println(c + " rows analysed, execution time is " + (endTime - startTime) + " msec");
return res;
/*
* getting part of protein sequence from the db ProteinRow
*/
- public List<AnnotatedProteinSequenceBean> ReadPartOfSequence(String queryProtein) {
+ public List<ProteinBean> 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<AnnotatedProteinSequenceBean> res = new ArrayList<AnnotatedProteinSequenceBean>();
+ List<ProteinBean> res = new ArrayList<ProteinBean>();
int c = 0;
for (Row r : rows) {
String prot = r.getString("Protein");
if (prot.matches("(.*)" + queryProtein + "(.*)")) {
- AnnotatedProteinSequenceBean structure = new AnnotatedProteinSequenceBean(prot, r.getString("JobID"), r.getMap("Predictions",
- String.class, String.class));
+ ProteinBean structure = new ProteinBean(prot, r.getMap("Predictions", String.class, String.class));
+ structure.setJobid(r.getString("JobID"));
res.add(structure);
++c;
}
private String ip;
private String prot; // protein sequence
private String jpred;
- private List<String> subProt; // protein sequence divided by several parts for highlighting the particular part
private List<Integer> timeRez;
private List<Integer> timeTotalExec;
private StructureJobLog logInfo;
- private AnnotatedProteinSequenceBean predictions;
+ private ProteinBean predictions;
public DataBase() {
}
return ip;
}
- public void setSubProt(List<String> subProt) {
- this.subProt = subProt;
- }
-
- public List<String> getSubProt() {
- return subProt;
- }
-
public void setTimeRez(List<Integer> timeRez) {
this.timeRez = timeRez;
}
return logInfo;
}
- public void setPredictions(AnnotatedProteinSequenceBean predictions){
+ public void setPredictions(ProteinBean predictions){
this.predictions = predictions;
}
- public AnnotatedProteinSequenceBean getPredictions() {
+ public ProteinBean getPredictions() {
return predictions;
}
--- /dev/null
+package compbio.cassandra;
+
+public interface PredictionIndex {
+
+ /**
+ * Ordering indexes for predictions
+ */
+ public final String[] predIndex = {"jnetpred", "JNETCONF", "JNETHMM", "JNETPSSM", "JNETSOL0", "JNETSOL5",
+ "JNETSOL25", "Lupas_14", "Lupas_21", "Lupas_28"};
+}
--- /dev/null
+package compbio.cassandra;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ProteinBean implements PredictionIndex{
+ private String sequence;
+ private List<String> jobid;
+ private LinkedHashMap<String,String> predictions;
+ private List<String> subProt; // protein sequence divided by several parts for highlighting the particular part
+ private int size;
+
+ public ProteinBean (String seq, Map<String,String> pred) {
+ this.sequence = seq;
+ this.predictions = new LinkedHashMap<String,String>();
+ this.jobid = new ArrayList<String>();
+ setPredictions(pred);
+ }
+
+ public void setPredictions(Map<String,String> pred) {
+ for (String index : predIndex) {
+ this.predictions.put(index, pred.get(index));
+ }
+ this.size = predictions.size();
+ }
+
+ public String getSequence () {
+ return sequence;
+ }
+
+ public List<String> getJobid () {
+ return jobid;
+ }
+
+ public void setJobid (String id) {
+ this.jobid.add(id);
+ }
+
+ public int getSize () {
+ return size;
+ }
+
+ public LinkedHashMap<String,String> getPredictions () {
+ return predictions;
+ }
+
+ public void setSubProt(List<String> subProt) {
+ this.subProt = subProt;
+ }
+
+ public List<String> getSubProt() {
+ return subProt;
+ }
+
+}
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
+import compbio.cassandra.ProteinBean;
import compbio.cassandra.DataBase;
-
import compbio.statistic.CassandraRequester;
/**
if (0 < trimmedsequence.length()) {
CassandraRequester cr = new CassandraRequester();
- List<DataBase> r = cr.readProteins(trimmedsequence, flag);
+ List<ProteinBean> r = cr.readProteins(trimmedsequence, flag);
model.put("results", r);
if (null != r) {
- System.out.println("result size = " + r.size());
- model.put("njobs", r.size());
+ if (flag.equals("whole"))
+ model.put("njobs",r.get(0).getJobid().size());
+ else
+ model.put("njobs", r.size());
}
}
final long endTime = System.currentTimeMillis();
request.setAttribute("results", r);
// System.out.println ("Search counter: " + r.size() + " proteins found");
} else {
- List<DataBase> r = cr.readProteins(prot, flag);
- request.setAttribute("results", r);
+ // 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();
import java.util.List;
import java.util.Map;
-import compbio.cassandra.AnnotatedProteinSequenceBean;
+import compbio.cassandra.ProteinBean;
import compbio.cassandra.CassandraNativeConnector;
import compbio.cassandra.CassandraReader;
import compbio.cassandra.DataBase;
/*
* query: protein sequence
* */
- public List<DataBase> readProteins(String protIn, String flag) {
- query = new ArrayList<DataBase>();
- List<AnnotatedProteinSequenceBean> res;
+ public List<ProteinBean> readProteins(String protIn, String flag) {
+ List<ProteinBean> result;
if (flag.equals("whole"))
- res = db.ReadWholeSequence(protIn);
+ result = db.ReadWholeSequence(protIn);
else
- res = db.ReadPartOfSequence(protIn);
- if (res == null)
+ result = db.ReadPartOfSequence(protIn);
+ if (result == null)
return null;
- 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));
+
+ if (flag.equals("part")) {
+ for (ProteinBean entry : result) {
+ entry.setSubProt(CreateSubprot(entry.getSequence(), protIn));
}
- query.add(db);
- }
- return query;
+ }
+ return result;
}
</thead>
<tbody>
<c:forEach items="${results}" var="res" varStatus="status">
- <c:set var="ann" value="${res.predictions}" />
+ <c:forEach items="${res.jobid}" var="id" varStatus="status">
<tr>
- <th rowspan="${ann.mapsize + 2}"><a
+ <th rowspan="${res.size + 2}"><a
title="Click to view the job log"
- href="${jobquery}?IdJob=${res.id}">${res.id}</a></th>
+ href="${jobquery}?IdJob=${id}">${id}</a></th>
</tr>
<tr>
<td
<c:if test="${flag == 'whole'}">
<td
style="text-align: left; border-buttom: dotted; font-family: monospace"><c:out
- value="${res.prot}" /></td>
+ value="${res.sequence}" /></td>
</c:if>
<c:if test="${flag == 'part'}">
<td
</td>
</c:if>
</tr>
- <c:forEach items="${ann.predictions}" var="seq"
+ <c:forEach items="${res.predictions}" var="seq"
varStatus="status">
<tr>
<td
</tr>
</c:forEach>
</c:forEach>
+ </c:forEach>
</tbody>
</table>
</div>