JAL-3829 attempt to fix my changes to follow the Jira issue
authorArnaldo <arnaud.gucciardi@gmail.com>
Thu, 1 Apr 2021 13:28:59 +0000 (15:28 +0200)
committerArnaldo <arnaud.gucciardi@gmail.com>
Thu, 1 Apr 2021 13:28:59 +0000 (15:28 +0200)
resources/fts/tdbeacons_data_columns.txt
src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java
test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java

index 2eb3d31..de50d58 100644 (file)
@@ -26,6 +26,7 @@ _group.name
 _group.sort_order
 g1;Miscellaneous;2
 g2;Name;1
+g3;Quality;3
 #
 _data_column.primary_key;id
 _data_column.default_response_page_size;100
@@ -42,3 +43,5 @@ _data_column.is_searchable
 Uniprot Id;id;String;g2;80;150;85;true;true
 UniProt Accession;uniprot_accession;String;g2;50;400;95;true;false
 Entry Name;entry name;String;g2;100;150;105;true;true 
+Url;model_url;String;g1;100;150;105;true;true
+Qmean;qmean_avg_local_score;double;g3;100;150;105;true;true
index 655b960..7c06f05 100644 (file)
@@ -151,21 +151,19 @@ public class TDBeaconsFTSRestClient extends FTSRestClient
       {
         jsonObj = (Map<String, Object>) JSONUtils.parse(tdbJsonResponseString);
       }
-      //System.out.println(jsonObj);
       
       Object uniprot_entry = jsonObj.get("uniprot_entry"); 
-      System.out.println(uniprot_entry);
-      
       Long seqLength = (Long) ((Map<String, Object>) jsonObj.get("uniprot_entry")).get("sequence_length");
-      System.out.println("seqLenght :" + seqLength);
+      //System.out.println(uniprot_entry);
+      //System.out.println(jsonObj);
+      //System.out.println("seqLenght :" + seqLength);
       
-      result = new ArrayList<>();
+      //Map<String, Object> tdbResponse = (Map<String, Object>) jsonObj.get("structures");
       List<Object> structures = (List<Object>) jsonObj.get("structures");
-    //Map<String, Object> tdbResponse = (Map<String, Object>) jsonObj.get("structures");
+      result = new ArrayList<>();
       
       int numFound = 0;
-      for (Iterator<Object> strucIter = structures.iterator(); strucIter
-              .hasNext();)
+      for (Iterator<Object> strucIter = structures.iterator(); strucIter.hasNext();)
       {
         Map<String, Object> structure = (Map<String, Object>) strucIter.next();
         result.add(getFTSData(structure, tdbRestRequest));
@@ -194,9 +192,12 @@ private static FTSData getFTSData(Map<String, Object> tdbJsonStructure,
     Collection<FTSDataColumnI> displayFields = tdbRequest.getWantedFields();
     int colCounter = 0;
     summaryRowData = new Object[displayFields.size()];
+    
     for (FTSDataColumnI field : displayFields) {
+      System.out.println("Field " + field);
       String fieldData = (tdbJsonStructure.get(field.getCode()) == null) ? " " 
               : tdbJsonStructure.get(field.getCode()).toString();
+      System.out.println("Field Data : " + fieldData);
       if (field.isPrimaryKeyColumn())
       {
         primaryKey = fieldData;
@@ -219,7 +220,7 @@ private static FTSData getFTSData(Map<String, Object> tdbJsonStructure,
                                           : fieldData;
         } catch (Exception e)
         {
-          e.printStackTrace();
+          //e.printStackTrace();
           System.out.println("offending value:" + fieldData);
         }
       }
index 94b6b63..b2884cf 100644 (file)
@@ -277,9 +277,9 @@ public class TDBeaconsFTSRestClientTest
       wantedFields.add(TDBeaconsFTSRestClient.getInstance()
               .getDataColumnByNameOrCode("id"));
       wantedFields.add(TDBeaconsFTSRestClient.getInstance()
-              .getDataColumnByNameOrCode("uniprot_accession"));
+              .getDataColumnByNameOrCode("model_url"));
       wantedFields.add(TDBeaconsFTSRestClient.getInstance()
-              .getDataColumnByNameOrCode("entry name"));
+              .getDataColumnByNameOrCode("qmean_avg_local_score"));
     } catch (Exception e1)
     {
       e1.printStackTrace();
@@ -289,7 +289,7 @@ public class TDBeaconsFTSRestClientTest
     FTSRestRequest request = new FTSRestRequest();
     request.setResponseSize(100);
     request.setFieldToSearchBy("P");
-    request.setSearchTerm("01308.json");
+    request.setSearchTerm("01318.json");
     request.setWantedFields(wantedFields);
     System.out.println("request : " + request.getFieldToSearchBy());
     //System.out.println(request.toString());