1 package compbio.cassandra.readers;
3 import java.util.HashMap;
7 import com.datastax.driver.core.ResultSet;
8 import com.datastax.driver.core.Row;
10 public class PredictionReader extends CassandraReader {
12 public PredictionReader() {
17 * query: protein feature
20 * a feature of secondary structure: Helix or Beta Sheet
23 * fraction the feature in the protein
25 * @return Map<String, String> to the controller SSFeaturesController
28 public Map<String, String> readProteinsPrediction(String feature, int percent) {
29 ResultSet results = CassandraQuery("SELECT * FROM ProteinRow;");
30 if (results.isExhausted())
32 List<Row> rows = results.all();
33 Map<String, String> query = new HashMap<String, String>();
35 String prot = r.getString("Protein");
36 String prediction = findJnetpred(r.getMap("Predictions", String.class, String.class));
37 if (prot != null || prediction != null) {
38 if (prediction.replaceAll("[^" + feature + "]", "").length() > prediction.length() * percent / 100) {
39 query.put(prot, prediction);
46 private String findJnetpred(Map<String, String> pred) {
48 if (pred.containsKey("jnetpred"))
49 return pred.get("jnetpred");