Merge branch 'servlets'
authorSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Mon, 25 Nov 2013 11:04:31 +0000 (11:04 +0000)
committerSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Mon, 25 Nov 2013 11:04:31 +0000 (11:04 +0000)
Conflicts:
datadb/compbio/cassandra/StructureProteinPrediction.java
server/compbio/statistic/CassandraRequester.java

1  2 
datadb/compbio/cassandra/CassandraReader.java
server/compbio/statistic/CassandraRequester.java

@@@ -84,11 -108,15 +108,15 @@@ public class CassandraReader 
                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));
+                       if (structure.getPrediction().containsKey("jnetpred"))
+                               structure.setJnetpred(structure.getPrediction().get("jnetpred"));
+                       else
+                               structure.setJnetpred("");
                        res.add(structure);
                        ++c;
                }
@@@ -161,23 -194,26 +163,26 @@@ public class CassandraRequester 
         * 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<StructureProteinPrediction> res;
 +              List<AnnotatedProteinSequenceBean> res;
                if (flag.equals("whole")) 
                        res = db.ReadWholeSequence(protIn);
                 else 
-                       res = db.ReadPartOfSequence(protIn);
+                        res = (protIn.length() > 0) ? db.ReadPartOfSequence(protIn) : null;
                if (res == null)
                        return null;
 -              for (StructureProteinPrediction entry : res) {
 -                              DataBase bean = new DataBase();
 -                              bean.setProt(entry.getSequence());
 -                              bean.setId(entry.getJobid());
 -                              bean.setJpred(entry.getJnetpred());
 -                              if (flag.equals("part"))
 -                                      bean.setSubProt(CreateSubprot (entry.getSequence(), protIn));                           
 -                              query.add(bean);
 -                      
 +              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;
        }