git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'feature/JAL-3127_seqidChainshading' into merge/JAL-3127
[jalview.git]
/
src
/
jalview
/
schemes
/
ClustalxColourScheme.java
diff --git
a/src/jalview/schemes/ClustalxColourScheme.java
b/src/jalview/schemes/ClustalxColourScheme.java
index
7ff1c65
..
19723ca
100755
(executable)
--- a/
src/jalview/schemes/ClustalxColourScheme.java
+++ b/
src/jalview/schemes/ClustalxColourScheme.java
@@
-20,9
+20,11
@@
*/
package jalview.schemes;
*/
package jalview.schemes;
+import jalview.api.AlignViewportI;
import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceI;
import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceI;
+import jalview.util.Comparison;
import java.awt.Color;
import java.util.List;
import java.awt.Color;
import java.util.List;
@@
-42,8
+44,8
@@
public class ClustalxColourScheme extends ResidueColourScheme
{
RED(0.9f, 0.2f, 0.1f), BLUE(0.5f, 0.7f, 0.9f), GREEN(0.1f, 0.8f, 0.1f),
ORANGE(0.9f, 0.6f, 0.3f), CYAN(0.1f, 0.7f, 0.7f),
{
RED(0.9f, 0.2f, 0.1f), BLUE(0.5f, 0.7f, 0.9f), GREEN(0.1f, 0.8f, 0.1f),
ORANGE(0.9f, 0.6f, 0.3f), CYAN(0.1f, 0.7f, 0.7f),
- PINK(0.9f, 0.5f, 0.5f), MAGENTA(0.8f, 0.3f, 0.8f), YELLOW(0.8f, 0.8f,
- 0.0f);
+ PINK(0.9f, 0.5f, 0.5f), MAGENTA(0.8f, 0.3f, 0.8f),
+ YELLOW(0.8f, 0.8f, 0.0f);
final Color colour;
final Color colour;
@@
-52,6
+54,7
@@
public class ClustalxColourScheme extends ResidueColourScheme
colour = new Color(r, g, b);
}
}
colour = new Color(r, g, b);
}
}
+
private class ConsensusColour
{
Consensus[] cons;
private class ConsensusColour
{
Consensus[] cons;
@@
-77,6
+80,14
@@
public class ClustalxColourScheme extends ResidueColourScheme
private boolean includeGaps = true;
private boolean includeGaps = true;
+ /**
+ * Default constructor (required for Class.newInstance())
+ */
+ public ClustalxColourScheme()
+ {
+
+ }
+
public ClustalxColourScheme(AnnotatedCollectionI alignment,
Map<SequenceI, SequenceCollectionI> hiddenReps)
{
public ClustalxColourScheme(AnnotatedCollectionI alignment,
Map<SequenceI, SequenceCollectionI> hiddenReps)
{
@@
-97,19
+108,18
@@
public class ClustalxColourScheme extends ResidueColourScheme
for (SequenceI sq : seqs)
{
for (SequenceI sq : seqs)
{
- char[] seq = sq.getSequence();
-
- int end_j = seq.length - 1;
+ int end_j = sq.getLength() - 1;
+ int length = sq.getLength();
for (int i = 0; i <= end_j; i++)
{
for (int i = 0; i <= end_j; i++)
{
- if ((seq.length - 1) < i)
+ if (length - 1 < i)
{
res = 23;
}
else
{
{
res = 23;
}
else
{
- res = ResidueProperties.aaIndex[seq[i]];
+ res = ResidueProperties.aaIndex[sq.getCharAt(i)];
}
cons2[i][res]++;
}
}
cons2[i][res]++;
}
@@
-268,48
+278,44
@@
public class ClustalxColourScheme extends ResidueColourScheme
}
@Override
}
@Override
- public Color findColour(char c, int j, SequenceI seq)
+ protected Color findColour(char c, int j, SequenceI seq)
{
{
- Color currentColour;
-
- if (cons2.length <= j
- || (includeGaps && threshold != 0 && !aboveThreshold(c, j)))
+ // TODO why the test for includeGaps here?
+ if (cons2.length <= j || Comparison.isGap(c)
+ /*|| (includeGaps && threshold != 0 && !aboveThreshold(c, j))*/)
{
return Color.white;
}
int i = ResidueProperties.aaIndex[c];
{
return Color.white;
}
int i = ResidueProperties.aaIndex[c];
- currentColour = Color.white;
+ Color colour = Color.white;
if (i > 19)
{
if (i > 19)
{
- return currentColour;
+ return colour;
}
for (int k = 0; k < residueColour[i].cons.length; k++)
{
}
for (int k = 0; k < residueColour[i].cons.length; k++)
{
- if (residueColour[i].cons[k].isConserved(cons2, j, size,
- includeGaps))
+ if (residueColour[i].cons[k].isConserved(cons2, j, size, includeGaps))
{
{
- currentColour = residueColour[i].c;
+ colour = residueColour[i].c;
}
}
if (i == 4)
{
}
}
if (i == 4)
{
+ /*
+ * override to colour C pink if >85% conserved
+ */
if (conses[27].isConserved(cons2, j, size, includeGaps))
{
if (conses[27].isConserved(cons2, j, size, includeGaps))
{
- currentColour = ClustalColour.PINK.colour;
+ colour = ClustalColour.PINK.colour;
}
}
}
}
- if (conservationColouring)
- {
- currentColour = applyConservation(currentColour, j);
- }
-
- return currentColour;
+ return colour;
}
/**
}
/**
@@
-330,11
+336,11
@@
public class ClustalxColourScheme extends ResidueColourScheme
}
@Override
}
@Override
- public ColourSchemeI applyTo(AnnotatedCollectionI sg,
- Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+ public ColourSchemeI getInstance(AlignViewportI view,
+ AnnotatedCollectionI sg)
{
ClustalxColourScheme css = new ClustalxColourScheme(sg,
{
ClustalxColourScheme css = new ClustalxColourScheme(sg,
- hiddenRepSequences);
+ view == null ? null : view.getHiddenRepSequences());
css.includeGaps = includeGaps;
return css;
}
css.includeGaps = includeGaps;
return css;
}
@@
-350,4
+356,10
@@
public class ClustalxColourScheme extends ResidueColourScheme
{
return JalviewColourScheme.Clustal.toString();
}
{
return JalviewColourScheme.Clustal.toString();
}
+
+ @Override
+ public boolean isSimple()
+ {
+ return false;
+ }
}
}