Make all necessary changes for combining old and new servlets servlet-based-code
authorSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Mon, 25 Nov 2013 11:35:01 +0000 (11:35 +0000)
committerSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Mon, 25 Nov 2013 11:35:01 +0000 (11:35 +0000)
conf/Proteocache.properties
datadb/compbio/cassandra/CassandraReader.java
server/compbio/statistic/CassandraRequester.java

index 5ab8858..b1730f4 100644 (file)
@@ -1,9 +1,8 @@
 #################################################################################
 # Cassandra host or IP
 # test server is 10.0.115.190
-#cassandra.host=localhost
-#cassandra.host=10.31.0.97
 cassandra.host=localhost
+#cassandra.host=gjb-www-1.cluster.lifesci.dundee.ac.uk
 
 cassandra.newtables.update=false
 
index 6e3587b..cb2492e 100644 (file)
@@ -94,6 +94,7 @@ public class CassandraReader {
                }
                return res;
        }
+
        /*
         * getting whole protein sequence from the db ProteinRow
         */
@@ -113,10 +114,6 @@ public class CassandraReader {
                for (Row r : rows) {
                        AnnotatedProteinSequenceBean structure = new AnnotatedProteinSequenceBean(queryProtein, r.getString("JobID"), r.getMap(
                                        "Predictions", String.class, String.class));
-                       if (structure.getPrediction().containsKey("jnetpred"))
-                               structure.setJnetpred(structure.getPrediction().get("jnetpred"));
-                       else
-                               structure.setJnetpred("");
                        res.add(structure);
                        ++c;
                }
index 410a722..72ec074 100755 (executable)
@@ -159,19 +159,49 @@ public class CassandraRequester {
                return query;
        }
 
+       /*
+        * query: jobs and sequence at date
+        */
+       public List<DataBase> readJobByDay (String date) {
+               System.out.println(date);
+               if (null == date) {
+                       return null;
+               }
+               if (!isThisDateValid(date, formatDDMMYY)) {
+                       System.out.println("Wrong date: point 3");
+                       return null;
+               }
+               SetDateRange();
+               long day = DateParsing(date, formatDDMMYY);
+               System.out.println(day);
+               if (day < earlestDate || day > currentDate)
+                       return null;    
+               List<Pair<String, String>>      res = db.ReadProteinData(day);
+               if (res == null)
+                       return null;
+               query = new ArrayList<DataBase>();
+               for (Pair<String, String> entry : res) {                
+                       DataBase bean = new DataBase();
+                       bean.setDate(date);
+                       bean.setId(entry.getElement0());
+                       bean.setProt(entry.getElement1());
+                       query.add(bean);
+               }
+               System.out.println("StatisticsProt.readLength: total number of dates = " + query.size());
+               return query;
+       }
+
+
        /* 
         * query: protein sequence
         * */
        public List<DataBase> readProteins(String protIn, String flag) {
-               if (protIn == null)
-                       return null;
-               System.out.println(protIn.length());
                query = new ArrayList<DataBase>();
                List<AnnotatedProteinSequenceBean> res;
                if (flag.equals("whole")) 
                        res = db.ReadWholeSequence(protIn);
                 else 
-                        res = (protIn.length() > 0) ? db.ReadPartOfSequence(protIn) : null;
+                       res = db.ReadPartOfSequence(protIn);
                if (res == null)
                        return null;
                for (AnnotatedProteinSequenceBean entry : res) {
@@ -186,6 +216,7 @@ public class CassandraRequester {
                }
                return query;
        }
+       
 
        /* 
         * query protein sequences with number of jobs