Add the "Reload" and "CSV" buttons
[proteocache.git] / server / compbio / controllers / SSFeaturesController.java
index 0339659..ba81cab 100644 (file)
@@ -69,9 +69,20 @@ public class SSFeaturesController extends BasicController {
                Map<String, String> r = cr.readProteinsPrediction(typeFeature, realpercent);
                model.put("results", r);
                model.put("njobs", 0);
+               String csvline = "";
                if (null != r) {
                        model.put("njobs", r.size());
+                       csvline = "\'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;
+               }
+               model.put("csvfile", csvline);
+
                final long endTime = System.currentTimeMillis();
                model.put("timeExecution", (endTime - startTime));
                model.put("feature", typeFeature);