From a848ed8eb380e5f9d915b0d7a062feec4f9d3dad Mon Sep 17 00:00:00 2001 From: arngucci Date: Tue, 6 Apr 2021 15:25:18 +0200 Subject: [PATCH] JAL-3829 more testing wit tdbeacons data columns and FTSclient --- resources/fts/tdbeacons_data_columns.txt | 5 ++++- src/jalview/fts/service/pdb/PDBFTSRestClient.java | 2 ++ .../threedbeacons/TDBeaconsFTSRestClient.java | 7 +++---- .../fts/service/pdb/PDBFTSRestClientTest.java | 3 +++ .../threedbeacons/TDBeaconsFTSRestClientTest.java | 18 ++++++++++-------- test/jalview/gui/StructureChooserTest.java | 9 +++++++-- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/resources/fts/tdbeacons_data_columns.txt b/resources/fts/tdbeacons_data_columns.txt index de50d58..31d85c6 100644 --- a/resources/fts/tdbeacons_data_columns.txt +++ b/resources/fts/tdbeacons_data_columns.txt @@ -28,7 +28,7 @@ g1;Miscellaneous;2 g2;Name;1 g3;Quality;3 # -_data_column.primary_key;id +_data_column.primary_key;model_identifier _data_column.default_response_page_size;100 # _data_column.name @@ -40,6 +40,9 @@ _data_column.max_col_width _data_column.preferred_col_width _data_column.is_shown_by_default _data_column.is_searchable +Sequence;aligned_sequence;String;g1;80;150;85;true;true +Model id;model_identifier;String;g2;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 diff --git a/src/jalview/fts/service/pdb/PDBFTSRestClient.java b/src/jalview/fts/service/pdb/PDBFTSRestClient.java index c18ad48..dc7fe41 100644 --- a/src/jalview/fts/service/pdb/PDBFTSRestClient.java +++ b/src/jalview/fts/service/pdb/PDBFTSRestClient.java @@ -364,8 +364,10 @@ public static String parseJsonExceptionString(String jsonErrorResponse) for (FTSDataColumnI field : diplayFields) { + //System.out.println("Field " + field); String fieldData = (pdbJsonDoc.get(field.getCode()) == null) ? "" : pdbJsonDoc.get(field.getCode()).toString(); + //System.out.println("Field Data : " + fieldData); if (field.isPrimaryKeyColumn()) { primaryKey = fieldData; diff --git a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java index 7c06f05..9c6f45a 100644 --- a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java +++ b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java @@ -171,7 +171,7 @@ public class TDBeaconsFTSRestClient extends FTSRestClient //System.out.println(structure); } - System.out.println("1 : " + structures.get(1)); + //System.out.println("1 : " + structures.get(1)); searchResult.setNumberOfItemsFound(numFound); searchResult.setSearchSummary(result); searchResult.setSequenceLength(seqLength); @@ -194,10 +194,9 @@ private static FTSData getFTSData(Map tdbJsonStructure, 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); + System.out.println("Field : " + field + " Data : " + fieldData); if (field.isPrimaryKeyColumn()) { primaryKey = fieldData; @@ -221,7 +220,7 @@ private static FTSData getFTSData(Map tdbJsonStructure, } catch (Exception e) { //e.printStackTrace(); - System.out.println("offending value:" + fieldData); + System.out.println("offending value:" + fieldData + fieldData); } } } diff --git a/test/jalview/fts/service/pdb/PDBFTSRestClientTest.java b/test/jalview/fts/service/pdb/PDBFTSRestClientTest.java index bbd45aa..61d2427 100644 --- a/test/jalview/fts/service/pdb/PDBFTSRestClientTest.java +++ b/test/jalview/fts/service/pdb/PDBFTSRestClientTest.java @@ -93,6 +93,8 @@ public class PDBFTSRestClientTest { e1.printStackTrace(); } + System.out.println("wantedFields >>" + wantedFields); + FTSRestRequest request = new FTSRestRequest(); request.setAllowEmptySeq(false); @@ -246,6 +248,7 @@ public class PDBFTSRestClientTest assertTrue(response.getSearchSummary() != null); assertTrue(response.getNumberOfItemsFound() == 931); assertTrue(response.getSearchSummary().size() == 14); + System.out.println("Search summary : " + response.getSearchSummary()); } @Test(groups = { "Functional" }) diff --git a/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java b/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java index b2884cf..b144aa5 100644 --- a/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java +++ b/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java @@ -246,7 +246,7 @@ public class TDBeaconsFTSRestClientTest try { wantedFields.add(TDBeaconsFTSRestClient.getInstance() - .getDataColumnByNameOrCode("id")); + .getDataColumnByNameOrCode("Model id")); wantedFields.add(TDBeaconsFTSRestClient.getInstance() .getDataColumnByNameOrCode("uniprot_accession")); wantedFields.add(TDBeaconsFTSRestClient.getInstance() @@ -257,10 +257,10 @@ public class TDBeaconsFTSRestClientTest } try { - assertEquals(1, PDBFTSRestClient.getInstance() + assertEquals(1, TDBeaconsFTSRestClient.getInstance() .getPrimaryKeyColumIndex(wantedFields, true)); -// assertEquals(4, PDBFTSRestClient.getInstance() -// .getPrimaryKeyColumIndex(wantedFields, false)); +// assertEquals(3, TDBeaconsFTSRestClient.getInstance() +// .getPrimaryKeyColumIndex(wantedFields, true)); } catch (Exception e) { e.printStackTrace(); @@ -275,10 +275,12 @@ public class TDBeaconsFTSRestClientTest try { wantedFields.add(TDBeaconsFTSRestClient.getInstance() - .getDataColumnByNameOrCode("id")); + .getDataColumnByNameOrCode("Model id")); wantedFields.add(TDBeaconsFTSRestClient.getInstance() .getDataColumnByNameOrCode("model_url")); wantedFields.add(TDBeaconsFTSRestClient.getInstance() + .getDataColumnByNameOrCode("provider")); + wantedFields.add(TDBeaconsFTSRestClient.getInstance() .getDataColumnByNameOrCode("qmean_avg_local_score")); } catch (Exception e1) { @@ -305,8 +307,8 @@ public class TDBeaconsFTSRestClientTest return; } assertTrue(response.getSearchSummary() != null); - assertTrue(response.getNumberOfItemsFound() > 3); - System.out.println(response.getSearchSummary()); - System.out.println(response.getSearchSummary().size()); + assertTrue(response.getNumberOfItemsFound() > 3); //4 atm + System.out.println("Search summary : \n" + response.getSearchSummary()); + //System.out.println(response.getSearchSummary().size()); } } diff --git a/test/jalview/gui/StructureChooserTest.java b/test/jalview/gui/StructureChooserTest.java index 073bde8..9529d9f 100644 --- a/test/jalview/gui/StructureChooserTest.java +++ b/test/jalview/gui/StructureChooserTest.java @@ -83,19 +83,21 @@ public class StructureChooserTest seq = null; } + @SuppressWarnings("deprecation") @Test(groups = { "Functional" }) public void buildQueryTest() { + System.out.println("seq >>>> " + seq); String query = StructureChooser.buildQuery(seq); assertEquals("pdb_id:1tim", query); - System.out.println("seq >>>> " + seq); seq.getAllPDBEntries().clear(); query = StructureChooser.buildQuery(seq); assertEquals( "text:XYZ_1 OR text:XYZ_2 OR text:XYZ_3 OR text:XYZ_4 OR text:4kqy", query); - seq.setDBRefs(null); + seq.setDBRefs(null); query = StructureChooser.buildQuery(seq); + System.out.println(query); assertEquals("text:4kqy", query); DBRefEntry uniprotDBRef = new DBRefEntry(); @@ -114,6 +116,9 @@ public class StructureChooserTest dbRef.setAccessionId("XYZ_" + x); seq.addDBRef(dbRef); } + System.out.println(""); + System.out.println(seq.getDBRefs()); + System.out.println(query); query = StructureChooser.buildQuery(seq); assertEquals( "uniprot_accession:P12345 OR uniprot_id:P12345 OR pdb_id:1xyz", -- 1.7.10.2