JAL-2629 hmmsearch # of new sequences now only displayed when specified
[jalview.git] / src / jalview / ws / ebi / HmmerJSONProcessor.java
index a6b15cf..428c498 100644 (file)
@@ -181,7 +181,9 @@ public class HmmerJSONProcessor
           hitseq.addSequenceFeature(new SequenceFeature(
                   "Pfam Domain Architecture", (hmmrhit.get("archindex"))
                           + " " + (arch = (String) hmmrhit.get("arch")), 0,
-                  0, Integer.valueOf((String) hmmrhit.get("archScore")),
+                  0,
+                  (hmmrhit.get("archScore") != null ? Integer
+                          .valueOf((String) hmmrhit.get("archScore")) : 0f),
                   "HMMER3"));
           addArchGroup(hitseq, arch);
           alipp.setScore(Double.valueOf("" + dhit.get("bitscore")));
@@ -195,7 +197,7 @@ public class HmmerJSONProcessor
       // look for other sequences represented by this hit and create rep groups
       // could be in "pdbs", or ..
       addRedundantSeqGroup(firsthit, alisqfrom, alisqto,
-              (JSONArray) hmmrhit.get("seqs"));
+              (JSONArray) hmmrhit.get("seqs"), true);
     }
   }
 
@@ -215,8 +217,7 @@ public class HmmerJSONProcessor
   }
 
   private void addRedundantSeqGroup(final SequenceI firsthit,
-          long alisqfrom,
-          long alisqto, JSONArray others)
+          long alisqfrom, long alisqto, JSONArray others, boolean justDelete)
   {
     if (others != null)
     {
@@ -231,24 +232,36 @@ public class HmmerJSONProcessor
         SequenceI[] other = resultAl.findSequenceMatch(repseq);
         if (other != null && other.length > 0)
         {
-          int ofound = 0;
-          for (SequenceI oth : other)
+          if (justDelete)
           {
-            if (oth.getStart() == alisqfrom && oth.getEnd() == alisqto)
+            for (SequenceI oth : other)
             {
-              ofound++;
-              repgroup.addSequence(oth, false);
+              resultAl.deleteSequence(oth);
             }
+            ;
           }
-          if (ofound == 0)
+          else
           {
-            System.err.println("Warn - no match for redundant hit "
-                    + repseq + "/" + alisqfrom + "-" + alisqto);
-          }
-          if (ofound > 1)
-          {
-            System.err.println("Warn - multiple matches for redundant hit "
-                    + repseq + "/" + alisqfrom + "-" + alisqto);
+            int ofound = 0;
+            for (SequenceI oth : other)
+            {
+              if (oth.getStart() == alisqfrom && oth.getEnd() == alisqto)
+              {
+                ofound++;
+                repgroup.addSequence(oth, false);
+              }
+            }
+            if (ofound == 0)
+            {
+              System.err.println("Warn - no match for redundant hit "
+                      + repseq + "/" + alisqfrom + "-" + alisqto);
+            }
+            if (ofound > 1)
+            {
+              System.err
+                      .println("Warn - multiple matches for redundant hit "
+                              + repseq + "/" + alisqfrom + "-" + alisqto);
+            }
           }
         }
       }