X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Frenderer%2Fseqfeatures%2FFeatureColourFinderTest.java;fp=test%2Fjalview%2Frenderer%2Fseqfeatures%2FFeatureColourFinderTest.java;h=6b87dd4c1a2325a43f9d174ea2067bf10e9ce4cb;hb=afbff636fa2dfa01daa1f4ec4e8a936e61e3cf16;hp=6b1fbd2f1b6fc3f16c78bdad47997f33d7f04821;hpb=c6df3928336440918d23b4e7cb579f134e2f48dd;p=jalview.git diff --git a/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java b/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java index 6b1fbd2..6b87dd4 100644 --- a/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java +++ b/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.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.renderer.seqfeatures; import static org.testng.Assert.assertEquals; @@ -58,8 +78,7 @@ public class FeatureColourFinderTest { // aligned column 8 is sequence position 6 String s = ">s1\nABCDE---FGHIJKLMNOPQRSTUVWXYZ\n"; - af = new FileLoader().LoadFileWaitTillLoaded(s, - DataSourceType.PASTE); + af = new FileLoader().LoadFileWaitTillLoaded(s, DataSourceType.PASTE); av = af.getViewport(); seq = av.getAlignment().getSequenceAt(0); fr = af.getFeatureRenderer(); @@ -134,8 +153,8 @@ public class FeatureColourFinderTest @Test(groups = "Functional") public void testFindFeatureColour_gapPosition() { - seq.addSequenceFeature(new SequenceFeature("Metal", "Metal", 2, 12, 0f, - null)); + seq.addSequenceFeature( + new SequenceFeature("Metal", "Metal", 2, 12, 0f, null)); fr.setColour("Metal", new FeatureColour(Color.red)); fr.featuresAdded(); av.setShowSequenceFeatures(true); @@ -265,8 +284,8 @@ public class FeatureColourFinderTest /* * currently contact feature == type "Disulphide Bond" or "Disulfide Bond" !! */ - seq.addSequenceFeature(new SequenceFeature("Disulphide Bond", - "Contact", 2, 12, Float.NaN, "Disulphide")); + seq.addSequenceFeature(new SequenceFeature("Disulphide Bond", "Contact", + 2, 12, Float.NaN, "Disulphide")); fr.setColour("Disulphide Bond", new FeatureColour(Color.red)); fr.featuresAdded(); av.setShowSequenceFeatures(true); @@ -311,12 +330,12 @@ public class FeatureColourFinderTest @Test(groups = "Functional") public void testFindFeatureColour_graduatedFeatureColour() { - seq.addSequenceFeature(new SequenceFeature("kd", "hydrophobicity", 2, - 2, 0f, "KdGroup")); - seq.addSequenceFeature(new SequenceFeature("kd", "hydrophobicity", 4, - 4, 5f, "KdGroup")); - seq.addSequenceFeature(new SequenceFeature("kd", "hydrophobicity", 7, - 7, 10f, "KdGroup")); + seq.addSequenceFeature(new SequenceFeature("kd", "hydrophobicity", 2, 2, + 0f, "KdGroup")); + seq.addSequenceFeature(new SequenceFeature("kd", "hydrophobicity", 4, 4, + 5f, "KdGroup")); + seq.addSequenceFeature(new SequenceFeature("kd", "hydrophobicity", 7, 7, + 10f, "KdGroup")); /* * graduated colour from 0 to 10 @@ -356,7 +375,7 @@ public class FeatureColourFinderTest fr.setColour("Metal", red); fr.featuresAdded(); av.setShowSequenceFeatures(true); - + /* * the FeatureSettings transparency slider has range 0-70 which * corresponds to a transparency value of 1 - 0.3 @@ -382,7 +401,7 @@ public class FeatureColourFinderTest fr.setColour("Domain", green); fr.featuresAdded(); av.setShowSequenceFeatures(true); - + /* * Domain (green) rendered above Metal (red) above background (cyan) * 1) 0.6 * red(255, 0, 0) + 0.4 * cyan(0, 255, 255) = (153, 102, 102) @@ -391,7 +410,7 @@ public class FeatureColourFinderTest fr.setTransparency(0.6f); Color c = finder.findFeatureColour(Color.cyan, seq, 10); assertEquals(c, new Color(61, 194, 41)); - + /* * now promote Metal above Domain * - currently no way other than mimicking reordering of @@ -406,7 +425,7 @@ public class FeatureColourFinderTest fr.setFeaturePriority(data); c = finder.findFeatureColour(Color.cyan, seq, 10); assertEquals(c, new Color(153, 102, 41)); - + /* * ..and turn off display of Metal * Domain (green) above background (pink) @@ -478,15 +497,15 @@ public class FeatureColourFinderTest { String kdFeature = "kd"; String metalFeature = "Metal"; - seq.addSequenceFeature(new SequenceFeature(kdFeature, "hydrophobicity", 2, - 2, 0f, "KdGroup")); - seq.addSequenceFeature(new SequenceFeature(kdFeature, "hydrophobicity", 4, - 4, 5f, "KdGroup")); - seq.addSequenceFeature(new SequenceFeature(metalFeature, "Fe", 4, 4, - 5f, "MetalGroup")); - seq.addSequenceFeature(new SequenceFeature(kdFeature, "hydrophobicity", 7, - 7, 10f, "KdGroup")); - + seq.addSequenceFeature(new SequenceFeature(kdFeature, "hydrophobicity", + 2, 2, 0f, "KdGroup")); + seq.addSequenceFeature(new SequenceFeature(kdFeature, "hydrophobicity", + 4, 4, 5f, "KdGroup")); + seq.addSequenceFeature(new SequenceFeature(metalFeature, "Fe", 4, 4, 5f, + "MetalGroup")); + seq.addSequenceFeature(new SequenceFeature(kdFeature, "hydrophobicity", + 7, 7, 10f, "KdGroup")); + /* * kd feature has graduated colour from 0 to 10 * above threshold value of 5 @@ -510,7 +529,7 @@ public class FeatureColourFinderTest fr.setFeaturePriority(data); av.setShowSequenceFeatures(true); - + /* * position 2, column 1, score 0 - below threshold - default colour */ @@ -523,7 +542,7 @@ public class FeatureColourFinderTest */ c = finder.findFeatureColour(Color.blue, seq, 3); assertEquals(c, Color.green); - + /* * position 7, column 9, score 10 - maximum colour in range */