From: Arnaldo Date: Mon, 29 Mar 2021 08:51:09 +0000 (+0200) Subject: Request now parses the whole structures, need to fix the result X-Git-Tag: Release_2_11_2_0~39^2~56 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2f6c709622e1bdabe5eb3b2420b41f2aa6ff4658;p=jalview.git Request now parses the whole structures, need to fix the result --- diff --git a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSPanel.java b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSPanel.java index 0d79d9b..c368e7b 100644 --- a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSPanel.java +++ b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSPanel.java @@ -45,11 +45,11 @@ public class TDBeaconsFTSPanel extends GFTSPanel : fetcher.getProgressIndicator(); } - public int TDBeaconsFTSPanel2(String result) - { - int seqlength = executeParse(result); - return seqlength; - } +// public int TDBeaconsFTSPanel2(String result) +// { +// int seqlength = executeParse(result); +// return seqlength; +// } public static int executeParse(String query) { BufferedReader reader; @@ -102,7 +102,7 @@ public class TDBeaconsFTSPanel extends GFTSPanel JSONArray structures = entry.getJSONArray("structures"); for (int i=0 ; i < structures.length() ; i++) { String id = structures.getJSONObject(i).getString("model_identifier"); - System.out.println("identifier num " + i + " : " + id); + //System.out.println("identifier num " + i + " : " + id); } System.out.println("length : " + length + "; access name : " + ac); return length; diff --git a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java index b6be709..884dced 100644 --- a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java +++ b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java @@ -47,14 +47,6 @@ public class TDBeaconsFTSRestClient extends FTSRestClient { try { - // Removed wantedFields, sortParam & facetPivot from PDBFTSRClient - String wantedFields = getDataColumnsFieldsAsCommaDelimitedString( - tdbRestRequest.getWantedFields()); - int responseSize = (tdbRestRequest.getResponseSize() == 0) - ? getDefaultResponsePageSize() - : tdbRestRequest.getResponseSize(); - //int offSet = pdbRestRequest.getOffSet(); - String query = tdbRestRequest.getFieldToSearchBy() + tdbRestRequest.getSearchTerm(); Client client; @@ -75,12 +67,9 @@ public class TDBeaconsFTSRestClient extends FTSRestClient clientResponseClass = ClientResponse.class; } WebResource webResource; - webResource = client.resource(DEFAULT_THREEDBEACONS_DOMAIN).path(query); + webResource = client.resource(DEFAULT_THREEDBEACONS_DOMAIN) + .path(query); URI uri = webResource.getURI(); -// .queryParam("P", query); -// .queryParam("rows", String.valueOf(responseSize)) -// .queryParam("P",query); -// URI uri = webResource.getURI(); System.out.println(uri.toString()); // Execute the REST request @@ -92,13 +81,11 @@ public class TDBeaconsFTSRestClient extends FTSRestClient Map jsonObj = null; String responseString = null; - //System.out.println("query >>>>>>> " + tdbRestRequest.toString()); - // Check the response status and report exception if one occurs int responseStatus = clientResponse.getStatus(); switch (responseStatus) { - // if succesful + // if success case 200: if (Platform.isJS()) { @@ -165,13 +152,18 @@ public class TDBeaconsFTSRestClient extends FTSRestClient { jsonObj = (Map) JSONUtils.parse(tdbJsonResponseString); } + System.out.println(jsonObj); //Map tdbResponse = (Map) jsonObj.get("structures"); - //String seqLength = tdbEntry.get("sequence_length").toString(); - //int seqLength = Integer.valueOf(tdbEntry.get("sequence_length").toString()); + //System.out.println((Map) jsonObj.get("uniprot_entry")); Long seqLength = (Long) ((Map) jsonObj.get("uniprot_entry")).get("sequence_length"); + System.out.println(seqLength); result = new ArrayList<>(); List structures = (List) jsonObj.get("structures"); + //System.out.println(jsonObj.get("structures")); + //System.out.println(structures); + System.out.println("ZERO : " + structures.get(0)); + System.out.println("1 : " + structures.get(1)); int numFound = 0; for (Iterator strucIter = structures.iterator(); strucIter .hasNext();) @@ -179,10 +171,13 @@ public class TDBeaconsFTSRestClient extends FTSRestClient Map structure = (Map) strucIter.next(); result.add(getFTSData(structure, tdbRestRequest)); numFound++; + //System.out.println(structure); } - searchResult.setNumberOfItemsFound(numFound); - searchResult.setSearchSummary(result); - searchResult.setSequenceLength(seqLength); + //System.out.println(structures); + System.out.println("1 : " + structures.get(1)); + searchResult.setNumberOfItemsFound(numFound); + searchResult.setSearchSummary(result); + searchResult.setSequenceLength(seqLength); } catch (ParseException e) { diff --git a/test/jalview/fts/service/pdb/PDBFTSPanelTest.java b/test/jalview/fts/service/pdb/PDBFTSPanelTest.java index 187a30e..0b4dd92 100644 --- a/test/jalview/fts/service/pdb/PDBFTSPanelTest.java +++ b/test/jalview/fts/service/pdb/PDBFTSPanelTest.java @@ -124,5 +124,13 @@ public class PDBFTSPanelTest assertTrue(!mainFrame.getTitle().equalsIgnoreCase( "PDB Sequence Fetcher")); } + + @Test + public void getFTSframeTitleTest() { + PDBFTSPanel searchPanel = new PDBFTSPanel(null); + String outcome = searchPanel.getFTSFrameTitle(); + //System.out.println("FTS Frame title :" + outcome); + assertEquals(outcome, "PDB Sequence Fetcher"); + } } diff --git a/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java b/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java index fe1f3bc..f65fa84 100644 --- a/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java +++ b/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java @@ -263,7 +263,6 @@ public class TDBeaconsFTSRestClientTest // .getPrimaryKeyColumIndex(wantedFields, false)); } catch (Exception e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -307,6 +306,7 @@ public class TDBeaconsFTSRestClientTest } assertTrue(response.getSearchSummary() != null); assertTrue(response.getNumberOfItemsFound() > 99); + System.out.println(response.getSearchSummary()); System.out.println(response.getSearchSummary().size()); } }