- * */
- public List<DataBase> readProteins(String protIn, String flag) {
- query = new ArrayList<DataBase>();
- List<StructureProteinPrediction> res;
- if (flag.equals("whole"))
- res = DBInstance.ReadWholeSequence(protIn);
- else
- res = DBInstance.ReadPartOfSequence(protIn);
- for (StructureProteinPrediction entry : res) {
- Map<String,String> pred = entry.getPrediction();
- Iterator it = pred.entrySet().iterator();
- while (it.hasNext()) {
- DataBase db = new DataBase();
- db.setProt(entry.getSequence());
- Map.Entry pairs = (Map.Entry)it.next();
- db.setId(entry.getJobid());
- db.setJpred(pairs.getValue().toString());
- if (flag.equals("part"))
- db.setSubProt(CreateSubprot (entry.getSequence(), protIn));
- query.add(db);
+ */
+ public List<ProteinBean> readProteins(String protIn, String searchtype) {
+ List<ProteinBean> result;
+ if (searchtype.equals("whole"))
+ result = db.ReadWholeSequence(protIn);
+ else
+ result = db.ReadPartOfSequence(protIn);
+ if (result == null)
+ return null;
+
+ if (searchtype.equals("partial")) {
+ for (ProteinBean entry : result) {
+ entry.setSubProt(CreateSubprot(entry.getSequence(), protIn));
+ }
+ }
+ return result;
+ }
+
+ /*
+ * query: protein feature
+ */
+ public Map<String, String> readProteinsPrediction(String feature, int percent) {
+ Map<String, String> result = db.ReadProtein();
+ ;
+ if (result == null)
+ return null;
+ Map<String, String> query = new HashMap<String, String>();
+ for (Map.Entry<String, String> entry : result.entrySet()) {
+ String pred = entry.getValue();
+ if (pred.replaceAll("[^" + feature + "]", "").length() > pred.length() * percent / 100 && (!entry.getKey().equals(""))) {
+ // if (!entry.getKey().equals(""))
+ query.put(entry.getKey(), pred);