Merge branch 'DAO'
authorSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Thu, 23 Jan 2014 14:33:17 +0000 (14:33 +0000)
committerSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Thu, 23 Jan 2014 14:33:17 +0000 (14:33 +0000)
Conflicts:
server/compbio/controllers/JobController.java

15 files changed:
datadb/compbio/beans/JobBean.java
datadb/compbio/beans/ProteinBean.java
datadb/compbio/cassandra/CassandraNativeConnector.java
datadb/compbio/cassandra/CassandraNewTableWriter.java
datadb/compbio/cassandra/CassandraReaderOld.java
datadb/compbio/cassandra/readers/JobReader.java
datadb/compbio/cassandra/readers/SequenceReader.java
server/compbio/controllers/JobController.java
server/compbio/controllers/SSFeaturesController.java
server/compbio/controllers/SequenceController.java
webapp/view/query/Sequence.jsp
webapp/view/reports/Job.jsp
webapp/view/reports/SSFeatures.jsp
webapp/view/reports/Sequences.jsp
webapp/view/reports/SequencesStatistics.jsp

index ec1f030..5a499c2 100644 (file)
@@ -13,16 +13,18 @@ public class JobBean implements PredictionIndex {
        private String ip;
        private String ProgramName;
        private String ProgramVersion;
+       private String ProgramLink;
        private LinkedHashMap<String, String> predictions;
 
-       public JobBean(String seq, String id, String dateStart, String dateEnd, String ip, Map<String, String> pred, String program, String version) {
+       public JobBean(String seq, String id, String dateStart, String dateEnd, String ip, Map<String, String> pred) {
                this.sequence = seq;
-               this.ProgramName = program;
-               this.ProgramVersion = version;
+               this.ProgramName = "";
+               this.ProgramVersion = "";
                this.jobid = id;
                this.dateStart = dateStart;
                this.dateEnd = dateEnd;
                this.ip = ip;
+               this.ProgramLink = "";
                this.predictions = new LinkedHashMap<String, String>();
                setPredictions(pred);
        }
@@ -63,6 +65,22 @@ public class JobBean implements PredictionIndex {
                return ProgramVersion;
        }
 
+       public String getProgramLink() {
+               return ProgramLink;
+       }
+
+       public void setProgramName(String name) {
+               ProgramName = name;
+       }
+       
+       public void setProgramVersion(String version) {
+               ProgramVersion = version;
+       }
+       
+       public void setProgramLink(String link) {
+               ProgramLink = link;
+       }
+       
        public Map<String, String> getPrediction() {
                return predictions;
        }
index c649320..958eab5 100644 (file)
@@ -21,6 +21,7 @@ public class ProteinBean implements PredictionIndex {
                this.predictions = new LinkedHashMap<String, String>();
                this.jobid = new ArrayList<String>();
                setPredictions(pred);
+               setJnetpred(pred);
        }
 
        public void setSequence(String seq) {
index bb807c1..f02000c 100644 (file)
@@ -88,8 +88,11 @@ public class CassandraNativeConnector {
                session.execute("CREATE TABLE IF NOT EXISTS JobDateInfo "
                                + "(jobday bigint, Total bigint,  TotalOK bigint, TotalStopped bigint, TotalError bigint, TotalTimeOut bigint, Program varchar, Version varchar, PRIMARY KEY(jobday));");
 
-               String com = "CREATE TABLE IF NOT EXISTS Users "
-                               + "(name varchar, id bigint, email varchar, password varchar, organisation varchar, position varchar, signedtolist boolean, registrationdate bigint, PRIMARY KEY(id));";
+               session.execute("CREATE TABLE IF NOT EXISTS Programs "
+                               + "(Program varchar, Version varchar, Description varchar, weblink varchar, PRIMARY KEY(Program,Version));");
+
+               session.execute("CREATE TABLE IF NOT EXISTS Users "
+                               + "(name varchar, id bigint, email varchar, password varchar, organisation varchar, position varchar, signedtolist boolean, registrationdate bigint, PRIMARY KEY(id));");
 
                // session.execute("ALTER TABLE ProteinLog ADD ProgramName ascii;");
                // session.execute("ALTER TABLE ProteinLog ADD ProgramVersion ascii;");
index b4e9746..4ee10c8 100644 (file)
@@ -59,7 +59,7 @@ public class CassandraNewTableWriter {
                Calendar endcal = Calendar.getInstance();
                long endTime = endcal.getTime().getTime();
                for (Date date = runnicCal.getTime(); date.getTime() < endTime; runnicCal.add(Calendar.DATE, 1), date = runnicCal.getTime()) {
-                       try {                           
+                       try {
                                String com = "SELECT JobID, Protein FROM ProteinData WHERE jobtime = " + date.getTime() + ";";
                                System.out.println(com);
                                ResultSet results = session.execute(com);
@@ -67,12 +67,11 @@ public class CassandraNewTableWriter {
                                        continue;
                                List<Row> rows = results.all();
                                System.out.println(rows.size());
-                               int k=0;
                                for (Row r : rows) {
                                        session.execute("UPDATE  ProteinLog SET ProgramName = 'Jpred', ProgramVersion = '3.0.1' WHERE JobID = '"
                                                        + r.getString("JobID") + "';");
                                        session.execute("UPDATE  JpredArchive SET ProgramName = 'Jpred', ProgramVersion = '3.0.1' WHERE JobID = '"
-                                                       + r.getString("JobID") + "';");                         
+                                                       + r.getString("JobID") + "';");
                                }
                        } catch (QueryExecutionException e) {
                                e.printStackTrace();
index e08b39c..ff37145 100644 (file)
@@ -314,8 +314,13 @@ public class CassandraReaderOld {
                        return null;
                Row row1 = results1.one();
                JobBean res = new JobBean(row.getString("Protein"), row.getString("JobID"), row.getString("DataBegin"), row.getString("DataEnd"),
-                               row.getString("ip"), row1.getMap("Predictions", String.class, String.class), row.getString("ProgramName"),
-                               row.getString("ProgramVersion"));
+                               row.getString("ip"), row1.getMap("Predictions", String.class, String.class));
+               String program = row.getString("ProgramName");
+               String version = row.getString("ProgramVersion");
+               if (null != program && null != version) {
+                       res.setProgramName(program);
+                       res.setProgramVersion(version);
+               }
                System.out.println("Query time is " + (queryTime - startTime) + " msec");
                final long endTime = System.currentTimeMillis();
                System.out.println(" rows analysed, execution time is " + (endTime - startTime) + " msec");
index a525a56..26a40e6 100644 (file)
@@ -23,14 +23,30 @@ public class JobReader extends CassandraReader {
                ResultSet results = CassandraQuery("SELECT * FROM ProteinLog WHERE JobID = '" + jobid + "';");
                if (results.isExhausted())
                        return null;
-               Row row = results.one();
+               Row row1 = results.one();
                ResultSet results1 = CassandraQuery("SELECT * FROM ProteinRow WHERE JobID = '" + jobid + "' ALLOW FILTERING;");
                if (results1.isExhausted())
                        return null;
-               Row row1 = results1.one();
-               JobBean res = new JobBean(row.getString("Protein"), row.getString("JobID"), row.getString("DataBegin"), row.getString("DataEnd"),
-                               row.getString("ip"), row1.getMap("Predictions", String.class, String.class), row.getString("ProgramName"),
-                               row.getString("ProgramVersion"));
+               Row row2 = results1.one();
+               String program = row1.getString("ProgramName");
+               String version = row1.getString("ProgramVersion");
+               JobBean res = new JobBean(row1.getString("Protein"), row1.getString("JobID"), row1.getString("DataBegin"),
+                               row1.getString("DataEnd"), row1.getString("ip"), row2.getMap("Predictions", String.class, String.class));
+
+               if (null != program && null != version) {
+                       res.setProgramName(program);
+                       res.setProgramVersion(version);
+                       ResultSet results3 = CassandraQuery("SELECT * FROM Programs WHERE Program = '" + program + "' and Version = '" + version
+                                       + "' ALLOW FILTERING;");
+                       if (results3.isExhausted())
+                               return null;
+                       Row row3 = results3.one();
+                       String link = row3.getString("weblink");
+                       if (null != link) {
+                               res.setProgramLink(link);
+                       }
+               }
+
                return res;
        }
 }
index 0aedbb2..7e77126 100644 (file)
@@ -8,6 +8,16 @@ import com.datastax.driver.core.Row;
 
 import compbio.beans.ProteinBean;
 
+/**
+ * Reader class for making requests on protein sequences to cassandra.
+ * 
+ * @author Alexander Sherstnev
+ * @author Natasha Sherstneva
+ * 
+ * @since 0.5
+ * @version 1.0 
+ * @since December 2013
+ */
 public class SequenceReader extends CassandraReader {
 
        public SequenceReader() {
@@ -17,7 +27,7 @@ public class SequenceReader extends CassandraReader {
        /**
         * query: protein sequence
         * 
-        * @param protIn
+        * @param sequence
         *            protein sequence or partial of protein sequence
         * @param searchtype
         *            "whole" or "partial" of protein sequence
@@ -25,35 +35,35 @@ public class SequenceReader extends CassandraReader {
         * @return List<ProteinBean> to the controller SequenceController
         * 
         **/
-       public List<ProteinBean> readProteins(String protIn, String searchtype) {
+       public List<ProteinBean> readProteins(String sequence, String searchtype) {
                List<ProteinBean> query = new ArrayList<ProteinBean>();
                if (searchtype.equals("whole")) {
-                       ResultSet results = CassandraQuery("SELECT  JobID, Predictions FROM ProteinRow WHERE Protein = '" + protIn + "';");
+                       ResultSet results = CassandraQuery("SELECT JobID, Predictions FROM ProteinRow WHERE Protein = '" + sequence + "';");
                        if (results.isExhausted())
                                return null;
                        List<Row> rows = results.all();
-                       ProteinBean structure = new ProteinBean(protIn, rows.get(0).getMap("Predictions", String.class, String.class));
+                       ProteinBean structure = new ProteinBean(sequence, rows.get(0).getMap("Predictions", String.class, String.class));
                        for (Row r : rows) {
                                structure.setJobid(r.getString("JobID"));
                        }
                        query.add(structure);
                } else {
-                       ResultSet results = CassandraQuery("SELECT  * FROM ProteinRow;");
+                       ResultSet results = CassandraQuery("SELECT * FROM ProteinRow;");
                        if (results.isExhausted())
                                return null;
                        List<Row> rows = results.all();
                        for (Row r : rows) {
-                               String prot = r.getString("Protein");
-                               if (prot.matches("(.*)" + protIn + "(.*)")) {
-                                       ProteinBean structure = new ProteinBean(prot, r.getMap("Predictions", String.class, String.class));
-                                       structure.setJobid(r.getString("JobID"));
-                                       query.add(structure);
+                               String protein = r.getString("Protein");
+                               if (protein.matches("(.*)" + sequence + "(.*)")) {
+                                       ProteinBean foundsequence = new ProteinBean(protein, r.getMap("Predictions", String.class, String.class));
+                                       foundsequence.setJobid(r.getString("JobID"));
+                                       query.add(foundsequence);
                                }
                        }
                }
                if (searchtype.equals("partial")) {
                        for (ProteinBean entry : query) {
-                               entry.setSubProt(CreateSubprotein(entry.getSequence(), protIn));
+                               entry.setSubProt(CreateSubprotein(entry.getSequence(), sequence));
                        }
                }
                return query;
index ff834bd..0dd39f8 100644 (file)
@@ -4,10 +4,8 @@ import java.io.IOException;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.log4j.Logger;
@@ -19,23 +17,22 @@ import org.springframework.web.bind.annotation.RequestParam;
 import compbio.statistic.CassandraRequester;
 import compbio.beans.DateBean;
 import compbio.beans.ExecutionTimeBean;
-import compbio.beans.Total;
 import compbio.beans.TotalExecutionTime;
-import compbio.beans.TotalJobsStatisticBean;
-import compbio.cassandra.DataBase;
 import compbio.cassandra.DateFormatter;
 import compbio.cassandra.readers.CassandraReader;
-import compbio.cassandra.readers.DailyStatisticsReader;
 import compbio.cassandra.readers.ExecutionTimeReader;
 import compbio.cassandra.readers.JobReader;
 import compbio.engine.ExecutionInterval;
-import compbio.engine.JobStatus;
 import compbio.engine.archive.ArchivedJob;
 
 /**
+ * Spring controller for supporting job queries. This version works in the
+ * servlet style.
+ * 
  * @author Alexander Sherstnev
  * @author Natasha Sherstneva
- * @version 1.0 Dec 2013
+ * @version 1.0
+ * @since Dec 2013
  */
 @Controller
 public class JobController extends BasicController {
@@ -84,22 +81,28 @@ public class JobController extends BasicController {
        /**
         * form a report page for a job execution time statistics.
         * 
+        * @param date1
+        *            initial date for requested statistics
+        * @param date2
+        *            final date for requested statistics
+        * @param alldates
+        *            All available jobs are analyzed if alldates="AllDates,off"
         * @param model
         *            MVC model
         * @return link to the JSP query page
         */
        @RequestMapping(value = "/stat/exectime/results", method = RequestMethod.GET)
        public String findExecTimeData(@RequestParam("date1") String date1, @RequestParam("date2") String date2,
-                       @RequestParam(value = "option", required = false) String option, Map<String, Object> model) {
+                       @RequestParam(value = "option", required = false) String alldates, Map<String, Object> model) {
                model.put("username", getPrincipalName());
                final long startTime = System.currentTimeMillis();
                Calendar loccal = Calendar.getInstance();
                ExecutionTimeReader reader = new ExecutionTimeReader();
-               if (option.equals("AllDates,off")) {
+               if (alldates.equals("AllDates,off")) {
                        date1 = theEaerlistDate;
                        date2 = theCurrentDate;
                }
-               
+
                // dates in string format
                String trimmeddate1 = date1.replaceAll("\\s", "");
                String trimmeddate2 = date2.replaceAll("\\s", "");
@@ -113,7 +116,7 @@ public class JobController extends BasicController {
                        model.put("date2", date2);
                        return "query/JobTimeExecution";
                }
-               
+
                if (longDate1 < CassandraReader.earliestDate())
                        longDate1 = CassandraReader.earliestDate();
                if (longDate2 > loccal.getTimeInMillis())
@@ -123,20 +126,21 @@ public class JobController extends BasicController {
                date2 = DateFormatter.DateLongToString(longDate2, formaterYYMMDD);
                model.put("date1", date1);
                model.put("date2", date2);
-               model.put("option", option);
-               ExecutionTimeBean res = reader.query(longDate1, longDate2);;
+               model.put("option", alldates);
+               ExecutionTimeBean res = reader.query(longDate1, longDate2);
+               ;
                model.put("result", res);
                Map<String, TotalExecutionTime> results = res.getDateTotal();
-               String csvline = "";
+               StringBuilder csvline = new StringBuilder("");
                if (0 < res.getDateTotal().size()) {
-                       csvline = "\'Date\',\'Total\',\'0-30 sec\',\'30-60 sec\',\'1-2 min\',\'2-10 min\',\'more 10 min\'%0A";
+                       csvline.append("\'Date\',\'Total\',\'0-30 sec\',\'30-60 sec\',\'1-2 min\',\'2-10 min\',\'more 10 min\'%0A");
                        for (Map.Entry<String, TotalExecutionTime> entry : results.entrySet()) {
-                               csvline += "\'" + entry.getKey() + "\',\'" + entry.getValue().getTotal() + "\',\'" + entry.getValue().getTotal0_30s() + "\',\'"
-                                               + entry.getValue().getTotal30_60s() + "\',\'" + entry.getValue().getTotal1_2m() + "\',\'"
-                                               + entry.getValue().getTotal2_10m() + "\',\'" + entry.getValue().getTotal10m() + "\'%0A";
+                               csvline.append("\'" + entry.getKey() + "\',\'" + entry.getValue().getTotal() + "\',\'" + entry.getValue().getTotal0_30s()
+                                               + "\',\'" + entry.getValue().getTotal30_60s() + "\',\'" + entry.getValue().getTotal1_2m() + "\',\'"
+                                               + entry.getValue().getTotal2_10m() + "\',\'" + entry.getValue().getTotal10m() + "\'%0A");
                        }
                }
-               model.put("csvfile", csvline);
+               model.put("csvfile", csvline.toString());
                model.put("ndays", res.getDateTotal().size() - 1);
                final long endTime = System.currentTimeMillis();
                model.put("timeExecution", (endTime - startTime));
@@ -177,7 +181,6 @@ public class JobController extends BasicController {
                if (null == ExecutionInterval.getExecutionInterval(interval)) 
                        return "support/Notimplemented";
 
-
                ExecutionTimeReader reader = new ExecutionTimeReader();
                // IMPORTANT: input should be suppied in the format: DD/MM/YYYY
                DateBean r = reader.readJobByDay(thetime, realdate, ExecutionInterval.getBoundsInterval(interval));
@@ -192,11 +195,13 @@ public class JobController extends BasicController {
        }
 
        /**
-        * form a query page for a job. The servlet should no be visible to users at
-        * all.
+        * form result page for one job with a given job ID.
         * 
+        * @param jobid
+        *            job ID
         * @param model
         *            MVC model
+        * 
         * @return link to the JSP query page
         * @throws IOException
         */
@@ -210,6 +215,7 @@ public class JobController extends BasicController {
                model.put("timeExecution", (endTime - startTime));
                model.put("IdJob", jobid);
 
+               // prepare archive file for the job for downloading
                ArchivedJob aj = new ArchivedJob(jobid);
                try {
                        model.put("jobarchive", aj.prepareJobArchiveToWeb());
@@ -227,18 +233,4 @@ public class JobController extends BasicController {
                return "reports/Job";
        }
 
-       /**
-        * convert date from the standard long representation (milliseconds from 1
-        * Jan 1970) to yyyy/mm/dd
-        * 
-        * @param indate
-        *            date in milliseconds from 1 Jan 1970
-        * @return date in the form of yyyy/mm/dd
-        */
-       private String DateFormatYYMMDD(long indate) {
-               SimpleDateFormat datformat = new SimpleDateFormat("yyyy/MM/dd");
-               String dateString = datformat.format(new Date(indate));
-               return dateString;
-       }
-
 }
index 34eed80..3c66361 100644 (file)
@@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.RequestParam;
 import compbio.statistic.CassandraRequester;
 
 /**
- * Spring controller for sequence queries. This version works in the servlet
- * style.
+ * Spring controller for protein secondary structure features. This version
+ * works in the servlet style.
  * 
  * @author Alexander Sherstnev
  * @author Natasha Sherstneva
@@ -23,6 +23,15 @@ import compbio.statistic.CassandraRequester;
 @RequestMapping("/features")
 public class SSFeaturesController extends BasicController {
 
+       /**
+        * form a query page for protein secondary structure feaatures: Proteins
+        * with given fraction of H/E (helix/beta sheets)
+        * 
+        * @param model
+        *            MVC model object
+        * 
+        * @return link to the report JSP page
+        */
        @RequestMapping(value = "query", method = RequestMethod.GET)
        public String formCounterQuery(Map<String, Object> model) {
                model.put("username", getPrincipalName());
@@ -31,6 +40,21 @@ public class SSFeaturesController extends BasicController {
                return "query/SSFeatures";
        }
 
+       /**
+        * form a results page for protein secondary structure features: Proteins
+        * with given fraction of H/E (helix/beta sheets) All proteins with E/H
+        * higher than a given percent of the length are returned
+        * 
+        * @param model
+        *            MVC model object
+        * @param typeFeature
+        *            type of SS: H/E (helix/beta sheets)
+        * @param percent
+        *            fraction of the protein length predicted as H/E (helix/beta
+        *            sheets)
+        * 
+        * @return link to the report JSP page
+        */
        @RequestMapping(value = "results", method = RequestMethod.GET)
        public String countSequences(@RequestParam("TypeFeatures") String typeFeature, @RequestParam("Percent") String percent,
                        Map<String, Object> model) {
@@ -69,19 +93,19 @@ public class SSFeaturesController extends BasicController {
                Map<String, String> r = cr.readProteinsPrediction(typeFeature, realpercent);
                model.put("results", r);
                model.put("njobs", 0);
-               String csvline = "";
+               StringBuilder csvline = new StringBuilder("");
                if (null != r) {
                        model.put("njobs", r.size());
-                       csvline = "\'Prediction%20number\',\'Protein%20Sequence\', \'Secondary%20Structure%20Prediction\'%0A";
-               }
+                       csvline.append("\'Prediction%20number\',\'Protein%20Sequence\', \'Secondary%20Structure%20Prediction\'%0A");
 
-               // form line for CSV file
-               int counter = 1;
-               for (Map.Entry<String, String> entry : r.entrySet()) {
-                       csvline += "\'" + counter + "\',\'" + entry.getKey() + "\',\'" + entry.getValue() + "\'%0A";
-                       ++counter;
+                       // form line for CSV file
+                       int counter = 1;
+                       for (Map.Entry<String, String> entry : r.entrySet()) {
+                               csvline.append("\'" + counter + "\',\'" + entry.getKey() + "\',\'" + entry.getValue() + "\'%0A");
+                               ++counter;
+                       }
                }
-               model.put("csvfile", csvline);
+               model.put("csvfile", csvline.toString());
 
                final long endTime = System.currentTimeMillis();
                model.put("timeExecution", (endTime - startTime));
index 9e92273..76b5e20 100644 (file)
@@ -16,8 +16,8 @@ import compbio.cassandra.readers.ReaderByCounter;
 import compbio.cassandra.readers.SequenceReader;
 
 /**
- * Spring controller for sequence queries. This version works in the servlet
- * style.
+ * Spring controller for supporting sequence queries. This version works in the
+ * servlet style.
  * 
  * @author Alexander Sherstnev
  * @author Natasha Sherstneva
@@ -76,7 +76,7 @@ public class SequenceController extends BasicController {
         *            be searched
         * @return link to the report JSP page
         */
-       @RequestMapping(value = "sequence/results", method = RequestMethod.GET)
+       @RequestMapping(value = "results", method = RequestMethod.GET)
        public String findSequence(@RequestParam("sequence") String sequence, @RequestParam("searchtype") String searchtype,
                        Map<String, Object> model) {
                model.put("username", getPrincipalName());
@@ -98,32 +98,37 @@ public class SequenceController extends BasicController {
                model.put("njobs", 0);
                model.put("prot", trimmedsequence);
                model.put("searchtype", searchtype);
-               String csvline = "";
+               StringBuilder csvline = new StringBuilder("");
                if (0 < trimmedsequence.length()) {
                        SequenceReader reader = new SequenceReader();
                        List<ProteinBean> result = reader.readProteins(trimmedsequence, searchtype);
                        model.put("results", result);
                        if (null != result) {
-                               if (searchtype.equals("whole"))
+                               if (searchtype.equals("whole")) {
                                        model.put("njobs", result.get(0).getJobid().size());
-                               else
+                               } else {
                                        model.put("njobs", result.size());
-                               csvline = "\'Job\',\'Annotation\',\'Sequence\'%0A";
-                               // form CSV file string
+                               }
+                               csvline.append("\'Job\',\'Annotation\',\'Sequence\'%0A");
                                for (ProteinBean entry : result) {
                                        List<String> jobs = entry.getJobid();
                                        String protein = entry.getSequence();
                                        LinkedHashMap<String, String> predictions = entry.getPredictions();
+                                       StringBuilder jobline = new StringBuilder();
+                                       for (Map.Entry<String, String> pr : predictions.entrySet()) {
+                                               jobline.append("\'\',\'" + pr.getKey() + "\',\'" + pr.getValue() + "\'%0A");
+                                       }
                                        for (String job : jobs) {
-                                               csvline += "\'" + job + "\',\'Sequence\',\'" + protein + "\',\'%0A";
-                                               for (Map.Entry<String, String> pr : predictions.entrySet()) {
-                                                       csvline += "\'\',\'" + pr.getKey() + "\',\'" + pr.getValue() + "\'%0A";
-                                               }
+                                               csvline.append("\'" + job + "\',\'Sequence\',\'" + protein + "\',\'%0A" + jobline.toString());
                                        }
                                }
                        }
+               } else {
+                       model.put("error", "The sequence after trimming is empty");
+                       model.put("value", sequence);
+                       return "query/Sequence";
                }
-               model.put("csvfile", csvline);
+               model.put("csvfile", csvline.toString());
 
                final long endTime = System.currentTimeMillis();
                model.put("timeExecution", (endTime - startTime));
@@ -169,24 +174,23 @@ public class SequenceController extends BasicController {
                List<TotalByCounterBean> r = reader.readProteinByCounter(realcounter);
                model.put("results", r);
                model.put("njobs", 0);
-               String csvline = "";
+               StringBuilder csvline = new StringBuilder("");
                if (null != r) {
                        model.put("njobs", r.size());
-                       csvline = "\'Job%20 count\', \'Protein%20Sequence\'%0A";
-               }
-               // form line for CSV file
-
-               for (TotalByCounterBean b : r) {
-                       if (b.getName().equals("")) {
-                               csvline += "\'" + b.getTotaljobs() + "\',\'Alignment%20job\'%0A";
-                               // fix problem with records without protein sequence (alignment
-                               // jobs)
-                               b.setName("Alignment job");
-                       } else {
-                               csvline += "\'" + b.getTotaljobs() + "\',\'" + b.getName() + "\'%0A";
+                       // form line for CSV file
+                       csvline.append("\'Job%20 count\', \'Protein%20Sequence\'%0A");
+                       for (TotalByCounterBean b : r) {
+                               if (b.getName().equals("")) {
+                                       // fix problem with records without protein sequence
+                                       // (alignment jobs)
+                                       csvline.append("\'" + b.getTotaljobs() + "\',\'Alignment%20job\'%0A");
+                                       b.setName("Alignment job");
+                               } else {
+                                       csvline.append("\'" + b.getTotaljobs() + "\',\'" + b.getName() + "\'%0A");
+                               }
                        }
                }
-               model.put("csvfile", csvline);
+               model.put("csvfile", csvline.toString());
 
                model.put("results", r);
                final long endTime = System.currentTimeMillis();
index e9cff65..18d50a7 100644 (file)
@@ -11,7 +11,7 @@
 <body>
        <div class="container">
        <jsp:include page="../fragments/mainmenu.jsp" />
-       <spring:url value="/sequence/sequence/results" var="query"/>
+       <spring:url value="/sequence/results" var="query"/>
 
        <div class="panel panel-default">
                <div class="panel-heading">
index 2dd4e82..03be890 100644 (file)
                <div class="panel-body">
                        <p>Start timestamp : ${result.dateStart}</p>
                        <p>End timestamp : ${result.dateEnd}</p>
-                       <c:if test='${jobarchive != null}'>
-                               <p>Program name : ${result.programName}</p>
-                               <p>Program version : ${result.programVersion}</p>
+                       <c:if test='${result.programName != null}'>
+                               <c:choose>
+                               <c:when test="${result.programLink != ''}">
+                                       <p style="font-weight:bold;">
+                                       Program: <a href="${result.programLink}">${result.programName}</a> (version : ${result.programVersion})
+                                       </p>
+                               </c:when>
+                               <c:otherwise>
+                                       <p style="font-weight:bold;">Program : ${result.programName} (version : ${result.programVersion})</p>
+                               </c:otherwise>
+                               </c:choose>
                        </c:if>
 <sec:authorize access="hasRole('ROLE_ADMIN')">
                        <p>IP: <a title="Click to view other jobs" href="${ip_query}?ip=${result.ip}">${result.ip}</a></p>
index 4e2e773..445b870 100644 (file)
@@ -6,7 +6,7 @@
 <%@ 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"%>
-<%@page import="java.util.ArrayList"%>
+<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
 
 <html>
 <jsp:include page="../fragments/header.jsp" />
@@ -35,6 +35,9 @@
        </div>
 
        <div class="panel-body">
+<sec:authorize access="hasRole('ROLE_ADMIN')">
+                       <p>Servlet execution time: ${timeExecution} milliseconds</p>
+</sec:authorize>
                <c:choose>
                <c:when test="${njobs == 0}">
                        <p>No proteins with feature ${feature} more then ${percent}% of the protein sequence found</p>
index 0bb4b7a..a75f0bb 100644 (file)
@@ -4,7 +4,7 @@
 <%@ 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"%>
-<%@page import="java.util.ArrayList"%>
+<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
 
 <html>
 <jsp:include page="../fragments/header.jsp" />
@@ -46,6 +46,9 @@
        </div>
 
        <div class="panel-body">
+<sec:authorize access="hasRole('ROLE_ADMIN')">
+                       <p>Servlet execution time: ${timeExecution} milliseconds</p>
+</sec:authorize>
                <c:choose>
                        <c:when test="${njobs == 0}">
                                <p>No jobs found</p>
                                                        <c:forEach items="${results}" var="res" varStatus="status">
                                                                <c:forEach items="${res.jobid}" var="id" varStatus="status">
                                                                <tr>
-                                                                       <th rowspan="${res.size + 2}"><a
+                                                                       <th rowspan="3"><a
                                                                                title="Click to view the job log"
                                                                                href="${job_query}?IdJob=${id}">${id}</a></th>
                                                                </tr>
                                                                <tr>
                                                                        <td style="text-align: center; font-weight: bold; font-family: monospace">Sequence</td>
                                                                        <c:if test="${searchtype == 'whole'}">
-                                                                               <td
-                                                                                       style="text-align: left; border-buttom: dotted; font-family: monospace"><c:out
-                                                                                               value="${res.sequence}" /></td>
+                                                                               <td style="text-align: left; font-family: monospace">
+                                                                                               ${res.sequence}</td>
                                                                        </c:if>
                                                                        <c:if test="${searchtype == 'partial'}">
-                                                                               <td
-                                                                                       style="text-align: left; border-buttom: dotted; font-family: monospace">
+                                                                               <td style="text-align: left; border-buttom: dotted; font-family: monospace">
                                                                                        <c:forEach items="${res.subProt}" var="seq">
                                                                                                <c:choose>
-                                                       <c:when test="${fn:contains(seq, prot)}">
-                                                       <span style="background-color: blue">${seq}</span></c:when>
-                                                       <c:otherwise>${seq}</c:otherwise>
+                                                                                               <c:when test="${fn:contains(seq, prot)}">
+                                                                                               <span style="background-color: blue">${seq}</span></c:when>
+                                                                                               <c:otherwise>${seq}</c:otherwise>
                                                                                                </c:choose>
                                                                                        </c:forEach>
                                                                                </td>
                                                                        </c:if>
                                                                </tr>
-                                                               <c:forEach items="${res.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>
+                                                               <tr>
+                                                                       <td style="text-align: center; font-weight: bold; font-family: monospace">
+                                                                               Jnetpred
+                                                                       </td>
+                                                                       <td style="text-align: left; border-buttom: dotted; font-family: monospace">
+                                                                               ${res.jnetpred}
+                                                                       </td>
+                                                               </tr>
                                                        </c:forEach>
                                                        </c:forEach>
                                                </tbody>
index 894d113..0e22a99 100644 (file)
@@ -5,6 +5,7 @@
 <%@ 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 prefix="sec" uri="http://www.springframework.org/security/tags"%>
 
 <html>
 <jsp:include page="../fragments/header.jsp" />
@@ -34,6 +35,9 @@
        </div>
 
        <div class="panel-body">
+<sec:authorize access="hasRole('ROLE_ADMIN')">
+               <p>Servlet execution time: ${timeExecution} milliseconds</p>
+</sec:authorize>
                <c:choose>
                <c:when test="${njobs == 0}">
                        <p>No proteins with at least ${counter} jobs found</p>