package jalview.schemes;
import jalview.analysis.Conservation;
-import jalview.analysis.Profile;
import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.ProfileI;
+import jalview.datamodel.ProfilesI;
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceI;
+import jalview.util.ColorUtils;
import jalview.util.Comparison;
import jalview.util.MessageManager;
/*
* Consensus data indexed by column
*/
- Profile[] consensus;
+ ProfilesI consensus;
/*
* Conservation string as a char array
residue -= ('a' - 'A');
}
- if (consensus == null || consensus.length < column
- || consensus[column] == null)
+ if (consensus == null)
{
return false;
}
+ ProfileI profile = consensus.get(column);
+
/*
* test whether this is the consensus (or joint consensus) residue
*/
- if (consensus[column].getModalResidue().contains(
- String.valueOf(residue)))
+ if (profile != null
+ && profile.getModalResidue().contains(String.valueOf(residue)))
{
- if (consensus[column].getPercentageIdentity(ignoreGaps) >= threshold)
+ if (profile.getPercentageIdentity(ignoreGaps) >= threshold)
{
return true;
}
* DOCUMENT ME!
*/
@Override
- public void setConsensus(Profile[] consensus)
+ public void setConsensus(ProfilesI consensus)
{
if (consensus == null)
{
float bleachFactor = (11 - (conservationScore - '0')) / 10f;
/*
- * scale this by the percentage slider / 20
- */
- bleachFactor *= (inc / 20f);
-
- int red = currentColour.getRed();
- int green = currentColour.getGreen();
- int blue = currentColour.getBlue();
-
- /*
- * bleach colours towards white (255, 255, 255),
- * depending on the consensus score and the conservation slider value
- * scores of: 0 1 2 3 4 5 6 7 8 9
+ * scale this up by 0-5 (percentage slider / 20)
+ * as a result, scores of: 0 1 2 3 4 5 6 7 8 9
* fade to white at slider value: 18 20 22 25 29 33 40 50 67 100%
*/
- red += (255 - red) * bleachFactor;
- green += (255 - green) * bleachFactor;
- blue += (255 - blue) * bleachFactor;
+ bleachFactor *= (inc / 20f);
- if (red > 255 || green > 255 || blue > 255)
- {
- currentColour = Color.white;
- }
- else
- {
- currentColour = new Color(red, green, blue);
- }
- return currentColour;
+ return ColorUtils.bleachColour(currentColour, bleachFactor);
}
@Override