JAL-1950 optionally just delete any redundant sequences in the alignment to simply...
authorJim Procter <jprocter@issues.jalview.org>
Mon, 30 Nov 2015 17:32:53 +0000 (17:32 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 30 Nov 2015 17:32:53 +0000 (17:32 +0000)
src/jalview/ws/ebi/HmmerJSONProcessor.java

index a6b15cf..a3eecd3 100644 (file)
@@ -195,7 +195,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 +215,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 +230,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);
+            }
           }
         }
       }