1 package compbio.cassandra.readers;
3 import java.util.HashMap;
7 import com.datastax.driver.core.ResultSet;
8 import com.datastax.driver.core.Row;
11 public class FeaturesReader extends CassandraReader {
13 public FeaturesReader() {
18 * query protein feature
24 * percent SS feature in protein sequence
26 * @return UserBean to the controller SSFeaturesController
29 public Map<String, String> readProteinsPrediction(String feature, int percent) {
30 ResultSet results = CassandraQuery("SELECT * FROM ProteinRow;");
31 if (results.isExhausted())
33 List<Row> rows = results.all();
34 Map<String, String> query = new HashMap<String, String>();
36 String prot = r.getString("Protein");
37 String prediction = findJnetpred(r.getMap("Predictions", String.class, String.class));
38 if (prot != null && prediction != null && (!prot.equals(""))) {
39 if (prediction.replaceAll("[^" + feature + "]", "").length() > prediction.length() * percent / 100 ) {
40 query.put(prot, prediction);
48 private String findJnetpred(Map<String, String> pred) {
50 if (pred.containsKey("jnetpred"))
51 return pred.get("jnetpred");