From: gmungoc Date: Wed, 17 Aug 2016 11:22:19 +0000 (+0100) Subject: JAL-2172 reverted to not sorting column selection X-Git-Tag: Release_2_10_0~104 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=898cc82d963669a958a7666eb4bc63d90b9b9614;p=jalview.git JAL-2172 reverted to not sorting column selection --- diff --git a/src/jalview/analysis/Grouping.java b/src/jalview/analysis/Grouping.java index ddf483b..2ddd015 100644 --- a/src/jalview/analysis/Grouping.java +++ b/src/jalview/analysis/Grouping.java @@ -25,7 +25,6 @@ import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -128,6 +127,11 @@ public class Grouping } } } + + /* + * get selected columns (in the order they were selected); + * note this could include right-to-left ranges + */ int[] spos = new int[cs.getSelected().size()]; int width = -1; int i = 0; @@ -136,11 +140,6 @@ public class Grouping spos[i++] = pos.intValue(); } - /* - * ensure column selection is in ascending order - */ - Arrays.sort(spos); - for (i = 0; i < sequences.length; i++) { int slen = sequences[i].getLength(); diff --git a/test/jalview/analysis/GroupingTest.java b/test/jalview/analysis/GroupingTest.java index 3afa6e5..df39b81 100644 --- a/test/jalview/analysis/GroupingTest.java +++ b/test/jalview/analysis/GroupingTest.java @@ -53,10 +53,15 @@ public class GroupingTest AlignmentI alignment = new Alignment( new SequenceI[] { s1, s2, s3, s4, s5 }); + /* + * test for the case where column selections are not added in + * left to right order + */ + int[] positions = new int[] { 7, 9, 1 }; + @Test(groups = { "Functional" }) public void testMakeGroupsWithBoth() { - int[] positions = new int[] { 1, 7, 9 }; String[] str = new String[alignment.getHeight()]; int seq = 0; for (SequenceI s : alignment.getSequences()) @@ -72,11 +77,6 @@ public class GroupingTest alignment.getSequencesArray(), str, Arrays.asList(new SequenceGroup[] { sg_12, sg_345 })); - /* - * test for the case where column selections are not added in - * left to right order - */ - positions = new int[] { 7, 9, 1 }; ColumnSelection cs = new ColumnSelection(); for (int p : positions) {