JAL-1563 Added Id (Uniprot Id) to the dynamic column config file and changed primary...
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Wed, 27 Apr 2016 17:57:37 +0000 (18:57 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Wed, 27 Apr 2016 17:57:37 +0000 (18:57 +0100)
resources/fts/uniprot_data_columns.txt
src/jalview/fts/core/FTSRestClient.java
src/jalview/fts/core/GFTSPanel.java
src/jalview/fts/service/uniprot/UniProtFTSRestClient.java
test/jalview/fts/core/FTSRestClientTest.java

index df7a03a..4d67f3f 100644 (file)
@@ -22,7 +22,7 @@ g16;Publications;16
 g17;Date of;17
 g18;Family & Domain;18
 #
-_data_column.primary_key;entry name
+_data_column.primary_key;id
 _data_column.default_response_page_size;150
 #
 _data_column.name
@@ -34,7 +34,8 @@ _data_column.max_col_width
 _data_column.preferred_col_width
 _data_column.is_shown_by_default
 _data_column.is_searchable
-Entry Name;entry name|name;String;g3;90;150;95;true;true
+Uniprot Id;id;String;g3;80;150;85;true;true
+Entry Name;entry name|name;String;g3;100;150;105;true;true
 Protein names;protein names|protein name;String;g3;300;1500;500;true;true
 Gene Names;genes|gene;String;g3;50;1000;95;true;true
 Organism;organism;String;g3;50;1000;95;true;true
index e3e2354..7a4f72e 100644 (file)
@@ -302,31 +302,6 @@ public abstract class FTSRestClient implements FTSRestClientI
     return result;
   }
 
-  /**
-   * Takes a collection of FTSDataColumnI and converts its 'code' values into a
-   * tab delimited string.
-   * 
-   * @param dataColumnFields
-   *          the collection of FTSDataColumnI to process
-   * @return the generated comma delimited string from the supplied
-   *         FTSDataColumnI collection
-   */
-  public String getDataColumnsFieldsAsTabDelimitedString(
-          Collection<FTSDataColumnI> dataColumnFields)
-  {
-    String result = "";
-    if (dataColumnFields != null && !dataColumnFields.isEmpty())
-    {
-      StringBuilder returnedFields = new StringBuilder();
-      for (FTSDataColumnI field : dataColumnFields)
-      {
-        returnedFields.append("\t").append(field.getName());
-      }
-      returnedFields.deleteCharAt(0);
-      result = returnedFields.toString();
-    }
-    return result;
-  }
 
   @Override
   public Collection<FTSDataColumnI> getAllFTSDataColumns()
index 0b23503..f8a9034 100644 (file)
@@ -350,7 +350,9 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
           {
             return;
           }
-          if ("pdb id".equalsIgnoreCase(getCmbSearchTarget()
+          String primaryKeyName = getFTSRestClient().getPrimaryKeyColumn()
+                  .getName();
+          if (primaryKeyName.equalsIgnoreCase(getCmbSearchTarget()
                   .getSelectedItem().toString()))
           {
             transferToSequenceFetcher(txt_search.getText());
index 7eda9f8..f6d7221 100644 (file)
@@ -119,6 +119,38 @@ public class UniProtFTSRestClient extends FTSRestClient
     return searchResult;
   }
 
+  /**
+   * Takes a collection of FTSDataColumnI and converts its 'code' values into a
+   * tab delimited string.
+   * 
+   * @param dataColumnFields
+   *          the collection of FTSDataColumnI to process
+   * @return the generated comma delimited string from the supplied
+   *         FTSDataColumnI collection
+   */
+  private String getDataColumnsFieldsAsTabDelimitedString(
+          Collection<FTSDataColumnI> dataColumnFields)
+  {
+    String result = "";
+    if (dataColumnFields != null && !dataColumnFields.isEmpty())
+    {
+      StringBuilder returnedFields = new StringBuilder();
+      for (FTSDataColumnI field : dataColumnFields)
+      {
+        if (field.getName().equalsIgnoreCase("Uniprot Id"))
+        {
+          returnedFields.append("\t").append("Entry");
+        }
+        else
+        {
+          returnedFields.append("\t").append(field.getName());
+        }
+      }
+      returnedFields.deleteCharAt(0);
+      result = returnedFields.toString();
+    }
+    return result;
+  }
   public static FTSData getFTSData(String tabDelimittedDataStr,
           FTSRestRequest request)
   {
index a5c6390..24a98fb 100644 (file)
@@ -79,16 +79,6 @@ public class FTSRestClientTest
             "entry name,protein names,genes,organism,created,last-modified");
   }
 
-  @Test(groups = { "Functional" })
-  public void getDataColumnsFieldsAsTabDelimitedString()
-  {
-    Collection<FTSDataColumnI> wantedFields = ftsRestClient
-            .getAllDefaulDisplayedDataColumns();
-    String actual = ftsRestClient
-            .getDataColumnsFieldsAsTabDelimitedString(wantedFields);
-    Assert.assertEquals(actual,
-            "Entry Name\tProtein names\tGene Names\tOrganism\tDate of creation\tDate of last modification");
-  }
 
   @Test(groups = { "Functional" })
   public void getAllFTSDataColumns()