se[1])
+ se[1] = p;
+ }
}
- else
+ if (se != null)
{
- if (p < se[0])
- se[0] = p;
- if (p > se[1])
- se[1] = p;
+ gl.add(se);
}
}
- if (se != null)
+ }
+ // are there any more sequences ungrouped that should be added as a single
+ // remaining group ? - these might be at the start or the end
+ if (gl.size() > 0)
+ {
+ if (lowest-1>minsize)
+ {
+ gl.add(0, new int[]
+ { 0, lowest-2});
+ }
+ if ((al.getHeight()-1-highest)>minsize)
{
- gl.add(se);
+ gl.add(new int[] { highest+1, al.getHeight()-1});
}
}
+ else
+ {
+ gl.add(new int[]
+ { 0, al.getHeight() - 1 });
+ }
+ if (min >= 0 && gl.size() < min)
+ {
+ throw new NoValidInputDataException(
+ "Not enough sequence groups for input. Need at least " + min
+ + " groups (including ungrouped regions).");
+ }
+ if (max > 0 && gl.size() > max)
+ {
+ throw new NoValidInputDataException(
+ "Too many sequence groups for input. Need at most " + max
+ + " groups (including ungrouped regions).");
+ }
int[][] vals = gl.toArray(new int[gl.size()][]);
int[] srt = new int[gl.size()];
for (int i = 0; i < vals.length; i++)
@@ -121,4 +187,103 @@ public class SeqGroupIndexVector extends InputType implements
return new StringBody(idvector.toString());
}
-}
\ No newline at end of file
+ /**
+ * set minimum number of sequences allowed in a partition. Default is 1
+ * sequence.
+ *
+ * @param i
+ * (number greater than 1)
+ */
+ public void setMinsize(int i)
+ {
+ if (minsize >= 1)
+ {
+ minsize = i;
+ }
+ else
+ {
+ minsize = 1;
+ }
+ }
+
+ @Override
+ public List