JAL-3829 more testing wit tdbeacons data columns and FTSclient arnaud/develop
authorarngucci <arnaud.gucciardi@gmail.com>
Tue, 6 Apr 2021 13:25:18 +0000 (15:25 +0200)
committerarngucci <arnaud.gucciardi@gmail.com>
Tue, 6 Apr 2021 13:25:18 +0000 (15:25 +0200)
resources/fts/tdbeacons_data_columns.txt
src/jalview/fts/service/pdb/PDBFTSRestClient.java
src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java
test/jalview/fts/service/pdb/PDBFTSRestClientTest.java
test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java
test/jalview/gui/StructureChooserTest.java

index de50d58..31d85c6 100644 (file)
@@ -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 
index c18ad48..dc7fe41 100644 (file)
@@ -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;
index 7c06f05..9c6f45a 100644 (file)
@@ -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<String, Object> 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<String, Object> tdbJsonStructure,
         } catch (Exception e)
         {
           //e.printStackTrace();
-          System.out.println("offending value:" + fieldData);
+          System.out.println("offending value:" + fieldData + fieldData);
         }
       }
     }
index bbd45aa..61d2427 100644 (file)
@@ -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" })
index b2884cf..b144aa5 100644 (file)
@@ -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());
   }
 }
index 073bde8..9529d9f 100644 (file)
@@ -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",