JAL-2210 two pass attempt to import retrieved sequences. First pass relies on matchin...
authorJim Procter <jprocter@issues.jalview.org>
Sun, 2 Oct 2016 11:24:30 +0000 (12:24 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Sun, 2 Oct 2016 11:24:30 +0000 (12:24 +0100)
src/jalview/analysis/CrossRef.java

index 31b35ec..71b0aa0 100644 (file)
@@ -421,19 +421,27 @@ public class CrossRef
 
     if (retrieved != null)
     {
-      updateDbrefMappings(seq, xrfs, retrieved, cf, fromDna);
+      boolean addedXref = false;
       for (SequenceI retrievedSequence : retrieved)
       {
         // dataset gets contaminated ccwith non-ds sequences. why ??!
         // try: Ensembl -> Nuc->Ensembl, Nuc->Uniprot-->Protein->EMBL->
         SequenceI retrievedDss = retrievedSequence.getDatasetSequence() == null ? retrievedSequence
                 : retrievedSequence.getDatasetSequence();
-        importCrossRefSeq(cf, dss, retrievedDss);
-        rseqs.add(retrievedDss);
-        if (dataset.findIndex(retrievedDss) == -1)
+        addedXref |= importCrossRefSeq(cf, dss, retrievedDss);
+      }
+      if (!addedXref)
+      {
+        // try again, after looking for matching IDs
+        // shouldn't need to do this unless the dbref mechanism has broken.
+        updateDbrefMappings(seq, xrfs, retrieved, cf, fromDna);
+        for (SequenceI retrievedSequence : retrieved)
         {
-          dataset.addSequence(retrievedDss);
-          matcher.add(retrievedDss);
+          // dataset gets contaminated ccwith non-ds sequences. why ??!
+          // try: Ensembl -> Nuc->Ensembl, Nuc->Uniprot-->Protein->EMBL->
+          SequenceI retrievedDss = retrievedSequence.getDatasetSequence() == null ? retrievedSequence
+                  : retrievedSequence.getDatasetSequence();
+          addedXref |= importCrossRefSeq(cf, dss, retrievedDss);
         }
       }
     }