JAL-3829 proof in principle 3d-beacons sequence fetcher - still some TODOs !
[jalview.git] / src / jalview / fts / service / threedbeacons / TDBeaconsFTSRestClient.java
index 9c6f45a..e956461 100644 (file)
@@ -32,7 +32,7 @@ import jalview.util.Platform;
 public class TDBeaconsFTSRestClient extends FTSRestClient
 {
   private static final String DEFAULT_THREEDBEACONS_DOMAIN = 
-          "https://wwwdev.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons-hub-api/uniprot/";
+          "https://wwwdev.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons/api/uniprot/summary/";
   
   private static FTSRestClientI instance = null;
   
@@ -47,8 +47,7 @@ public class TDBeaconsFTSRestClient extends FTSRestClient
   {
     try
     {
-      String query = tdbRestRequest.getFieldToSearchBy()
-              + tdbRestRequest.getSearchTerm();
+      String query = tdbRestRequest.getSearchTerm();
       Client client;
       Class<ClientResponse> clientResponseClass;
       if (Platform.isJS())
@@ -153,12 +152,9 @@ public class TDBeaconsFTSRestClient extends FTSRestClient
       }
       
       Object uniprot_entry = jsonObj.get("uniprot_entry"); 
-      Long seqLength = (Long) ((Map<String, Object>) jsonObj.get("uniprot_entry")).get("sequence_length");
-      //System.out.println(uniprot_entry);
-      //System.out.println(jsonObj);
-      //System.out.println("seqLenght :" + seqLength);
-      
-      //Map<String, Object> tdbResponse = (Map<String, Object>) jsonObj.get("structures");
+      // TODO: decide if anything from uniprot_entry needs to be reported via the FTSRestResponse object
+      // Arnaud added seqLength = (Long) ((Map<String, Object>) jsonObj.get("uniprot_entry")).get("sequence_length");
+
       List<Object> structures = (List<Object>) jsonObj.get("structures");
       result = new ArrayList<>();
       
@@ -168,13 +164,10 @@ public class TDBeaconsFTSRestClient extends FTSRestClient
         Map<String, Object> structure = (Map<String, Object>) strucIter.next();
         result.add(getFTSData(structure, tdbRestRequest));
         numFound++;
-        //System.out.println(structure);
       }
       
-      //System.out.println("1 : " + structures.get(1));
       searchResult.setNumberOfItemsFound(numFound); 
       searchResult.setSearchSummary(result);
-      searchResult.setSequenceLength(seqLength);
         
     } catch (ParseException e)
     {
@@ -196,13 +189,13 @@ private static FTSData getFTSData(Map<String, Object> tdbJsonStructure,
     for (FTSDataColumnI field : displayFields) {
       String fieldData = (tdbJsonStructure.get(field.getCode()) == null) ? " " 
               : tdbJsonStructure.get(field.getCode()).toString();
-      System.out.println("Field : " + field + "  Data : " + fieldData);
+      // System.out.println("Field : " + field + "  Data : " + fieldData);
       if (field.isPrimaryKeyColumn())
       {
         primaryKey = fieldData;
         summaryRowData[colCounter++] = primaryKey;
       }
-      else if (fieldData == null || fieldData.isEmpty())
+      else if (fieldData == null || fieldData.trim().isEmpty())
       {
         summaryRowData[colCounter++] = null;
       }