JAL-2154 keep track of incomplete sequences and report if they weren’t resolved
authorJim Procter <jprocter@issues.jalview.org>
Sun, 24 Jul 2016 13:04:15 +0000 (14:04 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Sun, 24 Jul 2016 13:04:15 +0000 (14:04 +0100)
src/jalview/gui/Jalview2XML.java

index c0e1ebe..9b2b04a 100644 (file)
@@ -165,6 +165,8 @@ public class Jalview2XML
    */
   Map<String, SequenceI> seqRefIds = null;
 
+  Map<String, SequenceI> incompleteSeqs = null;
+
   List<SeqFref> frefedSequence = null;
 
   boolean raiseGUI = true; // whether errors are raised in dialog boxes or not
@@ -220,6 +222,10 @@ public class Jalview2XML
       {
         seqsToIds.clear();
       }
+      if (incompleteSeqs != null)
+      {
+        incompleteSeqs.clear();
+      }
       // seqRefIds = null;
       // seqsToIds = null;
     }
@@ -242,6 +248,10 @@ public class Jalview2XML
     {
       seqRefIds = new HashMap<String, SequenceI>();
     }
+    if (incompleteSeqs == null)
+    {
+      incompleteSeqs = new HashMap<String, SequenceI>();
+    }
     if (frefedSequence == null)
     {
       frefedSequence = new ArrayList<SeqFref>();
@@ -393,6 +403,24 @@ public class Jalview2XML
       System.err.println("SERIOUS! " + failedtoresolve
               + " resolvable forward references failed to resolve.");
     }
+    if (incompleteSeqs != null && incompleteSeqs.size() > 0)
+    {
+      System.err.println("Jalview Project Import: There are "
+              + incompleteSeqs.size()
+              + " sequences which may have incomplete metadata.");
+      if (incompleteSeqs.size() < 10)
+      {
+        for (SequenceI s : incompleteSeqs.values())
+        {
+          System.err.println(s.toString());
+        }
+      }
+      else
+      {
+        System.err
+                .println("Too many to report. Skipping output of incomplete sequences.");
+      }
+    }
   }
 
   /**
@@ -2743,6 +2771,18 @@ public class Jalview2XML
       SequenceI tmpSeq = seqRefIds.get(seqId);
       if (tmpSeq != null)
       {
+        if (!incompleteSeqs.containsKey(seqId))
+        {
+          // may not need this check, but keep it for at least 2.9,1 release
+          if (tmpSeq.getStart()!=jseqs[i].getStart() || tmpSeq.getEnd()!=jseqs[i].getEnd())
+          { 
+            System.err
+                    .println("Warning JAL-2154 regression: updating start/end for sequence "
+                    + tmpSeq.toString());
+          }
+        } else {
+          incompleteSeqs.remove(seqId);
+        }
         tmpSeq.setStart(jseqs[i].getStart());
         tmpSeq.setEnd(jseqs[i].getEnd());
         tmpseqs.add(tmpSeq);
@@ -5103,6 +5143,7 @@ public class Jalview2XML
           djs.setEnd(jmap.getMap().getToHighest());
           djs.setVamsasId(uniqueSetSuffix + sqid);
           jmap.setTo(djs);
+          incompleteSeqs.put(sqid, djs);
           seqRefIds.put(sqid, djs);
 
         }