From 4458e44cf92e699159ee1257b1bea6300a9abebe Mon Sep 17 00:00:00 2001 From: Sasha Sherstnev Date: Mon, 25 Nov 2013 11:35:01 +0000 Subject: [PATCH] Make all necessary changes for combining old and new servlets --- conf/Proteocache.properties | 3 +- datadb/compbio/cassandra/CassandraReader.java | 5 +-- server/compbio/statistic/CassandraRequester.java | 39 +++++++++++++++++++--- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/conf/Proteocache.properties b/conf/Proteocache.properties index 5ab8858..b1730f4 100644 --- a/conf/Proteocache.properties +++ b/conf/Proteocache.properties @@ -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 diff --git a/datadb/compbio/cassandra/CassandraReader.java b/datadb/compbio/cassandra/CassandraReader.java index 6e3587b..cb2492e 100644 --- a/datadb/compbio/cassandra/CassandraReader.java +++ b/datadb/compbio/cassandra/CassandraReader.java @@ -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; } diff --git a/server/compbio/statistic/CassandraRequester.java b/server/compbio/statistic/CassandraRequester.java index 410a722..72ec074 100755 --- a/server/compbio/statistic/CassandraRequester.java +++ b/server/compbio/statistic/CassandraRequester.java @@ -159,19 +159,49 @@ public class CassandraRequester { return query; } + /* + * query: jobs and sequence at date + */ + public List 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> res = db.ReadProteinData(day); + if (res == null) + return null; + query = new ArrayList(); + for (Pair 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 readProteins(String protIn, String flag) { - if (protIn == null) - return null; - System.out.println(protIn.length()); query = new ArrayList(); List 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 -- 1.7.10.2