From fe4ab7f363cfaed56db7c346f159f2d89ae4e66f Mon Sep 17 00:00:00 2001 From: Arnaldo Date: Thu, 1 Apr 2021 15:28:59 +0200 Subject: [PATCH] JAL-3829 attempt to fix my changes to follow the Jira issue --- resources/fts/tdbeacons_data_columns.txt | 3 +++ .../threedbeacons/TDBeaconsFTSRestClient.java | 19 ++++++++++--------- .../threedbeacons/TDBeaconsFTSRestClientTest.java | 6 +++--- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/resources/fts/tdbeacons_data_columns.txt b/resources/fts/tdbeacons_data_columns.txt index 2eb3d31..de50d58 100644 --- a/resources/fts/tdbeacons_data_columns.txt +++ b/resources/fts/tdbeacons_data_columns.txt @@ -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 diff --git a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java index 655b960..7c06f05 100644 --- a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java +++ b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java @@ -151,21 +151,19 @@ public class TDBeaconsFTSRestClient extends FTSRestClient { jsonObj = (Map) JSONUtils.parse(tdbJsonResponseString); } - //System.out.println(jsonObj); Object uniprot_entry = jsonObj.get("uniprot_entry"); - System.out.println(uniprot_entry); - Long seqLength = (Long) ((Map) 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 tdbResponse = (Map) jsonObj.get("structures"); List structures = (List) jsonObj.get("structures"); - //Map tdbResponse = (Map) jsonObj.get("structures"); + result = new ArrayList<>(); int numFound = 0; - for (Iterator strucIter = structures.iterator(); strucIter - .hasNext();) + for (Iterator strucIter = structures.iterator(); strucIter.hasNext();) { Map structure = (Map) strucIter.next(); result.add(getFTSData(structure, tdbRestRequest)); @@ -194,9 +192,12 @@ private static FTSData getFTSData(Map tdbJsonStructure, Collection 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 tdbJsonStructure, : fieldData; } catch (Exception e) { - e.printStackTrace(); + //e.printStackTrace(); System.out.println("offending value:" + fieldData); } } diff --git a/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java b/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java index 94b6b63..b2884cf 100644 --- a/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java +++ b/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java @@ -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()); -- 1.7.10.2