JAL-1164 only predict on currently selected sequences for perSequence
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Fri, 11 Oct 2013 09:58:00 +0000 (10:58 +0100)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Fri, 11 Oct 2013 09:58:00 +0000 (10:58 +0100)
src/jalview/ws/jws2/JabawsAlignCalcWorker.java

index 720e76a..d6a8d18 100644 (file)
@@ -23,6 +23,7 @@ import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AnnotatedCollectionI;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.SequenceI;
 import jalview.gui.AlignFrame;
@@ -149,7 +150,7 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
         return;
       }
       List<compbio.data.sequence.FastaSequence> seqs = getInputSequences(alignViewport
-              .getAlignment());
+              .getAlignment(), bySequence ? alignViewport.getSelectionGroup() : null);
 
       if (seqs == null)
       {
@@ -380,7 +381,7 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
 
   int realw;
 
-  public List<FastaSequence> getInputSequences(AlignmentI alignment)
+  public List<FastaSequence> getInputSequences(AlignmentI alignment, AnnotatedCollectionI inputSeqs)
   {
     if (alignment == null || alignment.getWidth() <= 0
             || alignment.getSequences() == null
@@ -390,6 +391,11 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
     {
       return null;
     }
+    if (inputSeqs==null || inputSeqs.getWidth()<=0 || inputSeqs.getSequences()==null || inputSeqs.getSequences().size()<1)
+    {
+      inputSeqs = alignment;
+    }
+    
     List<compbio.data.sequence.FastaSequence> seqs = new ArrayList<compbio.data.sequence.FastaSequence>();
 
     int minlen = 10;
@@ -399,7 +405,7 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
       seqNames = new HashMap<String, SequenceI>();
     }
     gapMap = new boolean[0];
-    for (SequenceI sq : ((List<SequenceI>) alignment.getSequences()))
+    for (SequenceI sq : (List<SequenceI>) inputSeqs.getSequences())
     {
       if (sq.getEnd() - sq.getStart() > minlen - 1)
       {