JAL-2332 bugfix to enable structure chooser opening for hen lysozyme
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Mon, 21 Nov 2016 13:03:40 +0000 (13:03 +0000)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Mon, 21 Nov 2016 13:03:40 +0000 (13:03 +0000)
src/jalview/gui/StructureChooser.java

index 3350f6c..21b6e4f 100644 (file)
@@ -83,6 +83,8 @@ public class StructureChooser extends GStructureChooser implements
 
   private boolean cachedPDBExists;
 
+  private static int MAX_QLENGHT = 7820;
+
   public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq,
           AlignmentPanel ap)
   {
@@ -259,7 +261,8 @@ public class StructureChooser extends GStructureChooser implements
     StringBuilder queryBuilder = new StringBuilder();
     Set<String> seqRefs = new LinkedHashSet<String>();
 
-    if (seq.getAllPDBEntries() != null)
+    if (seq.getAllPDBEntries() != null
+            && queryBuilder.length() < MAX_QLENGHT)
     {
       for (PDBEntry entry : seq.getAllPDBEntries())
       {
@@ -268,7 +271,6 @@ public class StructureChooser extends GStructureChooser implements
           queryBuilder.append("pdb_id:")
                   .append(entry.getId().toLowerCase()).append(" OR ");
           isPDBRefsFound = true;
-          // seqRefs.add(entry.getId());
         }
       }
     }
@@ -277,7 +279,8 @@ public class StructureChooser extends GStructureChooser implements
     {
       for (DBRefEntry dbRef : seq.getDBRefs())
       {
-        if (isValidSeqName(getDBRefId(dbRef)))
+        if (isValidSeqName(getDBRefId(dbRef))
+                && queryBuilder.length() < MAX_QLENGHT)
         {
           if (dbRef.getSource().equalsIgnoreCase(DBRefSource.UNIPROT))
           {