JAL-2154 verify recovered xref sequence not already in dataset before adding it
authorJim Procter <jprocter@issues.jalview.org>
Mon, 22 Aug 2016 12:01:35 +0000 (13:01 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 22 Aug 2016 12:01:35 +0000 (13:01 +0100)
src/jalview/analysis/CrossRef.java

index 81fad27..ddfd7ff 100644 (file)
@@ -438,8 +438,11 @@ public class CrossRef
                 }
                 else
                 {
-                  dataset.addSequence(map.getTo());
-                  matcher.add(map.getTo());
+                  if (dataset.findIndex(map.getTo()) == -1)
+                  {
+                    dataset.addSequence(map.getTo());
+                    matcher.add(map.getTo());
+                  }
                 }
                 try
                 {
@@ -509,8 +512,11 @@ public class CrossRef
         }
         retrievedSequence.updatePDBIds();
         rseqs.add(retrievedDss);
-        dataset.addSequence(retrievedDss);
-        matcher.add(retrievedDss);
+        if (dataset.findIndex(retrievedDss) == -1)
+        {
+          dataset.addSequence(retrievedDss);
+          matcher.add(retrievedDss);
+        }
       }
     }
   }