- * @see #setThreshold(int, boolean)
- */
- public boolean aboveThreshold(char residue, int column)
- {
- if ('a' <= residue && residue <= 'z')
- {
- // TO UPPERCASE !!!
- // Faster than toUpperCase
- residue -= ('a' - 'A');
- }
-
- if (consensus == null)
- {
- return false;
- }
-
- ProfileI profile = consensus.get(column);
-
- /*
- * test whether this is the consensus (or joint consensus) residue
- */
- if (profile != null
- && profile.getModalResidue().contains(String.valueOf(residue)))
- {
- if (profile.getPercentageIdentity(ignoreGaps) >= threshold)
- {
- return true;
- }
- }
-
- return false;
- }
-
- @Override
- public boolean conservationApplied()
- {
- return conservationColouring;
- }
-
- @Override
- public void setConservationApplied(boolean conservationApplied)
- {
- conservationColouring = conservationApplied;
- }
-
- @Override
- public void setConservationInc(int i)
- {
- inc = i;
- }
-
- @Override
- public int getConservationInc()
- {
- return inc;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param consensus
- * DOCUMENT ME!
- */
- @Override
- public void setConsensus(ProfilesI consensus)
- {
- if (consensus == null)
- {
- return;
- }
-
- this.consensus = consensus;
- }
-
- @Override
- public void setConservation(Conservation cons)
- {
- if (cons == null)
- {
- conservationColouring = false;
- conservation = null;
- }
- else
- {
- conservationColouring = true;
- int iSize = cons.getConsSequence().getLength();
- conservation = new char[iSize];
- for (int i = 0; i < iSize; i++)
- {
- conservation[i] = cons.getConsSequence().getCharAt(i);
- }
- }
-
- }
-
- /**
- * Applies a combination of column conservation score, and conservation
- * percentage slider, to 'bleach' out the residue colours towards white.
- * <p>
- * If a column is fully conserved (identical residues, conservation score 11,
- * shown as *), or all 10 physico-chemical properties are conserved
- * (conservation score 10, shown as +), then the colour is left unchanged.
- * <p>
- * Otherwise a 'bleaching' factor is computed and applied to the colour. This
- * is designed to fade colours for scores of 0-9 completely to white at slider
- * positions ranging from 18% - 100% respectively.
- *
- * @param currentColour
- * @param column
- *
- * @return bleached (or unmodified) colour