X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fanalysis%2FAlignmentSorterTest.java;h=b1f0edc097c1258204353e572018affc91cc0b61;hb=31aca2e9990ff33e088faa41419bb60014a6fbcf;hp=088611ed98d4f4a1a1ce3677d4c8e77056e0c311;hpb=aef3d5fa8e246dd69593b67de48e4f9de1699022;p=jalview.git diff --git a/test/jalview/analysis/AlignmentSorterTest.java b/test/jalview/analysis/AlignmentSorterTest.java index 088611e..b1f0edc 100644 --- a/test/jalview/analysis/AlignmentSorterTest.java +++ b/test/jalview/analysis/AlignmentSorterTest.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.analysis; import static org.testng.Assert.assertSame; @@ -31,10 +51,9 @@ public class AlignmentSorterTest /* * sort with no score features does nothing */ - PA.setValue(AlignmentSorter.class, "lastSortByFeatureScore", null); + PA.setValue(AlignmentSorter.class, "sortByFeatureCriteria", null); - AlignmentSorter.sortByFeature((String) null, null, 0, al.getWidth(), - al, + AlignmentSorter.sortByFeature(null, null, 0, al.getWidth(), al, AlignmentSorter.FEATURE_SCORE); assertSame(al.getSequenceAt(0), seq1); assertSame(al.getSequenceAt(1), seq2); @@ -48,26 +67,27 @@ public class AlignmentSorterTest * seq3 KD(-4), KD(3.0) average -0.5 * seq4 Helix(NaN) - should sort as if largest score */ - seq1.addSequenceFeature(new SequenceFeature("Cath", "", 2, 3, 2.0f, - "g1")); - seq1.addSequenceFeature(new SequenceFeature("Pfam", "", 4, 5, 4.0f, - "g2")); - seq2.addSequenceFeature(new SequenceFeature("Cath", "", 2, 3, 2.5f, - "g3")); - seq2.addSequenceFeature(new SequenceFeature("Metal", "", 2, 3, - Float.NaN, "g4")); + seq1.addSequenceFeature( + new SequenceFeature("Cath", "", 2, 3, 2.0f, "g1")); + seq1.addSequenceFeature( + new SequenceFeature("Pfam", "", 4, 5, 4.0f, "g2")); + seq2.addSequenceFeature( + new SequenceFeature("Cath", "", 2, 3, 2.5f, "g3")); + seq2.addSequenceFeature( + new SequenceFeature("Metal", "", 2, 3, Float.NaN, "g4")); seq3.addSequenceFeature(new SequenceFeature("kD", "", 2, 3, -4f, "g5")); - seq3.addSequenceFeature(new SequenceFeature("kD", "", 5, 6, 3.0f, "g6")); - seq4.addSequenceFeature(new SequenceFeature("Helix", "", 2, 3, - Float.NaN, "g7")); + seq3.addSequenceFeature( + new SequenceFeature("kD", "", 5, 6, 3.0f, "g6")); + seq4.addSequenceFeature( + new SequenceFeature("Helix", "", 2, 3, Float.NaN, "g7")); /* * sort by ascending score, no filter on feature type or group * NB sort order for the same feature set (none) gets toggled, so descending */ - PA.setValue(AlignmentSorter.class, "sortByFeatureScoreAscending", true); - AlignmentSorter.sortByFeature((String) null, null, 0, al.getWidth(), - al, AlignmentSorter.FEATURE_SCORE); + PA.setValue(AlignmentSorter.class, "sortByFeatureAscending", true); + AlignmentSorter.sortByFeature(null, null, 0, al.getWidth(), al, + AlignmentSorter.FEATURE_SCORE); assertSame(al.getSequenceAt(3), seq3); // -0.5 assertSame(al.getSequenceAt(2), seq2); // 2.5 assertSame(al.getSequenceAt(1), seq1); // 3.0 @@ -76,8 +96,8 @@ public class AlignmentSorterTest /* * repeat sort toggles order - now ascending */ - AlignmentSorter.sortByFeature((String) null, null, 0, al.getWidth(), - al, AlignmentSorter.FEATURE_SCORE); + AlignmentSorter.sortByFeature(null, null, 0, al.getWidth(), al, + AlignmentSorter.FEATURE_SCORE); assertSame(al.getSequenceAt(0), seq3); // -0.5 assertSame(al.getSequenceAt(1), seq2); // 2.5 assertSame(al.getSequenceAt(2), seq1); // 3.0 @@ -101,8 +121,9 @@ public class AlignmentSorterTest * seq3 average is now 3.0 * next sort is ascending (not toggled) as for a different group spec */ - List groups = Arrays.asList(new String[] { "g1", "g2", "g3", - "g6" }); + List groups = Arrays + .asList(new String[] + { "g1", "g2", "g3", "g6" }); AlignmentSorter.sortByFeature(types, groups, 0, al.getWidth(), al, AlignmentSorter.FEATURE_SCORE); assertSame(al.getSequenceAt(0), seq1); // 2.0 @@ -116,7 +137,7 @@ public class AlignmentSorterTest */ // fails because seq1.findPosition(4) returns 4 // although residue 4 is in column 5! - JAL-2544 - AlignmentSorter.sortByFeature((String) null, null, 0, 4, al, + AlignmentSorter.sortByFeature(null, null, 0, 4, al, AlignmentSorter.FEATURE_SCORE); assertSame(al.getSequenceAt(0), seq3); // -4 assertSame(al.getSequenceAt(1), seq1); // 2.0