JAL-1601 Reuse existing "getNonEmptySequenceSet" method
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Wed, 18 Oct 2023 13:50:32 +0000 (15:50 +0200)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Wed, 18 Oct 2023 13:50:32 +0000 (15:50 +0200)
src/jalview/ws2/actions/secstructpred/SecStructPredMsaTask.java

index 5067ff7..21d8807 100644 (file)
@@ -2,6 +2,7 @@ package jalview.ws2.actions.secstructpred;
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
@@ -67,22 +68,13 @@ public class SecStructPredMsaTask
     referenceSeq.setSequence(alignmentView.getASequenceString('-', 0));
     for (int i = 0; i < sequences.length; i++)
       sequences[i].setSequence(alignmentView.getASequenceString('-', i));
-    var sequencesList = filterEmptySequences(sequences);
-    var job = new SecStructPredJob(sequencesList, referenceSeq, delMap,
-            sequenceInfo);
+    var nonEmptySeqs = SeqsetUtils.getNonEmptySequenceSet(sequences);
+    var job = new SecStructPredJob(Arrays.asList(nonEmptySeqs),
+            referenceSeq, delMap, sequenceInfo);
     job.setStatus(JobStatus.READY);
     return List.of(job);
   }
 
-  private static List<SequenceI> filterEmptySequences(SequenceI[] seqs)
-  {
-    var filtered = new ArrayList<SequenceI>();
-    for (var seq : seqs)
-      if (seq.getEnd() - seq.getStart() > 0)
-        filtered.add(seq);
-    return filtered;
-  }
-
   @Override
   protected AlignmentI collectResult(List<SecStructPredJob> jobs)
           throws IOException