Merge branch 'docs/2_8_1_Release' into Release_2_8_2_Branch
[jalview.git] / src / jalview / ws / dbsources / Pdb.java
index 219008d..c54822e 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
+ * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -14,6 +14,7 @@
  * PURPOSE.  See the GNU General Public License for more details.
  * 
  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.ws.dbsources;
 
@@ -23,6 +24,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 +136,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 +181,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 +230,9 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy
     return "PDB"; // getDbSource();
   }
 
+  @Override
+  public int getTier()
+  {
+    return 0;
+  }
 }