From 6e6ddc20fcf481339adb6ade776f2b3ab4c1ce2c Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 25 Aug 2021 16:26:00 +0100 Subject: [PATCH] JAL-3829 fixed up the 3d-beacons data columns definitions, tests and client. --- resources/fts/tdbeacons_data_columns.txt | 21 +++++++++++------ .../threedbeacons/TDBeaconsFTSRestClient.java | 4 ++-- .../threedbeacons/TDBeaconsFTSRestClientTest.java | 24 ++++++++++++-------- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/resources/fts/tdbeacons_data_columns.txt b/resources/fts/tdbeacons_data_columns.txt index 350b9e8..4eb9b98 100644 --- a/resources/fts/tdbeacons_data_columns.txt +++ b/resources/fts/tdbeacons_data_columns.txt @@ -40,11 +40,18 @@ _data_column.max_col_width _data_column.preferred_col_width _data_column.is_shown_by_default _data_column.is_searchable -Model id;model_identifier;String;g2;80;150;85;true;true -Sequence;aligned_sequence;String;g1;80;150;85;true;true -Provider;provider;String;g1;80;150;85;true;true -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 +Model id;model_identifier;String;g2;80;150;85;true;false +Sequence;aligned_sequence;String;g1;80;150;85;false;false +Provider;provider;String;g1;80;150;85;true;false +Uniprot Id;id;String;g2;80;150;85;false;false +UniProt Accession;uniprot_accession;String;g2;50;400;95;false;true +Entry Name;entry_name;String;g2;100;150;105;true;false +Url;model_url;String;g1;100;150;105;false;false Qmean;qmean_avg_local_score;double;g2;100;150;105;true;false +Uniprot Start;uniprot_start;Integer;g3;3;8;3;true;false +Uniprot End;uniprot_end;Integer;g3;3;8;3;true;false +Resolution;resolution;double;g3;3;8;3;true;false +Coverage;coverage;double;g3;3;8;3;true;false +Sequence Identity;sequence_identity;Float;g3;3;8;3;false;false +Model Category;model_category;String;g3;3;8;3;true;false +Created Date;created;string;g3;3;8;3;true;false \ No newline at end of file diff --git a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java index b55d9b1..7a556b5 100644 --- a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java +++ b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java @@ -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; @@ -196,7 +196,7 @@ private static FTSData getFTSData(Map tdbJsonStructure, primaryKey = fieldData; summaryRowData[colCounter++] = primaryKey; } - else if (fieldData == null || fieldData.isEmpty()) + else if (fieldData == null || fieldData.trim().isEmpty()) { summaryRowData[colCounter++] = null; } diff --git a/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java b/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java index 0656d67..06e1869 100644 --- a/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java +++ b/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java @@ -71,7 +71,7 @@ public class TDBeaconsFTSRestClientTest Assert.assertTrue(!ftsRestClient.getAllDefaultDisplayedFTSDataColumns() .isEmpty()); Assert.assertEquals(ftsRestClient - .getAllDefaultDisplayedFTSDataColumns().size(), 8); + .getAllDefaultDisplayedFTSDataColumns().size(), 10); } @Test(groups = { "Functional" }) @@ -85,10 +85,10 @@ public class TDBeaconsFTSRestClientTest Assert.assertEquals(foundIndex, -1); foundIndex = ftsRestClient.getPrimaryKeyColumIndex(wantedFields, false); - Assert.assertEquals(foundIndex, 1); + Assert.assertEquals(foundIndex, 0); foundIndex = ftsRestClient .getPrimaryKeyColumIndex(wantedFields, true); - Assert.assertEquals(foundIndex, 2); + Assert.assertEquals(foundIndex, 1); } catch (Exception e) { e.printStackTrace(); @@ -105,7 +105,7 @@ public class TDBeaconsFTSRestClientTest String actual = ftsRestClient .getDataColumnsFieldsAsCommaDelimitedString(wantedFields); Assert.assertEquals(actual, - "aligned_sequence,model_identifier,provider,id,uniprot_accession,entry_name,model_url,qmean_avg_local_score"); + "model_identifier,provider,entry_name,qmean_avg_local_score,uniprot_start,uniprot_end,resolution,coverage,model_category,created"); } @Test(groups = { "Functional" }) @@ -115,7 +115,7 @@ public class TDBeaconsFTSRestClientTest .getAllFTSDataColumns(); Assert.assertNotNull(allFields); //System.out.println(allFields.size()); - Assert.assertEquals(allFields.size(), 8); + Assert.assertEquals(allFields.size(), 15); } @Test(groups = { "Functional" }) @@ -126,7 +126,7 @@ public class TDBeaconsFTSRestClientTest .getSearchableDataColumns(); Assert.assertNotNull(searchableFields); //System.out.println(searchableFields.size()); - Assert.assertEquals(searchableFields.size(), 6); //only 1, as of first 3DB test + Assert.assertEquals(searchableFields.size(), 1); //only 1: uniprot accession } @Test(groups = { "Functional" }) @@ -278,13 +278,19 @@ public class TDBeaconsFTSRestClientTest try { wantedFields.add(TDBeaconsFTSRestClient.getInstance() - .getDataColumnByNameOrCode("Model_id")); + .getDataColumnByNameOrCode("Model Id")); wantedFields.add(TDBeaconsFTSRestClient.getInstance() .getDataColumnByNameOrCode("model_url")); wantedFields.add(TDBeaconsFTSRestClient.getInstance() .getDataColumnByNameOrCode("provider")); wantedFields.add(TDBeaconsFTSRestClient.getInstance() + .getDataColumnByNameOrCode("model_category")); + wantedFields.add(TDBeaconsFTSRestClient.getInstance() .getDataColumnByNameOrCode("qmean_avg_local_score")); + wantedFields.add(TDBeaconsFTSRestClient.getInstance() + .getDataColumnByNameOrCode("uniprot_start")); + wantedFields.add(TDBeaconsFTSRestClient.getInstance() + .getDataColumnByNameOrCode("uniprot_end")); } catch (Exception e1) { e1.printStackTrace(); @@ -293,8 +299,8 @@ public class TDBeaconsFTSRestClientTest FTSRestRequest request = new FTSRestRequest(); request.setResponseSize(100); - request.setFieldToSearchBy("P"); - request.setSearchTerm("01318.json"); + request.setFieldToSearchBy(""); + request.setSearchTerm("P01318.json"); request.setWantedFields(wantedFields); System.out.println("request : " + request.getFieldToSearchBy()); //System.out.println(request.toString()); -- 1.7.10.2