import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
-import compbio.cassandra.ProteinBean;
-import compbio.cassandra.TotalByCounterBean;
+import compbio.beans.ProteinBean;
+import compbio.beans.TotalByCounterBean;
+import compbio.cassandra.readers.ReaderByCounter;
+import compbio.cassandra.readers.SequenceReader;
import compbio.statistic.CassandraRequester;
/**
*/
private final Pattern NONPROTEIN = Pattern.compile("[^ARNDCQEGHILKMFPSTWYV]+", Pattern.CASE_INSENSITIVE);
+ /**
+ * form a query page for search protein sequence. The servlet should be
+ * available for users and admins only.
+ *
+ * @param model
+ * MVC model
+ * @return link to the JSP query page
+ */
@RequestMapping(value = "query", method = RequestMethod.GET)
public String formSequenceQuery(Map<String, Object> model) {
model.put("username", getPrincipalName());
return "query/Sequence";
}
+ /**
+ * form a query page for statistics: Protein by job count. The servlet should be
+ * available for users and admins only.
+ *
+ * @param model
+ * MVC model
+ * @return link to the JSP query page
+ */
@RequestMapping(value = "counts/query", method = RequestMethod.GET)
public String formCounterQuery(Map<String, Object> model) {
model.put("username", getPrincipalName());
return "query/SequenceCounts";
}
+ /**
+ * form a report page for search protein sequence.
+ *
+ * @param model
+ * MVC model object
+ * @param sequence
+ * protein sequence or part of sequence
+ * @param searchtype
+ * defined whether the whole sequence or part of sequence would be searched
+ * @return link to the report JSP page
+ */
@RequestMapping(value = "sequence/results", method = RequestMethod.GET)
public String findSequence(@RequestParam("sequence") String sequence, @RequestParam("searchtype") String searchtype,
Map<String, Object> model) {
model.put("searchtype", searchtype);
if (0 < trimmedsequence.length()) {
- CassandraRequester cr = new CassandraRequester();
- List<ProteinBean> r = cr.readProteins(trimmedsequence, searchtype);
- model.put("results", r);
- if (null != r) {
+ SequenceReader reader = new SequenceReader();
+ List<ProteinBean> result = reader.readProteins(trimmedsequence, searchtype);
+ model.put("results", result);
+ if (null != result) {
if (searchtype.equals("whole"))
- model.put("njobs", r.get(0).getJobid().size());
+ model.put("njobs", result.get(0).getJobid().size());
else
- model.put("njobs", r.size());
+ model.put("njobs", result.size());
}
}
final long endTime = System.currentTimeMillis();
return "reportProteinSequences";
}
+ /**
+ * form a report page for statistics: Protein by job count.
+ *
+ * @param model
+ * MVC model object
+ * @param counter
+ *
+ * @return link to the report JSP page
+ */
@RequestMapping(value = "counts/results", method = RequestMethod.GET)
public String countSequences(@RequestParam("counterJob") String counter, Map<String, Object> model) {
model.put("username", getPrincipalName());
return "query/SequenceCounts";
}
- CassandraRequester cr = new CassandraRequester();
- List<TotalByCounterBean> r = cr.readProteinByCounter(realcounter);
+ ReaderByCounter reader = new ReaderByCounter();
+
+ List<TotalByCounterBean> r = reader.readProteinByCounter(realcounter);
model.put("results", r);
model.put("njobs", 0);
if (null != r) {