X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=server%2Fcompbio%2Fcontrollers%2FSSFeaturesController.java;fp=server%2Fcompbio%2Fcontrollers%2FSSFeaturesController.java;h=a961efea07b1c53caaab01dceac3301afa81e067;hb=d1048dc77b419ac536dee9ce6fa3113613172b9c;hp=6398eeff1e905de27c98b36fefe9a478707ea24e;hpb=3f8887a303cd1605d9a5e752ca50f9691c4fe6e8;p=proteocache.git diff --git a/server/compbio/controllers/SSFeaturesController.java b/server/compbio/controllers/SSFeaturesController.java index 6398eef..a961efe 100644 --- a/server/compbio/controllers/SSFeaturesController.java +++ b/server/compbio/controllers/SSFeaturesController.java @@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.RequestParam; import compbio.cassandra.readers.FeaturesReader; /** - * 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.cassandra.readers.FeaturesReader; @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 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 model) { @@ -69,19 +93,19 @@ public class SSFeaturesController extends BasicController { Map r = reader.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 entry : r.entrySet()) { - csvline += "\'" + counter + "\',\'" + entry.getKey() + "\',\'" + entry.getValue() + "\'%0A"; - ++counter; + // form line for CSV file + int counter = 1; + for (Map.Entry 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));