Merge branch 'JAL-1139_proguard' into develop
[jalview.git] / src / jalview / ws / dbsources / Pdb.java
index 219008d..b8ab8ed 100644 (file)
@@ -23,6 +23,8 @@ import jalview.datamodel.DBRefSource;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Vector;
 
 import MCview.PDBChain;
@@ -133,6 +135,7 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy
               jalview.io.AppletFormatAdapter.FILE, "PDB");
       if (pdbfile != null)
       {
+        List<SequenceI> toremove=new ArrayList<SequenceI>();
         for (SequenceI pdbcs : pdbfile.getSequences())
         {
           String chid = null;
@@ -177,17 +180,23 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy
           }
           else
           {
-            // remove this sequence from the alignment - since it's not from the
-            // right chain
-            pdbfile.deleteSequence(pdbcs);
+            // mark this sequence to be removed from the alignment 
+            // - since it's not from the right chain
+            toremove.add(pdbcs);
           }
         }
+        // now remove marked sequences 
+        for (SequenceI pdbcs:toremove) {
+          pdbfile.deleteSequence(pdbcs);
+        }
       }
+      
       if (pdbfile == null || pdbfile.getHeight() < 1)
       {
         throw new Exception("No PDB Records for " + id + " chain "
                 + ((chain == null) ? "' '" : chain));
       }
+
     } catch (Exception ex) // Problem parsing PDB file
     {
       stopQuery();
@@ -220,4 +229,9 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy
     return "PDB"; // getDbSource();
   }
 
+  @Override
+  public int getTier()
+  {
+    return 0;
+  }
 }