JAL-1710 filtered colons(:) from structure chooser query as it conflicts with solr...
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 30 Jul 2015 10:18:43 +0000 (11:18 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 30 Jul 2015 10:18:43 +0000 (11:18 +0100)
src/jalview/gui/StructureChooser.java

index 2e3b37a..7c09266 100644 (file)
 
 package jalview.gui;
 
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.jbgui.GStructureChooser;
+import jalview.jbgui.PDBDocFieldPreferences;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.MessageManager;
+import jalview.ws.dbsources.PDBRestClient;
+import jalview.ws.dbsources.PDBRestClient.PDBDocField;
+import jalview.ws.uimodel.PDBRestRequest;
+import jalview.ws.uimodel.PDBRestResponse;
+import jalview.ws.uimodel.PDBRestResponse.PDBResponseSummary;
+
 import java.awt.event.ItemEvent;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -36,19 +49,6 @@ import javax.swing.JLabel;
 import javax.swing.JOptionPane;
 import javax.swing.table.DefaultTableModel;
 
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.PDBEntry;
-import jalview.datamodel.SequenceI;
-import jalview.jbgui.GStructureChooser;
-import jalview.jbgui.PDBDocFieldPreferences;
-import jalview.structure.StructureSelectionManager;
-import jalview.util.MessageManager;
-import jalview.ws.dbsources.PDBRestClient;
-import jalview.ws.dbsources.PDBRestClient.PDBDocField;
-import jalview.ws.uimodel.PDBRestRequest;
-import jalview.ws.uimodel.PDBRestResponse;
-import jalview.ws.uimodel.PDBRestResponse.PDBResponseSummary;
-
 
 /**
  * Provides the behaviors for the Structure chooser Panel
@@ -193,7 +193,7 @@ public class StructureChooser extends GStructureChooser
       if (errors.size() > 0)
       {
         StringBuilder errorMsg = new StringBuilder();
-        // "Operation was unsucessful due to the following: \n");
+        // "Operation was unsuccessful due to the following: \n");
         for (String error : errors)
         {
           errorMsg.append(error).append("\n");
@@ -293,7 +293,10 @@ public class StructureChooser extends GStructureChooser
     {
       for (PDBEntry entry : seq.getPDBId())
       {
-        seqRefs.add(entry.getId());
+        if (isValidSeqName(entry.getId()))
+        {
+          seqRefs.add(entry.getId());
+        }
       }
     }
 
@@ -302,7 +305,11 @@ public class StructureChooser extends GStructureChooser
       int count = 0;
       for (DBRefEntry dbRef : seq.getDBRef())
       {
-        seqRefs.add(getDBRefId(dbRef));
+        if (isValidSeqName(getDBRefId(dbRef)))
+        {
+          seqRefs.add(getDBRefId(dbRef));
+        }
+        // seqRefs.add(getDBRefId(dbRef));
         ++count;
         if (count > 10)
         {
@@ -330,14 +337,20 @@ public class StructureChooser extends GStructureChooser
    */
   public static boolean isValidSeqName(String seqName)
   {
-    String ignoreList = "pdb,uniprot";
+    System.out.println("seqName : " + seqName);
+    String ignoreList = "pdb,uniprot,swiss-prot";
     if (seqName.length() < 3)
     {
       return false;
     }
+    if (seqName.contains(":"))
+    {
+      return false;
+    }
+    seqName = seqName.toLowerCase();
     for (String ignoredEntry : ignoreList.split(","))
     {
-      if (seqName.equalsIgnoreCase(ignoredEntry))
+      if (seqName.contains(ignoredEntry))
       {
         return false;
       }