[
getNames: { ['Phosphorylation', 'Turn'] as String[] },
getDescriptions: { ['Count of Phosphorylation features', 'Count of Turn features'] as String[] },
- getMinColour: { [0, 255, 255] as int[] }, // cyan
- getMaxColour: { [0, 0, 255] as int[] }, // blue
+ getMinColour: { i -> [0, 255, 255] as int[] }, // cyan
+ getMaxColour: { i -> [0, 0, 255] as int[] }, // blue
count:
{ res, feats ->
int phos
[
getNames: { visibleFeatures as String[] },
getDescriptions: { visibleFeatures as String[] },
- getMinColour: { [0, 255, 255] as int[] }, // cyan
- getMaxColour: { [0, 0, 255] as int[] }, // blue
+ getMinColour: { i-> [0, 255, 255] as int[] }, // cyan
+ getMaxColour: { i-> [0, 0, 255] as int[] }, // blue
count:
{ res, feats ->
getCounts.call(feats)
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Annotation;
+import jalview.datamodel.MappedFeatures;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.renderer.seqfeatures.FeatureRenderer;
max[crow] = 0;
}
- int[] minC = counter.getMinColour();
- int[] maxC = counter.getMaxColour();
- Color minColour = new Color(minC[0], minC[1], minC[2]);
- Color maxColour = new Color(maxC[0], maxC[1], maxC[2]);
-
for (int col = 0; col < width; col++)
{
int[] count = counts[col];
for (int anrow = 0; anrow < rows; anrow++)
{
+ int[] minC = counter.getMinColour(anrow);
+ int[] maxC = counter.getMaxColour(anrow);
+ Color minColour = new Color(minC[0], minC[1], minC[2]);
+ Color maxColour = new Color(maxC[0], maxC[1], maxC[2]);
+
Annotation[] anns = new Annotation[width];
long rmax = 0;
/*
*/
// see JAL-2075
List<SequenceFeature> features = fr.findFeaturesAtColumn(seq, col + 1);
+ if (fr.hasRenderOrder())
+ {
+ MappedFeatures mappedFeatres = fr.findComplementFeaturesAtResidue(seq,
+ seq.findPosition(col));
+ features.addAll(mappedFeatres.features);
+ }
int[] count = this.counter.count(String.valueOf(res), features);
return count;
}
package jalview.workers;
-import jalview.datamodel.SequenceFeature;
-
import java.util.List;
+import jalview.datamodel.SequenceFeature;
+
/**
* An interface for a type that returns counts (per computed annotation type) of
* any value of interest at a sequence position that can be determined from the
String[] getDescriptions();
/**
- * Returns the colour (as [red, green, blue] values in the range 0-255) to use
- * for the minimum value on histogram bars. If this is different to
- * getMaxColour(), then bars will have a graduated colour.
+ * for each property returned from getNames Returns the colour (as [red,
+ * green, blue] values in the range 0-255) to use for the minimum value on
+ * histogram bars. If this is different to getMaxColour(), then bars will have
+ * a graduated colour.
*
* @return
*/
- int[] getMinColour();
+ int[] getMinColour(int anrow);
/**
- * Returns the colour (as [red, green, blue] values in the range 0-255) to use
- * for the maximum value on histogram bars. If this is the same as
- * getMinColour(), then bars will have a single colour (not graduated).
+ * for each property returned from getNames Returns the colour (as [red,
+ * green, blue] values in the range 0-255) to use for the maximum value on
+ * histogram bars. If this is the same as getMinColour(), then bars will have
+ * a single colour (not graduated).
*
* @return
*/
- int[] getMaxColour();
+ int[] getMaxColour(int anrow);
}
*/
package jalview.workers;
+import java.awt.Color;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import jalview.api.AlignViewportI;
+import jalview.api.FeatureColourI;
import jalview.api.FeaturesDisplayedI;
import jalview.datamodel.SequenceFeature;
import jalview.gui.FeatureRenderer;
@Override
public void propertyChange(PropertyChangeEvent evt)
{
- if (ourViewport != null) // could check source is
+ if (ourViewport != null) // could
+ // check
+ // source
+ // is
// ourFr.getChangeSupport...
{
updateFeatureAnnotationTracks();
.isShowSequenceFeatureCounts()
? ourViewport.getFeaturesDisplayed()
: null;
+ // get latest FeatureRenderer, just in case it's different.
+ ourFr = ourFr.getAlignPanel().getFeatureRenderer();
+
Set<String> visibleFeatures = new HashSet();
if (featuresDisp != null)
{
}
// otherwise set up tracks accordingly
+ int[][] minC = new int[visibleFeatures.size()][3],
+ maxC = new int[visibleFeatures.size()][3];
+ Map<String, FeatureColourI> fcs = ourFr.getDisplayedFeatureCols();
+ int p = 0;
+ for (String s : visibleFeatures)
+ {
+ FeatureColourI color = fcs.get(s);
+ if (color.isSimpleColour())
+ {
+ minC[p] = new int[] { 133, 133, 133 };
+ maxC[p] = new int[] { color.getColour().getRed(),
+ color.getColour().getGreen(), color.getColour().getBlue() };
+ }
+ else
+ {
+ Color min = color.getMinColour(), max = color.getMaxColour();
+ minC[p] = new int[] { min.getRed(), min.getGreen(), min.getBlue() };
+ maxC[p] = new int[] { max.getRed(), max.getGreen(), max.getBlue() };
+ }
+ p++;
+ }
+ minColours = minC;
+ maxColours = maxC;
/*
* and register the counter
*/
if (ourWorker != null)
{
- Set<String> toRemove = new HashSet<String>(),
- toAdd = new HashSet<String>();
+ Set<String> toRemove = new HashSet<String>();
toRemove.addAll(dispFeatures);
toRemove.removeAll(visibleFeatures);
dispFeatures = visibleFeatures;
return dispFeatures.toArray(new String[0]);
}
+ int[][] minColours = null, maxColours = null;
+
@Override
- public int[] getMaxColour()
+ public int[] getMaxColour(int row)
{
+ if (maxColours != null && row >= 0 && row < maxColours.length)
+ {
+ return maxColours[row];
+ }
return new int[] { 0, 0, 255 };
}
@Override
- public int[] getMinColour()
+ public int[] getMinColour(int row)
{
- return new int[] { 0, 255, 255 };
+ if (minColours != null && row >= 0 && row < minColours.length)
+ {
+ return minColours[row];
+ }
+ return new int[] { 133, 133, 133 };
}
}
\ No newline at end of file