X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Frenderer%2FResidueShader.java;h=b914c65256dd0ff82a1ab911f5c177ca68987427;hb=b254ce17e47c43d19804efa129367291a79b1315;hp=7e4f2118cec87c0ce7ecb73c9d49a4f3a75c9296;hpb=f6123f656fa387e11f506dedd09672a0d0ff5ac5;p=jalview.git diff --git a/src/jalview/renderer/ResidueShader.java b/src/jalview/renderer/ResidueShader.java index 7e4f211..b914c65 100644 --- a/src/jalview/renderer/ResidueShader.java +++ b/src/jalview/renderer/ResidueShader.java @@ -61,6 +61,22 @@ public class ResidueShader implements ResidueShaderI * the consensus data for each column */ private ProfilesI consensus; + + /* + * the consensus data for each column + */ + private ProfilesI ssConsensus; + + + public ProfilesI getSsConsensus() + { + return ssConsensus; + } + + public void setSsConsensus(ProfilesI ssConsensus) + { + this.ssConsensus = ssConsensus; + } /* * if true, apply shading of colour by conservation @@ -128,6 +144,7 @@ public class ResidueShader implements ResidueShaderI this.conservationIncrement = rs.conservationIncrement; this.ignoreGaps = rs.ignoreGaps; this.pidThreshold = rs.pidThreshold; + this.ssConsensus = rs.ssConsensus; } /** @@ -137,6 +154,7 @@ public class ResidueShader implements ResidueShaderI public void setConsensus(ProfilesI cons) { consensus = cons; + } /** @@ -235,6 +253,11 @@ public class ResidueShader implements ResidueShaderI @Override public Color findColour(char symbol, int position, SequenceI seq) { + if (colourScheme == null) + { + return Color.white; // Colour is 'None' + } + /* * get 'base' colour */ @@ -243,14 +266,46 @@ public class ResidueShader implements ResidueShaderI : profile.getModalResidue(); float pid = profile == null ? 0f : profile.getPercentageIdentity(ignoreGaps); - Color colour = colourScheme == null ? Color.white - : colourScheme.findColour(symbol, position, seq, modalResidue, - pid); + Color colour = colourScheme.findColour(symbol, position, seq, + modalResidue, pid); + + /* + * apply PID threshold and consensus fading if in force + */ + if (!Comparison.isGap(symbol)) + { + colour = adjustColour(symbol, position, colour); + } + + return colour; + } + + @Override + public Color findSSColour(char symbol, int position, SequenceI seq) + { + if (colourScheme == null) + { + return Color.white; // Colour is 'None' + } + + /* + * get 'base' colour + */ + ProfileI profile = ssConsensus == null ? null : ssConsensus.get(position); + String modalSS = profile == null ? null + : profile.getModalSS(); + float pid = profile == null ? 0f + : profile.getSSPercentageIdentity(ignoreGaps); + Color colour = colourScheme.findColour(symbol, position, seq, + modalSS, pid); /* * apply PID threshold and consensus fading if in force */ - colour = adjustColour(symbol, position, colour); + if (!Comparison.isGap(symbol)) + { + colour = adjustColour(symbol, position, colour); + } return colour; }