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 'develop' into update_212_Dec_merge_with_21125_chamges
[jalview.git]
/
src
/
jalview
/
schemes
/
AnnotationColourGradient.java
diff --git
a/src/jalview/schemes/AnnotationColourGradient.java
b/src/jalview/schemes/AnnotationColourGradient.java
index
00744c0
..
764bb12
100755
(executable)
--- a/
src/jalview/schemes/AnnotationColourGradient.java
+++ b/
src/jalview/schemes/AnnotationColourGradient.java
@@
-20,6
+20,7
@@
*/
package jalview.schemes;
*/
package jalview.schemes;
+import jalview.api.AlignViewportI;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AnnotatedCollectionI;
@@
-39,12
+40,12
@@
public class AnnotationColourGradient extends FollowerColourScheme
/**
* map positional scores to transparency rather than colour
*/
/**
* map positional scores to transparency rather than colour
*/
- boolean positionToTransparency = true;
+ boolean positionToTransparency = false;
/**
* compute shade based on annotation row score
*/
/**
* compute shade based on annotation row score
*/
- boolean perLineScore = true;
+ boolean perLineScore = false;
public static final int NO_THRESHOLD = -1;
public static final int NO_THRESHOLD = -1;
@@
-86,8
+87,8
@@
public class AnnotationColourGradient extends FollowerColourScheme
private IdentityHashMap<SequenceI, AlignmentAnnotation> seqannot = null;
@Override
private IdentityHashMap<SequenceI, AlignmentAnnotation> seqannot = null;
@Override
- public ColourSchemeI getInstance(AnnotatedCollectionI sg,
- Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+ public ColourSchemeI getInstance(AlignViewportI view,
+ AnnotatedCollectionI sg)
{
AnnotationColourGradient acg = new AnnotationColourGradient(annotation,
getColourScheme(), aboveAnnotationThreshold);
{
AnnotationColourGradient acg = new AnnotationColourGradient(annotation,
getColourScheme(), aboveAnnotationThreshold);
@@
-244,7
+245,7
@@
public class AnnotationColourGradient extends FollowerColourScheme
}
if (plcount > 0 && plcount == ancount)
{
}
if (plcount > 0 && plcount == ancount)
{
- perLineScore = plcount == ancount;
+ perLineScore = plmax!=plmin;
aamax=plmax;
}
else
aamax=plmax;
}
else
@@
-363,9
+364,9
@@
public class AnnotationColourGradient extends FollowerColourScheme
if (annotationThreshold != null)
{
if ((aboveAnnotationThreshold == ABOVE_THRESHOLD
if (annotationThreshold != null)
{
if ((aboveAnnotationThreshold == ABOVE_THRESHOLD
- && aj.value < annotationThreshold.value)
+ && aj.value <= annotationThreshold.value)
|| (aboveAnnotationThreshold == BELOW_THRESHOLD
|| (aboveAnnotationThreshold == BELOW_THRESHOLD
- && aj.value > annotationThreshold.value))
+ && aj.value >= annotationThreshold.value))
{
return Color.white;
}
{
return Color.white;
}
@@
-458,14
+459,17
@@
public class AnnotationColourGradient extends FollowerColourScheme
&& aboveAnnotationThreshold == ABOVE_THRESHOLD
&& value >= ann.threshold.value)
{
&& aboveAnnotationThreshold == ABOVE_THRESHOLD
&& value >= ann.threshold.value)
{
- range = (value - ann.threshold.value)
- / (ann.graphMax - ann.threshold.value);
+ range = ann.graphMax == ann.threshold.value ? 1f
+ : (value - ann.threshold.value)
+ / (ann.graphMax - ann.threshold.value);
}
else if (thresholdIsMinMax && ann.threshold != null
&& aboveAnnotationThreshold == BELOW_THRESHOLD
&& value <= ann.threshold.value)
{
}
else if (thresholdIsMinMax && ann.threshold != null
&& aboveAnnotationThreshold == BELOW_THRESHOLD
&& value <= ann.threshold.value)
{
- range = (value - ann.graphMin) / (ann.threshold.value - ann.graphMin);
+ range = ann.graphMin == ann.threshold.value ? 0f
+ : (value - ann.graphMin)
+ / (ann.threshold.value - ann.graphMin);
}
else
{
}
else
{
@@
-484,12
+488,12
@@
public class AnnotationColourGradient extends FollowerColourScheme
if (perLineScore)
{
trans = (int) ((1f - range) * midtr);
if (perLineScore)
{
trans = (int) ((1f - range) * midtr);
- range = (float) ((annotation.score - plmin) / (plmax - aamin));
+ range = (float) ((ann.score - plmin) / (plmax - aamin));
}
int dr = (int) (redRange * range + redMin),
dg = (int) (greenRange * range + greenMin),
db = (int) (blueRange * range + blueMin);
}
int dr = (int) (redRange * range + redMin),
dg = (int) (greenRange * range + greenMin),
db = (int) (blueRange * range + blueMin);
- if (annotation.score == annotation.score && positionToTransparency)
+ if (ann.score == ann.score && positionToTransparency)
{
return new Color(Math.min(dr + trans, midtr), Math.min(dg
+ trans, midtr), Math.min(db + trans, midtr));
{
return new Color(Math.min(dr + trans, midtr), Math.min(dg
+ trans, midtr), Math.min(db + trans, midtr));
@@
-533,7
+537,7
@@
public class AnnotationColourGradient extends FollowerColourScheme
@Override
public String getSchemeName()
{
@Override
public String getSchemeName()
{
- return "Annotation";
+ return ANNOTATION_COLOUR;
}
@Override
}
@Override
@@
-541,4
+545,14
@@
public class AnnotationColourGradient extends FollowerColourScheme
{
return false;
}
{
return false;
}
+
+ public boolean isPositionToTransparency()
+ {
+ return positionToTransparency;
+ }
+
+ public void setPositionToTransparency(boolean positionToTransparency)
+ {
+ this.positionToTransparency = positionToTransparency;
+ }
}
}